def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""

        self.menu = QMenu(self.tr('&DataPlotly'))
        self.iface.pluginMenu().addMenu(self.menu)

        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar('DataPlotly')
        self.toolbar.setObjectName('DataPlotly')

        self.dock_widget = DataPlotlyDock()
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.dock_widget)
        self.dock_widget.hide()

        self.show_dock_action = QAction(GuiUtils.get_icon('dataplotly.svg'),
                                        self.tr('DataPlotly'))
        self.show_dock_action.setToolTip(self.tr('Shows the DataPlotly dock'))
        self.show_dock_action.setCheckable(True)

        self.dock_widget.setToggleVisibilityAction(self.show_dock_action)

        self.menu.addAction(self.show_dock_action)
        self.toolbar.addAction(self.show_dock_action)

        # Add processing provider
        self.initProcessing()

        # Add layout gui utils
        self.plot_item_gui_metadata = PlotLayoutItemGuiMetadata()
        QgsGui.layoutItemGuiRegistry().addLayoutItemGuiMetadata(
            self.plot_item_gui_metadata)
示例#2
0
 def get_gui_metadata_for_item_type(
         item_type: int) -> Optional[QgsLayoutItemAbstractGuiMetadata]:
     for item_gui_id in QgsGui.layoutItemGuiRegistry().itemMetadataIds():
         if QgsGui.layoutItemGuiRegistry().itemMetadata(
                 item_gui_id).type() == item_type:
             return QgsGui.layoutItemGuiRegistry().itemMetadata(item_gui_id)
     return None
示例#3
0
    def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""
        icon = GuiUtils.get_icon('dataplotly.svg')

        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar('DataPlotly')
        self.toolbar.setObjectName('DataPlotly')

        self.dock_widget = DataPlotlyDock(message_bar=self.iface.messageBar())
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.dock_widget)
        self.dock_widget.hide()

        self.show_dock_action = QAction(icon, self.tr('DataPlotly'))
        self.show_dock_action.setToolTip(self.tr('Shows the DataPlotly dock'))
        self.show_dock_action.setCheckable(True)

        self.dock_widget.setToggleVisibilityAction(self.show_dock_action)

        self.iface.pluginMenu().addAction(self.show_dock_action)
        self.toolbar.addAction(self.show_dock_action)

        # Add processing provider
        self.initProcessing()

        # Add layout gui utils
        self.plot_item_gui_metadata = PlotLayoutItemGuiMetadata()
        QgsGui.layoutItemGuiRegistry().addLayoutItemGuiMetadata(
            self.plot_item_gui_metadata)

        # Open the online help
        if Qgis.QGIS_VERSION_INT >= 31000:
            self.help_action = QAction(icon, 'DataPlotly',
                                       self.iface.mainWindow())
            self.iface.pluginHelpMenu().addAction(self.help_action)
            self.help_action.triggered.connect(self.open_help)
示例#4
0
    def register_gui(cls):
        existing_items_types = [
            QgsGui.layoutItemGuiRegistry().itemMetadata(_id).type()
            for _id in QgsGui.layoutItemGuiRegistry().itemMetadataIds()
        ]

        for m in cls.GUI_CLASSES:
            item_metadata = m()

            if item_metadata.type() in existing_items_types:
                continue  # already added

            cls.gui_metadata.append(item_metadata)
            QgsGui.layoutItemGuiRegistry().addLayoutItemGuiMetadata(
                item_metadata)
示例#5
0
def register_items_gui_metadata():
    """Registers GUI metadata for QR and barcode items."""
    item_registry = QgsGui.layoutItemGuiRegistry()

    # Create menu group
    item_registry.addItemGroup(
        QgsLayoutItemGuiGroup(
            ITEM_CATEGORY,
            QCoreApplication.translate('QrBarCodeLayoutItem', 'Barcode Item'),
            get_icon('qr_barcode.svg')))

    # Add linear barcode gui metadata
    linear_barcode_meta = LinearBarcodeLayoutItemGuiMetadata()
    item_registry.addLayoutItemGuiMetadata(linear_barcode_meta)

    # Add QR code gui metadata
    qr_code_meta = QrCodeLayoutItemGuiMetadata()
    item_registry.addLayoutItemGuiMetadata(qr_code_meta)