Skip to content

Commit

Permalink
Remove "toStr" function
Browse files Browse the repository at this point in the history
Only needed for Python2, which is not supported
  • Loading branch information
ZedThree committed Feb 23, 2017
1 parent 52ab0fe commit 35a2c8c
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions pyxpad/pyxpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def addNetCDF(self):
tr = self.main.tr
fname, _ = QFileDialog.getOpenFileName(self.main, tr('Open file'), '.',
filter=tr("NetCDF files (*.nc *.cdl)"))
fname = toStr(fname)
if (fname is None) or (fname == ""):
return # Cancelled

Expand All @@ -150,7 +149,6 @@ def addXPADtree(self):
tr = self.main.tr
dname = QFileDialog.getExistingDirectory(self.main, tr('Open XPAD directory'),
QDir.currentPath())
dname = toStr(dname)
if (dname == "") or (dname is None):
return
# Create data source
Expand All @@ -175,7 +173,6 @@ def addBOUT(self):
tr = self.main.tr
dname = QFileDialog.getExistingDirectory(self.main, tr('Open BOUT++ directory'),
QDir.currentPath())
dname = toStr(dname)
if (dname == "") or (dname is None):
return
# Create data source
Expand Down Expand Up @@ -251,14 +248,14 @@ def updateDisplay(self):
nextra = 0
for item in selecteditems:
if 'source' in item.__dict__:
name = toStr(item.text())
name = item.text()
selectedvars.append((name, item.source))
if item.source != s:
nextra += 1

table.clearContents() # Clear the table and selections

pattern = toStr(self.main.tracePattern.text())
pattern = self.main.tracePattern.text()
if pattern == "":
varNames = s.varNames
else:
Expand Down Expand Up @@ -341,14 +338,14 @@ def read(self):
"""

# Get list of shots
shotlist = toStr(self.main.shotInput.text()).split(',')
shotlist = self.main.shotInput.text().split(',')

table = self.main.sourceTable
tableitems = table.selectedItems()
data = []
for item in tableitems:
if 'source' in item.__dict__:
name = toStr(item.text())
name = item.text()

for shot in shotlist:
s = "Reading " + name + " from " + item.source.label
Expand Down Expand Up @@ -473,7 +470,6 @@ def saveState(self, filename=None):
defaultfile = os.path.join(self.config_dir, "saved_state.pyx")
filename, _ = QFileDialog.getSaveFileName(self, dir=defaultfile,
filter=tr("PyXPad save file (*.pyx)"))
filename = toStr(filename)
if (filename is None) or (filename == ""):
return
try:
Expand All @@ -496,7 +492,6 @@ def loadState(self, filename=None):
tr = self.tr
filename, _ = QFileDialog.getOpenFileName(self, tr('Open file'), '.',
filter=tr("PyXPad save file (*.pyx)"))
filename = toStr(filename)
if (filename is None) or (filename == ""):
return # Cancelled
if not os.path.exists(filename):
Expand Down Expand Up @@ -734,7 +729,7 @@ def dataTableChanged(self, row, col):
if col == 0:
# The name of the variable
it = self.dataTable.item(row, col)
name = toStr(it.text())
name = it.text()
oldname = it.oldname
if name == oldname:
return # Not really changed
Expand Down Expand Up @@ -766,10 +761,8 @@ def commandEntered(self, text=None):
text = self.commandInput.text()
self.commandInput.execute(emit=False)

# Get the command text and clear the text box
cmd = toStr(text)
self.commandInput.clear()
self.runCommand(cmd)
self.runCommand(text)

def selectedDataNames(self):
"""
Expand Down

0 comments on commit 35a2c8c

Please sign in to comment.