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

Reply via email to