diff --git a/DataPlotly/core/plot_factory.py b/DataPlotly/core/plot_factory.py index f88e3bcf..029173ab 100644 --- a/DataPlotly/core/plot_factory.py +++ b/DataPlotly/core/plot_factory.py @@ -40,7 +40,7 @@ from DataPlotly.core.plot_types import * # pylint: disable=W0401,W0614 -class FilterRegion(QgsReferencedGeometryBase): +class FilterRegion(QgsReferencedGeometryBase): # pylint: disable=too-few-public-methods """ Filter region, consisting of a geometry with CRS """ diff --git a/DataPlotly/gui/layout_item_gui.py b/DataPlotly/gui/layout_item_gui.py index 48453f97..51dc3a80 100644 --- a/DataPlotly/gui/layout_item_gui.py +++ b/DataPlotly/gui/layout_item_gui.py @@ -111,11 +111,11 @@ def filter_by_atlas_toggled(self, value): self.plot_item.filter_by_atlas = bool(value) self.plot_item.update() - def linked_map_changed(self, map): + def linked_map_changed(self, linked_map): """ Triggered when the linked map is changed """ - self.plot_item.set_linked_map(map) + self.plot_item.set_linked_map(linked_map) self.plot_item.update() def setNewItem(self, item): # pylint: disable=missing-docstring diff --git a/DataPlotly/layouts/plot_layout_item.py b/DataPlotly/layouts/plot_layout_item.py index d279d137..db0e3667 100644 --- a/DataPlotly/layouts/plot_layout_item.py +++ b/DataPlotly/layouts/plot_layout_item.py @@ -143,7 +143,7 @@ def create_plot(self): polygon_filter = FilterRegion(QgsGeometry.fromQPolygonF(self.linked_map.visibleExtentPolygon()), self.linked_map.crs()) self.plot_settings.properties['visible_features_only'] = True - elif self.filter_by_atlas and self.layout().reportContext().feature().isValid(): + elif self.filter_by_atlas and self.layout().reportContext().layer() and self.layout().reportContext().feature().isValid(): polygon_filter = FilterRegion(self.layout().reportContext().currentGeometry(), self.layout().reportContext().layer().crs()) self.plot_settings.properties['visible_features_only'] = True else: diff --git a/DataPlotly/test/test_plot_settings.py b/DataPlotly/test/test_plot_settings.py index 89f84baa..5c819b66 100644 --- a/DataPlotly/test/test_plot_settings.py +++ b/DataPlotly/test/test_plot_settings.py @@ -214,6 +214,7 @@ def test_read_write_file(self): self.assertEqual(res.data_defined_properties.property(PlotSettings.PROPERTY_STROKE_WIDTH), original.data_defined_properties.property(PlotSettings.PROPERTY_STROKE_WIDTH)) + if __name__ == "__main__": suite = unittest.makeSuite(DataPlotlySettings) runner = unittest.TextTestRunner(verbosity=2)