def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.read_triggered = False

        self.plot_item_metadata = PlotLayoutItemMetadata()
        self.plot_item_gui_metadata = None
        QgsApplication.layoutItemRegistry().addLayoutItemType(self.plot_item_metadata)
示例#2
0
def register_barcode_items():
    """Register barcode items in the app item registry."""
    QgsApplication.layoutItemRegistry().addLayoutItemType(
        QrCodeLayoutItemMetadata()
    )
    QgsApplication.layoutItemRegistry().addLayoutItemType(
        LinearBarcodeLayoutItemMetadata()
    )
示例#3
0
def serverClassFactory(server_iface):
    """Load DataPlotly server.

    :param server_iface: A QGIS Server interface instance.
    :type server_iface: QgsServerInterface
    """
    _ = server_iface
    # pylint: disable=import-outside-toplevel
    from qgis.core import QgsApplication, QgsMessageLog, Qgis
    from DataPlotly.layouts.plot_layout_item import PlotLayoutItemMetadata

    QgsApplication.layoutItemRegistry().addLayoutItemType(
        PlotLayoutItemMetadata())
    QgsMessageLog.logMessage("Custom DataPlotly layout item loaded",
                             "DataPlotly", Qgis.Info)
    def __init__(self, iface):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface

        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)

        # initialize processing provider
        self.provider = DataPlotlyProvider(plugin_version=DataPlotly.VERSION)

        # initialize locale
        locale = QSettings().value('locale/userLocale', 'en_US')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'DataPlotly_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        self.dock_widget = None
        self.show_dock_action = None
        self.menu = None
        self.toolbar = None

        self.plot_item_metadata = PlotLayoutItemMetadata()
        self.plot_item_gui_metadata = None
        QgsApplication.layoutItemRegistry().addLayoutItemType(
            self.plot_item_metadata)
示例#5
0
    def add_custom_item_types(cls):
        for m in cls.CUSTOM_CLASSES:
            item_metadata = m()
            if item_metadata.type() in QgsApplication.layoutItemRegistry().itemTypes():
                continue  # already added

            cls.metadata.append(item_metadata)
            QgsApplication.layoutItemRegistry().addLayoutItemType(item_metadata)

        for mf in cls.CUSTOM_MULTIFRAME_CLASSES:
            item_metadata = mf()
            if item_metadata.type() in QgsApplication.layoutItemRegistry().itemTypes():
                continue  # already added

            cls.metadata.append(item_metadata)
            QgsApplication.layoutItemRegistry().addLayoutMultiFrameType(item_metadata)
示例#6
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self._item_registry = QgsApplication.layoutItemRegistry()