Skip to content

Commit

Permalink
Merge pull request #3796 from nirvn/processing_modeler_msgbar
Browse files Browse the repository at this point in the history
[processing] switch a couple of modeler pop up dialogs to message bars
  • Loading branch information
volaya committed Nov 23, 2016
2 parents d559d7f + 6e2288d commit 0a0de80
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/plugins/processing/modeler/ModelerDialog.py
Expand Up @@ -65,7 +65,7 @@ def __init__(self, alg=None):

self.bar = QgsMessageBar()
self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
self.centralWidget().layout().insertWidget(1, self.bar)
self.centralWidget().layout().insertWidget(0, self.bar)

self.zoom = 1

Expand Down Expand Up @@ -189,9 +189,9 @@ def _mimeDataAlgorithm(items):
if hasattr(self.searchBox, 'setPlaceholderText'):
self.searchBox.setPlaceholderText(self.tr('Search...'))
if hasattr(self.textName, 'setPlaceholderText'):
self.textName.setPlaceholderText(self.tr('[Enter model name here]'))
self.textName.setPlaceholderText(self.tr('Enter model name here'))
if hasattr(self.textGroup, 'setPlaceholderText'):
self.textGroup.setPlaceholderText(self.tr('[Enter group name here]'))
self.textGroup.setPlaceholderText(self.tr('Enter group name here'))

# Connect signals and slots
self.inputsTree.doubleClicked.connect(self.addInput)
Expand Down Expand Up @@ -262,9 +262,7 @@ def editHelp(self):

def runModel(self):
if len(self.alg.algs) == 0:
QMessageBox.warning(self, self.tr('Empty model'),
self.tr("Model doesn't contains any algorithms and/or "
"parameters and can't be executed"))
self.bar.pushMessage("", "Model doesn't contain any algorithm and/or parameter and can't be executed", level=QgsMessageBar.WARNING, duration=5)
return

if self.alg.provider is None:
Expand Down Expand Up @@ -306,6 +304,8 @@ def exportAsImage(self):

img.save(filename)

self.bar.pushMessage("", "Model was correctly exported as image", level=QgsMessageBar.SUCCESS, duration=5)

def exportAsPython(self):
filename, filter = QFileDialog.getSaveFileName(self,
self.tr('Save Model As Python Script'), '',
Expand All @@ -319,8 +319,8 @@ def exportAsPython(self):
text = self.alg.toPython()
with codecs.open(filename, 'w', encoding='utf-8') as fout:
fout.write(text)
QMessageBox.information(self, self.tr('Model exported'),
self.tr('Model was correctly exported.'))

self.bar.pushMessage("", "Model was correctly exported as python script", level=QgsMessageBar.SUCCESS, duration=5)

def saveModel(self, saveAs):
if str(self.textGroup.text()).strip() == '' \
Expand Down

0 comments on commit 0a0de80

Please sign in to comment.