mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Cleanup model algorithm parameter definition dialog
This commit is contained in:
parent
88c8c71422
commit
4a974eab18
14
python/plugins/processing/modeler/ModelerDialog.py
Normal file → Executable file
14
python/plugins/processing/modeler/ModelerDialog.py
Normal file → Executable file
@ -588,17 +588,17 @@ class ModelerDialog(BASE, WIDGET):
|
||||
pass
|
||||
if not dlg:
|
||||
dlg = ModelerParametersDialog(alg, self.model)
|
||||
dlg.exec_()
|
||||
if dlg.alg is not None:
|
||||
if dlg.exec_():
|
||||
alg = dlg.createAlgorithm()
|
||||
if pos is None:
|
||||
dlg.alg.setPosition(self.getPositionForAlgorithmItem())
|
||||
alg.setPosition(self.getPositionForAlgorithmItem())
|
||||
else:
|
||||
dlg.alg.setPosition(pos)
|
||||
alg.setPosition(pos)
|
||||
from processing.modeler.ModelerGraphicItem import ModelerGraphicItem
|
||||
for i, out in enumerate(dlg.alg.modelOutputs()):
|
||||
dlg.alg.modelOutput(out).setPosition(dlg.alg.position() + QPointF(ModelerGraphicItem.BOX_WIDTH, (i + 1.5) *
|
||||
for i, out in enumerate(alg.modelOutputs()):
|
||||
alg.modelOutput(out).setPosition(alg.position() + QPointF(ModelerGraphicItem.BOX_WIDTH, (i + 1.5) *
|
||||
ModelerGraphicItem.BOX_HEIGHT))
|
||||
self.model.addChildAlgorithm(dlg.alg)
|
||||
self.model.addChildAlgorithm(alg)
|
||||
self.repaintModel()
|
||||
self.hasChanged = True
|
||||
|
||||
|
8
python/plugins/processing/modeler/ModelerGraphicItem.py
Normal file → Executable file
8
python/plugins/processing/modeler/ModelerGraphicItem.py
Normal file → Executable file
@ -210,10 +210,10 @@ class ModelerGraphicItem(QGraphicsItem):
|
||||
pass
|
||||
if not dlg:
|
||||
dlg = ModelerParametersDialog(self.element.algorithm(), self.model, self.element.childId())
|
||||
dlg.exec_()
|
||||
if dlg.alg is not None:
|
||||
dlg.alg.setChildId(self.element.childId())
|
||||
self.updateAlgorithm(dlg.alg)
|
||||
if dlg.exec_():
|
||||
alg = dlg.createAlgorithm()
|
||||
alg.setChildId(self.element.childId())
|
||||
self.updateAlgorithm(alg)
|
||||
self.scene.dialog.repaintModel()
|
||||
|
||||
def updateAlgorithm(self, alg):
|
||||
|
19
python/plugins/processing/modeler/ModelerParametersDialog.py
Normal file → Executable file
19
python/plugins/processing/modeler/ModelerParametersDialog.py
Normal file → Executable file
@ -70,8 +70,6 @@ class ModelerParametersDialog(QDialog):
|
||||
self.setModal(True)
|
||||
# The algorithm to define in this dialog. It is an instance of GeoAlgorithm
|
||||
self._alg = alg
|
||||
# The resulting algorithm after the user clicks on OK. it is an instance of the container Algorithm class
|
||||
self.alg = None
|
||||
# The model this algorithm is going to be added to
|
||||
self.model = model
|
||||
# The name of the algorithm in the model, in case we are editing it and not defining it for the first time
|
||||
@ -348,21 +346,20 @@ class ModelerParametersDialog(QDialog):
|
||||
dep_ids.append(availableDependencies[selected].childId()) # spellok
|
||||
alg.setDependencies(dep_ids)
|
||||
|
||||
try:
|
||||
self._alg.processBeforeAddingToModeler(alg, self.model)
|
||||
except:
|
||||
pass
|
||||
#try:
|
||||
# self._alg.processBeforeAddingToModeler(alg, self.model)
|
||||
#except:
|
||||
# pass
|
||||
|
||||
return alg
|
||||
|
||||
def okPressed(self):
|
||||
self.alg = self.createAlgorithm()
|
||||
if self.alg is not None:
|
||||
self.close()
|
||||
alg = self.createAlgorithm()
|
||||
if alg is not None:
|
||||
self.accept()
|
||||
|
||||
def cancelPressed(self):
|
||||
self.alg = None
|
||||
self.close()
|
||||
self.reject()
|
||||
|
||||
def openHelp(self):
|
||||
algHelp = self._alg.help()
|
||||
|
Loading…
x
Reference in New Issue
Block a user