Skip to content

Commit 76d17ca

Browse files
committedOct 18, 2016
update ScriptEditorDialog for py3
1 parent 7f3b10b commit 76d17ca

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
 

‎python/plugins/processing/gui/ScriptEditorDialog.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def __init__(self, algType, alg):
141141

142142
def showSnippets(self, evt):
143143
popupmenu = QMenu()
144-
for name, snippet in self.snippets.iteritems():
144+
for name, snippet in list(self.snippets.items()):
145145
action = QAction(self.tr(name), self.btnSnippets)
146146
action.triggered[()].connect(lambda snippet=snippet: self.editor.insert(snippet))
147147
popupmenu.addAction(action)
@@ -163,9 +163,9 @@ def closeEvent(self, evt):
163163
def editHelp(self):
164164
if self.alg is None:
165165
if self.algType == self.SCRIPT_PYTHON:
166-
alg = ScriptAlgorithm(None, unicode(self.editor.text()))
166+
alg = ScriptAlgorithm(None, self.editor.text())
167167
elif self.algType == self.SCRIPT_R:
168-
alg = RAlgorithm(None, unicode(self.editor.text()))
168+
alg = RAlgorithm(None, self.editor.text())
169169
else:
170170
alg = self.alg
171171

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

224-
self.filename = unicode(QFileDialog.getSaveFileName(self,
224+
self.filename = str(QFileDialog.getSaveFileName(self,
225225
self.tr('Save script'), scriptDir,
226226
filterName))
227227

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

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

264264
def runAlgorithm(self):
265265
if self.algType == self.SCRIPT_PYTHON:
266-
alg = ScriptAlgorithm(None, unicode(self.editor.text()))
266+
alg = ScriptAlgorithm(None, self.editor.text())
267267
alg.provider = algList.getProviderFromName('script')
268268
if self.algType == self.SCRIPT_R:
269-
alg = RAlgorithm(None, unicode(self.editor.text()))
269+
alg = RAlgorithm(None, self.editor.text())
270270
alg.provider = algList.getProviderFromName('r')
271271

272272
dlg = alg.getCustomParametersDialog()

0 commit comments

Comments
 (0)
Please sign in to comment.