<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-15">
</head>
<body bgcolor="#FFFFFF" text="#006600">
<p>Dear (processing) developers,</p>
<p>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.</p>
<p>I though to overload the closeEvent in this way:</p>
<p>from processing.gui.AlgorithmDialog import AlgorithmDialog<br>
</p>
<p>[omitted]</p>
<p>class ExportTilesAlgorithm(GeoAlgorithm):</p>
<p> [omitted]</p>
<p> # get the AlgorithmDialog dialog object and overload the
closeEvent<br>
AlgorithmDialog.closeEvent = self.closeEvent<br>
</p>
<p> [omitted]<br>
</p>
def closeEvent(self, evt):<br>
# necessary to close the thread before it is finished<br>
self.workThread.stop()
<p>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) :</p>
<p>def closeEvent(self, evt):<br>
QgsMapLayerRegistry.instance().layerWasAdded.disconnect(self.mainWidget.layerAdded)<br>
QgsMapLayerRegistry.instance().layersWillBeRemoved.disconnect(self.mainWidget.layersWillBeRemoved)<br>
super(AlgorithmDialog, self).closeEvent(evt)<br>
</p>
<p>Any suggestions?</p>
<p>Thank you</p>
<p>enrico<br>
</p>
</body>
</html>