Skip to content

Commit

Permalink
[sextante] modifed behaviour of 'log' tab in execution dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Mar 9, 2013
1 parent d83b949 commit 8ff355e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
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

0 comments on commit 8ff355e

Please sign in to comment.