|
@@ -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) |
|
@@ -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 |
|
|
|
|
@@ -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)) |
|
|
|
|
@@ -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: |
|
@@ -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 |
|
@@ -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() |
|
|