bstroebl / DigitizingTools

A QGIS plugin, that subsumes different tools useful during digitizing sessions
GNU General Public License v2.0
22 stars 9 forks source link

Couldn't load plugin 'DigitizingTools' #60

Closed antoniusz closed 1 year ago

antoniusz commented 1 year ago

I've got this error when starting QGIS 3.29-Master

Couldn't load plugin 'DigitizingTools' due to an error when calling its initGui() method

TypeError: QgsRubberBand(): argument 2 has unexpected type 'bool' Traceback (most recent call last): File "/home/toni/.qgis_apps_330/share/qgis/python/qgis/utils.py", line 448, in startPlugin plugins[packageName].initGui() File "/home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/DigitizingTools/digitizingtools.py", line 104, in initGui self.moveSideByDistance = dtmovesidebydistance.DtMoveSideByDistance(self.iface, self.toolBar) File "/home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/DigitizingTools/tools/dtmovesidebydistance.py", line 42, in init self.rb1 = QgsRubberBand(self.canvas, False) TypeError: QgsRubberBand(): argument 2 has unexpected type 'bool'

Python version: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] QGIS version: 3.29.0-Master Master, ccf1835b6c

Python Path: /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/lftools /home/toni/.qgis_apps_330/share/qgis/python /home/toni/.local/share/QGIS/QGIS3/profiles/default/python /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins /home/toni/.qgis_apps_330/share/qgis/python/plugins /usr/lib/python39.zip /usr/lib/python3.9 /usr/lib/python3.9/lib-dynload /home/toni/.local/lib/python3.9/site-packages /usr/local/lib/python3.9/dist-packages /usr/lib/python3/dist-packages /usr/lib/python3.9/dist-packages /home/toni/.local/share/QGIS/QGIS3/profiles/default/python /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ee_plugin/extlibs_linux /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/kmltools/libs /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis_resource_sharing /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis_resource_sharing/ext_libs /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/go2streetview /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/go2streetview/res . /home/toni/.local/share/QGIS/QGIS3/profiles/default/python/plugins/DigitizingTools/tools

bstroebl commented 1 year ago

Hmm, seems to have been in there for ages; parameter has been deprecated in QGIS 2. I wonder why it did not pop up earlier. I can load it in 3.22 though. Could you please try with an earlier Version e.g. 3.28?

antoniusz commented 1 year ago

3.28.3 it is ok

bstroebl commented 1 year ago

I would have guessed. Fact is: this is clearly a bug as it uses 2.* api although in 3.28 and before you should only get a runtime error. I have no idea why you get a load error in 3.29. Anyway, will fix but may take some time.

enzococca commented 1 year ago

I have had the same problem in QGIS 3.30. I solved changed self.rb1 = QgsRubberBand(self.canvas, False) to self.rb1 = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) in files dtmovesidebydistance.py, dttools, dtmovesidebyarea

agiudiceandrea commented 1 year ago

@enzococca since the signature of the deprecated function is QgsRubberBand::QgsRubberBand(QgsMapCanvas * mapCanvas, bool isPolygon ) and the second parameter is False, then I think the intended behaviour was to not use a polygon but a linestring, so it should be substituted with QgsRubberBand(self.canvas, QgsWkbTypes.LineGeometry).

Houska1 commented 1 year ago

Just noting that in order to load in 3.30, I've had to make @agiudiceandrea's fix not only in line 42, /tools/dtmovesidebydistance.py but also line 42, /tools/dtmovesidebyarea.py and line 1004, /tools/dttools.py

(I haven't checked if plugin functionality has been affected, this is just to be able to open up QGIS 3.30 with this plugin installed without load errors.)

AmrutaHi commented 1 year ago

Hey enzococca, can you update the latest files for digitizing tools!! for 3.30 version