Showing with 22 additions and 10 deletions.
  1. +9 −1 python/plugins/sextante/core/GeoAlgorithm.py
  2. +11 −7 python/plugins/sextante/gui/AlgorithmExecutionDialog.py
  3. +2 −2 python/plugins/sextante/gui/SextanteToolbox.py
10 changes: 9 additions & 1 deletion python/plugins/sextante/core/GeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def getVisibleOutputsCount(self):
if not out.hidden:
i+=1
return i;

def getVisibleParametersCount(self):
'''returns the number of non-hidden parameters'''
i = 0;
Expand All @@ -328,6 +328,14 @@ def getVisibleParametersCount(self):
i+=1
return i;

def getHTMLOutputsCount(self):
'''returns the number of HTML outputs'''
i = 0;
for out in self.outputs:
if isinstance(out, OutputHTML):
i+=1
return i;

def getOutputValuesAsDictionary(self):
d = {}
for out in self.outputs:
Expand Down
18 changes: 11 additions & 7 deletions python/plugins/sextante/gui/AlgorithmExecutionDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def __init__(self, alg, mainWidget):
self.logText.readOnly = True
useThreads = SextanteConfig.getSetting(SextanteConfig.USE_THREADS)
keepOpen = SextanteConfig.getSetting(SextanteConfig.KEEP_DIALOG_OPEN)
if useThreads or keepOpen:
self.tabWidget.addTab(self.logText, "Log")
#if useThreads or keepOpen:
self.tabWidget.addTab(self.logText, "Log")
self.webView = QtWebKit.QWebView()
cssUrl = QtCore.QUrl(os.path.join(os.path.dirname(__file__), "help", "help.css"))
self.webView.settings().setUserStyleSheetUrl(cssUrl)
Expand Down Expand Up @@ -216,11 +216,13 @@ def accept(self):
return
msg = self.alg.checkParameterValuesBeforeExecuting()
if msg:
if keepOpen or useThread:
self.setInfo("Unable to execute algorithm: %s" % msg, True)
self.tabWidget.setCurrentIndex(1) # log tab
else:
QMessageBox.critical(self, "Unable to execute algorithm", msg)
#===============================================================
# if keepOpen or useThread:
# self.setInfo("Unable to execute algorithm: %s" % msg, True)
# self.tabWidget.setCurrentIndex(1) # log tab
# else:
#===============================================================
QMessageBox.critical(self, "Unable to execute algorithm", msg)
return
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
self.buttonBox.button(QtGui.QDialogButtonBox.Close).setEnabled(False)
Expand Down Expand Up @@ -303,6 +305,8 @@ def finish(self):
self.close()
else:
self.resetGUI()
if self.alg.getHTMLOutputsCount() > 0:
self.setInfo("HTML output has been generated by this algorithm.\nOpen the SEXTANTE results dialog to check it.")

@pyqtSlot(str)
def error(self, msg):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/gui/SextanteToolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ def fillTree(self):
def addRecentAlgorithms(self):
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
if showRecent:
first = self.algorithmTree.topLevelItem(0)
if first.text(0) == "Recently used algorithms":
first = self.algorithmTree.topLevelItem(0)
if first != None and first.text(0) == "Recently used algorithms":
self.algorithmTree.removeItemWidget(first, 0)
recent = SextanteLog.getRecentAlgorithms()
if len(recent) != 0:
Expand Down