Skip to content
Permalink
Browse files

[processing] Modeller should not be modal

  • Loading branch information
nyalldawson committed Oct 31, 2016
1 parent 07b25af commit dd4b34ed16e0611b2e317788ed9364ef63b9d80f
@@ -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()
@@ -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')
@@ -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')
@@ -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
@@ -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)
@@ -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

@@ -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

0 comments on commit dd4b34e

Please sign in to comment.
You can’t perform that action at this time.