Navigation Menu

Skip to content

Commit

Permalink
update ScriptEditorDialog for py3
Browse files Browse the repository at this point in the history
  • Loading branch information
ghtmtt committed Oct 18, 2016
1 parent 7f3b10b commit 76d17ca
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/plugins/processing/gui/ScriptEditorDialog.py
Expand Up @@ -141,7 +141,7 @@ def __init__(self, algType, alg):

def showSnippets(self, evt):
popupmenu = QMenu()
for name, snippet in self.snippets.iteritems():
for name, snippet in list(self.snippets.items()):
action = QAction(self.tr(name), self.btnSnippets)
action.triggered[()].connect(lambda snippet=snippet: self.editor.insert(snippet))
popupmenu.addAction(action)
Expand All @@ -163,9 +163,9 @@ def closeEvent(self, evt):
def editHelp(self):
if self.alg is None:
if self.algType == self.SCRIPT_PYTHON:
alg = ScriptAlgorithm(None, unicode(self.editor.text()))
alg = ScriptAlgorithm(None, self.editor.text())
elif self.algType == self.SCRIPT_R:
alg = RAlgorithm(None, unicode(self.editor.text()))
alg = RAlgorithm(None, self.editor.text())
else:
alg = self.alg

Expand Down Expand Up @@ -221,7 +221,7 @@ def saveScript(self, saveAs):
scriptDir = RUtils.RScriptsFolders()[0]
filterName = self.tr('Processing R script (*.rsx)')

self.filename = unicode(QFileDialog.getSaveFileName(self,
self.filename = str(QFileDialog.getSaveFileName(self,
self.tr('Save script'), scriptDir,
filterName))

Expand All @@ -233,7 +233,7 @@ def saveScript(self, saveAs):
not self.filename.lower().endswith('.rsx'):
self.filename += '.rsx'

text = unicode(self.editor.text())
text = self.editor.text()
if self.alg is not None:
self.alg.script = text
try:
Expand All @@ -242,7 +242,7 @@ def saveScript(self, saveAs):
except IOError:
QMessageBox.warning(self, self.tr('I/O error'),
self.tr('Unable to save edits. Reason:\n %s')
% unicode(sys.exc_info()[1])
% str(sys.exc_info()[1])
)
return
self.update = True
Expand All @@ -263,10 +263,10 @@ def setHasChanged(self, hasChanged):

def runAlgorithm(self):
if self.algType == self.SCRIPT_PYTHON:
alg = ScriptAlgorithm(None, unicode(self.editor.text()))
alg = ScriptAlgorithm(None, self.editor.text())
alg.provider = algList.getProviderFromName('script')
if self.algType == self.SCRIPT_R:
alg = RAlgorithm(None, unicode(self.editor.text()))
alg = RAlgorithm(None, self.editor.text())
alg.provider = algList.getProviderFromName('r')

dlg = alg.getCustomParametersDialog()
Expand Down

0 comments on commit 76d17ca

Please sign in to comment.