mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04: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):
|
def showSnippets(self, evt):
|
||||||
popupmenu = QMenu()
|
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 = QAction(self.tr(name), self.btnSnippets)
|
||||||
action.triggered[()].connect(lambda snippet=snippet: self.editor.insert(snippet))
|
action.triggered[()].connect(lambda snippet=snippet: self.editor.insert(snippet))
|
||||||
popupmenu.addAction(action)
|
popupmenu.addAction(action)
|
||||||
@ -163,9 +163,9 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
def editHelp(self):
|
def editHelp(self):
|
||||||
if self.alg is None:
|
if self.alg is None:
|
||||||
if self.algType == self.SCRIPT_PYTHON:
|
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:
|
elif self.algType == self.SCRIPT_R:
|
||||||
alg = RAlgorithm(None, unicode(self.editor.text()))
|
alg = RAlgorithm(None, self.editor.text())
|
||||||
else:
|
else:
|
||||||
alg = self.alg
|
alg = self.alg
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
scriptDir = RUtils.RScriptsFolders()[0]
|
scriptDir = RUtils.RScriptsFolders()[0]
|
||||||
filterName = self.tr('Processing R script (*.rsx)')
|
filterName = self.tr('Processing R script (*.rsx)')
|
||||||
|
|
||||||
self.filename = unicode(QFileDialog.getSaveFileName(self,
|
self.filename = str(QFileDialog.getSaveFileName(self,
|
||||||
self.tr('Save script'), scriptDir,
|
self.tr('Save script'), scriptDir,
|
||||||
filterName))
|
filterName))
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
not self.filename.lower().endswith('.rsx'):
|
not self.filename.lower().endswith('.rsx'):
|
||||||
self.filename += '.rsx'
|
self.filename += '.rsx'
|
||||||
|
|
||||||
text = unicode(self.editor.text())
|
text = self.editor.text()
|
||||||
if self.alg is not None:
|
if self.alg is not None:
|
||||||
self.alg.script = text
|
self.alg.script = text
|
||||||
try:
|
try:
|
||||||
@ -242,7 +242,7 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
except IOError:
|
except IOError:
|
||||||
QMessageBox.warning(self, self.tr('I/O error'),
|
QMessageBox.warning(self, self.tr('I/O error'),
|
||||||
self.tr('Unable to save edits. Reason:\n %s')
|
self.tr('Unable to save edits. Reason:\n %s')
|
||||||
% unicode(sys.exc_info()[1])
|
% str(sys.exc_info()[1])
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
self.update = True
|
self.update = True
|
||||||
@ -263,10 +263,10 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
|
|
||||||
def runAlgorithm(self):
|
def runAlgorithm(self):
|
||||||
if self.algType == self.SCRIPT_PYTHON:
|
if self.algType == self.SCRIPT_PYTHON:
|
||||||
alg = ScriptAlgorithm(None, unicode(self.editor.text()))
|
alg = ScriptAlgorithm(None, self.editor.text())
|
||||||
alg.provider = algList.getProviderFromName('script')
|
alg.provider = algList.getProviderFromName('script')
|
||||||
if self.algType == self.SCRIPT_R:
|
if self.algType == self.SCRIPT_R:
|
||||||
alg = RAlgorithm(None, unicode(self.editor.text()))
|
alg = RAlgorithm(None, self.editor.text())
|
||||||
alg.provider = algList.getProviderFromName('r')
|
alg.provider = algList.getProviderFromName('r')
|
||||||
|
|
||||||
dlg = alg.getCustomParametersDialog()
|
dlg = alg.getCustomParametersDialog()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user