Skip to content

Commit

Permalink
[processing] Modeller should not be modal
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 31, 2016
1 parent 07b25af commit dd4b34e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
8 changes: 5 additions & 3 deletions python/plugins/processing/ProcessingPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ def openToolbox(self):

def openModeler(self):
dlg = ModelerDialog()
dlg.exec_()
if dlg.update:
algList.reloadProvider('model')
dlg.update_model.connect(self.updateModel)
dlg.show()

def updateModel(self):
algList.reloadProvider('model')

def openResults(self):
dlg = ResultsDialog()
Expand Down
8 changes: 5 additions & 3 deletions python/plugins/processing/modeler/CreateNewModelAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def getIcon(self):

def execute(self):
dlg = ModelerDialog()
dlg.exec_()
if dlg.update:
algList.reloadProvider('model')
dlg.update_model.connect(self.updateModel)
dlg.show()

def updateModel(self):
algList.reloadProvider('model')
8 changes: 5 additions & 3 deletions python/plugins/processing/modeler/EditModelAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def isEnabled(self):

def execute(self):
dlg = ModelerDialog(self.itemData.getCopy())
dlg.exec_()
if dlg.update:
algList.reloadProvider('model')
dlg.update_model.connect(self.updateModel)
dlg.show()

def updateModel(self):
algList.reloadProvider('model')
9 changes: 4 additions & 5 deletions python/plugins/processing/modeler/ModelerDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import os

from qgis.PyQt import uic
from qgis.PyQt.QtCore import Qt, QRectF, QMimeData, QPoint, QPointF, QSettings, QByteArray
from qgis.PyQt.QtCore import Qt, QRectF, QMimeData, QPoint, QPointF, QSettings, QByteArray, pyqtSignal
from qgis.PyQt.QtWidgets import QGraphicsView, QTreeWidget, QMessageBox, QFileDialog, QTreeWidgetItem, QSizePolicy
from qgis.PyQt.QtGui import QIcon, QImage, QPainter
from qgis.core import QgsApplication
Expand All @@ -57,6 +57,8 @@ class ModelerDialog(BASE, WIDGET):

CANVAS_SIZE = 4000

update_model = pyqtSignal()

def __init__(self, alg=None):
super(ModelerDialog, self).__init__(None)
self.setupUi(self)
Expand Down Expand Up @@ -205,9 +207,6 @@ def _mimeDataAlgorithm(items):
self.view.centerOn(0, 0)
self.alg.setModelerView(self)
self.help = None
# Indicates whether to update or not the toolbox after
# closing this dialog
self.update = False

self.hasChanged = False

Expand Down Expand Up @@ -339,7 +338,7 @@ def saveModel(self, saveAs):
return
fout.write(text)
fout.close()
self.update = True
self.update_model.emit()
self.bar.pushMessage("", "Model was correctly saved", level=QgsMessageBar.SUCCESS, duration=5)

self.hasChanged = False
Expand Down

0 comments on commit dd4b34e

Please sign in to comment.