Deltares / imod-qgis

🗺️🧭 QGIS plugin for iMOD
GNU General Public License v2.0
7 stars 1 forks source link

Timeseries widget: Test if layerChanged is connected before trying to disconnect #63

Closed JoerivanEngelen closed 10 months ago

JoerivanEngelen commented 10 months ago

Fixes #54 , there is a bug where for vector data the plugin attempted to disconnect the layerChanged signal, but threw an error because nothing was connect to this signal.

To reproduce this issue:

In my experience, the signalspy is the easiest way to track whether things are connected to a signal or not.

JoerivanEngelen commented 10 months ago

UPDATE:

Signalspy only records signals after being initiated, so my first implementation in this branch doesn't work (it expected that all signals connected were traced back, but this is wrong). I also found that it is possible to connect the same method 5 times to a signal, after which the disconnect method also has to be called 5 times to fully disconnect.

So I resorted to looping over the amount of receivers and try / excepting disconnecting the method. I also made sure the method is reconnected again during the showEvent.