mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
update ScriptEditorDialog for py3
This commit is contained in:
parent
7f3b10b424
commit
76d17ca55b
@ -141,7 +141,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
|
||||
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)
|
||||
@ -163,9 +163,9 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
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
|
||||
|
||||
@ -221,7 +221,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
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))
|
||||
|
||||
@ -233,7 +233,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
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:
|
||||
@ -242,7 +242,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
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
|
||||
@ -263,10 +263,10 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user