Skip to content

Commit 6e2288d

Browse files
committed
[processing] switch a couple of modeler pop up dialogs to message bars
1 parent d559d7f commit 6e2288d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

python/plugins/processing/modeler/ModelerDialog.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, alg=None):
6565

6666
self.bar = QgsMessageBar()
6767
self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
68-
self.centralWidget().layout().insertWidget(1, self.bar)
68+
self.centralWidget().layout().insertWidget(0, self.bar)
6969

7070
self.zoom = 1
7171

@@ -189,9 +189,9 @@ def _mimeDataAlgorithm(items):
189189
if hasattr(self.searchBox, 'setPlaceholderText'):
190190
self.searchBox.setPlaceholderText(self.tr('Search...'))
191191
if hasattr(self.textName, 'setPlaceholderText'):
192-
self.textName.setPlaceholderText(self.tr('[Enter model name here]'))
192+
self.textName.setPlaceholderText(self.tr('Enter model name here'))
193193
if hasattr(self.textGroup, 'setPlaceholderText'):
194-
self.textGroup.setPlaceholderText(self.tr('[Enter group name here]'))
194+
self.textGroup.setPlaceholderText(self.tr('Enter group name here'))
195195

196196
# Connect signals and slots
197197
self.inputsTree.doubleClicked.connect(self.addInput)
@@ -262,9 +262,7 @@ def editHelp(self):
262262

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

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

307305
img.save(filename)
308306

307+
self.bar.pushMessage("", "Model was correctly exported as image", level=QgsMessageBar.SUCCESS, duration=5)
308+
309309
def exportAsPython(self):
310310
filename, filter = QFileDialog.getSaveFileName(self,
311311
self.tr('Save Model As Python Script'), '',
@@ -319,8 +319,8 @@ def exportAsPython(self):
319319
text = self.alg.toPython()
320320
with codecs.open(filename, 'w', encoding='utf-8') as fout:
321321
fout.write(text)
322-
QMessageBox.information(self, self.tr('Model exported'),
323-
self.tr('Model was correctly exported.'))
322+
323+
self.bar.pushMessage("", "Model was correctly exported as python script", level=QgsMessageBar.SUCCESS, duration=5)
324324

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

0 commit comments

Comments
 (0)