Skip to content

Commit

Permalink
Fix loading of the plugin without pandas installed (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Jul 4, 2023
1 parent b6b0fe7 commit e14209b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Fix loading of the plugin when the Pandas library is not found, contribution from @Gustry

## 4.0.3 - 2023-06-27

- fix bug with old projects (second part) thanks to @jdlom
Expand Down
16 changes: 13 additions & 3 deletions DataPlotly/processing/dataplotly_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@
* *
***************************************************************************/
"""
from qgis.core import QgsProcessingProvider
from qgis.core import Qgis, QgsMessageLog, QgsProcessingProvider
from DataPlotly.gui.gui_utils import GuiUtils
from DataPlotly.processing.dataplotly_scatterplot import DataPlotlyProcessingScatterPlot

try:
# 🐼
from DataPlotly.processing.dataplotly_scatterplot import DataPlotlyProcessingScatterPlot
WITH_PANDAS = True
except ImportError:
WITH_PANDAS = False
QgsMessageLog.logMessage(
"Pandas has not been found. The processing algorithm will not be loaded. "
"Please install qgis-full or qgis standalone", "DataPlotly", Qgis.Warning)


class DataPlotlyProvider(QgsProcessingProvider):
Expand Down Expand Up @@ -76,4 +85,5 @@ def loadAlgorithms(self):
even if the list does not change, since the self.algs list is
cleared before calling this method.
"""
self.addAlgorithm(DataPlotlyProcessingScatterPlot())
if WITH_PANDAS:
self.addAlgorithm(DataPlotlyProcessingScatterPlot())

0 comments on commit e14209b

Please sign in to comment.