From c19a4a70bd086f0e84c642b37704ea8801fecda6 Mon Sep 17 00:00:00 2001 From: "arnaud.morvan@camptocamp.com" Date: Thu, 21 May 2015 17:29:02 +0200 Subject: [PATCH] Fix processing model help saving and make script help content saving consistent with models behavior --- .../plugins/processing/gui/HelpEditionDialog.py | 15 --------------- .../plugins/processing/gui/ScriptEditorDialog.py | 6 ++---- .../plugins/processing/modeler/ModelerDialog.py | 1 + 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/python/plugins/processing/gui/HelpEditionDialog.py b/python/plugins/processing/gui/HelpEditionDialog.py index 87b18e2c5e6..5e1620bce0b 100644 --- a/python/plugins/processing/gui/HelpEditionDialog.py +++ b/python/plugins/processing/gui/HelpEditionDialog.py @@ -80,21 +80,6 @@ class HelpEditionDialog(BASE, WIDGET): def accept(self): self.descriptions[self.currentName] = unicode(self.text.toPlainText()) - if isinstance(self.alg, ModelerAlgorithm): - self.alg.helpContent = self.descriptions - else: - if self.alg.descriptionFile is not None: - try: - with open(self.alg.descriptionFile + '.help', 'w') as f: - json.dump(self.descriptions, f) - except Exception, e: - QMessageBox.warning(self, self.tr('Error saving help file'), - self.tr('Help file could not be saved.\n' - 'Check that you have permission to modify the help\n' - 'file. You might not have permission if you are \n' - 'editing an example model or script, since they \n' - 'are stored on the installation folder')) - QDialog.accept(self) def getHtml(self): diff --git a/python/plugins/processing/gui/ScriptEditorDialog.py b/python/plugins/processing/gui/ScriptEditorDialog.py index 9070069ae61..b75b07e837b 100644 --- a/python/plugins/processing/gui/ScriptEditorDialog.py +++ b/python/plugins/processing/gui/ScriptEditorDialog.py @@ -168,11 +168,9 @@ class ScriptEditorDialog(BASE, WIDGET): dlg = HelpEditionDialog(alg) dlg.exec_() - - # We store the description string in case there were not saved - # because there was no filename defined yet - if self.alg is None and dlg.descriptions: + if dlg.descriptions: self.help = dlg.descriptions + self.setHasChanged(True) def openScript(self): if self.hasChanged: diff --git a/python/plugins/processing/modeler/ModelerDialog.py b/python/plugins/processing/modeler/ModelerDialog.py index 30b3dd63de5..521bb03298e 100644 --- a/python/plugins/processing/modeler/ModelerDialog.py +++ b/python/plugins/processing/modeler/ModelerDialog.py @@ -226,6 +226,7 @@ class ModelerDialog(BASE, WIDGET): dlg = HelpEditionDialog(alg) dlg.exec_() if dlg.descriptions: + self.alg.helpContent = dlg.descriptions self.hasChanged = True def runModel(self):