PANOimagen / profiletool

Home to the QGis Profiletool plugin. Initial work on this fork was partially funded by the C.A. La Rioja
https://plugins.qgis.org/plugins/profiletool/
GNU General Public License v2.0
33 stars 19 forks source link

small fix to solve - 'unexpected type 'numpy.float64' - on setValue. #72

Closed luca-penasa closed 2 years ago

luca-penasa commented 2 years ago

It would be probably better to upgrade the whole pyqtgraph to the latest versions, but of course more dangerous. On my system (linux, python 3.10, qgis 3.22.3) profile tool was failing on button click with the error:

TypeError: setValue(self, int): argument 1 has unexpected type 'numpy.float64' 
Traceback (most recent call last):
  File "/home/luca/.local/share/QGIS/QGIS3/profiles/default/python/plugins/profiletool/profileplugin.py", line 88, in run
    self.profiletool = ProfileToolCore(self.iface, self)
  File "/home/luca/.local/share/QGIS/QGIS3/profiles/default/python/plugins/profiletool/tools/profiletool_core.py", line 99, in __init__
    self.dockwidget.changePlotLibrary(self.dockwidget.cboLibrary.currentIndex())
  File "/home/luca/.local/share/QGIS/QGIS3/profiles/default/python/plugins/profiletool/ui/ptdockwidget.py", line 143, in changePlotLibrary
    self.addPlotWidget(self.plotlibrary)
  File "/home/luca/.local/share/QGIS/QGIS3/profiles/default/python/plugins/profiletool/ui/ptdockwidget.py", line 177, in addPlotWidget
    self.plotWdg = PlottingTool().changePlotWidget("PyQtGraph", self.frame_for_plot)
  File "/home/luca/.local/share/QGIS/QGIS3/profiles/default/python/plugins/profiletool/tools/plottingtool.py", line 96, in changePlotWidget
    plotWdg.showGrid(True, True, 0.5)
  File "/home/luca/.local/share/QGIS/QGIS3/profiles/default/python/plugins/profiletool/pyqtgraph/graphicsItems/PlotItem/PlotItem.py", line 382, in showGrid
    self.ctrl.gridAlphaSlider.setValue(v)
TypeError: setValue(self, int): argument 1 has unexpected type 'numpy.float64'

By checking pyqtgraph repo seems like they also adopted this change: https://github.com/pyqtgraph/pyqtgraph/blob/8279a0adb8954a21d5285e0a579d8101e01a6e45/pyqtgraph/graphicsItems/PlotItem/PlotItem.py#L382

thank you for maintaining profile tool. best, luca

nicogodet commented 2 years ago

Thanks ! I could probably update pyqtgraph when the next LTR is released

nicogodet commented 2 years ago

Released ;)