qgis_layout_plugin/Notes.md

1.1 KiB

Test for a plugin that add an action in the layout

13/07/2021, Longlaville

  • created a new plugin using plugin builder
  • make a symbolic link to the plugin folder
cd ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins
ln -s /mnt/tera/ChampsLibres/Projets/FormationQGIS/pyQGIS/plugin_layout/plot_layout
  • try to add a button in layout by copying the data plotly plugin

    • copier à peu près le dossier gui de DataPlotly:

      • gui/gui.py: PlotLayoutItemGuiMetadata, PlotLayoutItemWidget
      • gui/gui_utils.py: GuiUtils
      • gui/plot_settings_widget.py: DataPlotlyPanelWidget,
    • copier à peu près le dossier Layout:

      • layout/layout.py: PlotLayoutItemMetadata, PlotLayoutItem qui est un QgsLayoutItem: c'est le composant graphique dans un layout.
    • ajouter dans PlotInLayout::init :

        self.plot_item_metadata = PlotLayoutItemMetadata()
        self.plot_item_gui_metadata = None
        QgsApplication.layoutItemRegistry().addLayoutItemType(self.plot_item_metadata)
      
    • ajouter dans PlotInLayout::initGui: