Thank you, Arnaud!
you confirm my last choice.
It works perfectly!
enrico
Il 27/03/2017 09:28, Arnaud Morvan ha scritto:
Hello Enrico,
Do not change the common dialog closeEvent Method, you should subclass it.
class MyCustomDialog(AlgorithmDialog):
...
You can give a custom dialog to you algorithm using
GeoAlgorithm.getCustomParametersDialog method.
class MyAlgorithm(GeoAlgorithm):
...
def getCustomParametersDialog(self):
return MyCustomDialog()
Do not forget to call the base AlgorithmDialog.closeEvent method in
yours :
class MyCustomDialog(AlgorithmDialog):
def closeEvent(self):
super(MyCustomDialog, self).closeEvent()
This is the way to execute custom tasks in the closeEvent, I do not
say that this the better way for your job.
Cheers
Arnaud Morvan
Ingénieur logiciel
Tél: +33 (0)4 58 48 20 32
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com
Le 23/03/2017 à 18:14, enrico chiaradia a écrit :
Dear (processing) developers,
for my plugin (IO Geopaparazzi), I need to stop the execution of an
external thread when the user presses the X button of the form.
I though to overload the closeEvent in this way:
from processing.gui.AlgorithmDialog import AlgorithmDialog
[omitted]
class ExportTilesAlgorithm(GeoAlgorithm):
[omitted]
# get the AlgorithmDialog dialog object and overload the closeEvent
AlgorithmDialog.closeEvent = self.closeEvent
[omitted]
def closeEvent(self, evt):
# necessary to close the thread before it is finished
self.workThread.stop()
it works perfectly but I'm not sure that it will not induce anomalous
behaviours in other geoalgorithms as the original function is (from
AlgorithmDialog.py) :
def closeEvent(self, evt):
QgsMapLayerRegistry.instance().layerWasAdded.disconnect(self.mainWidget.layerAdded)
QgsMapLayerRegistry.instance().layersWillBeRemoved.disconnect(self.mainWidget.layersWillBeRemoved)
super(AlgorithmDialog, self).closeEvent(evt)
Any suggestions?
Thank you
enrico
_______________________________________________
Qgis-developer mailing list
[email protected]
List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
Qgis-developer mailing list
[email protected]
List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
Qgis-developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer