Ejemplo n.º 1
0
    def unload(self):
        self.toolbox.setVisible(False)
        self.iface.removeDockWidget(self.toolbox)
        self.iface.attributesToolBar().removeAction(self.toolboxAction)

        self.resultsDock.setVisible(False)
        self.iface.removeDockWidget(self.resultsDock)

        self.toolbox.deleteLater()
        self.menu.deleteLater()

        # delete temporary output files
        folder = QgsProcessingUtils.tempFolder()
        if QDir(folder).exists():
            shutil.rmtree(folder, True)

        # also delete temporary help files
        folder = tempHelpFolder()
        if QDir(folder).exists():
            shutil.rmtree(folder, True)

        self.iface.unregisterMainWindowAction(self.toolboxAction)
        self.iface.unregisterMainWindowAction(self.modelerAction)
        self.iface.unregisterMainWindowAction(self.historyAction)
        self.iface.unregisterMainWindowAction(self.resultsAction)

        self.iface.unregisterOptionsWidgetFactory(self.options_factory)
        self.iface.deregisterLocatorFilter(self.locator_filter)
        self.iface.unregisterCustomDropHandler(self.drop_handler)
        QgsApplication.dataItemProviderRegistry().removeProvider(
            self.item_provider)

        removeMenus()
        Processing.deinitialize()
Ejemplo n.º 2
0
    def unload(self):
        self.toolbox.setVisible(False)
        self.iface.removeDockWidget(self.toolbox)
        self.iface.attributesToolBar().removeAction(self.toolboxAction)

        self.resultsDock.setVisible(False)
        self.iface.removeDockWidget(self.resultsDock)

        self.toolbox.deleteLater()
        self.menu.deleteLater()

        # delete temporary output files
        folder = QgsProcessingUtils.tempFolder()
        if QDir(folder).exists():
            shutil.rmtree(folder, True)

        # also delete temporary help files
        folder = tempHelpFolder()
        if QDir(folder).exists():
            shutil.rmtree(folder, True)

        self.iface.unregisterMainWindowAction(self.toolboxAction)
        self.iface.unregisterMainWindowAction(self.modelerAction)
        self.iface.unregisterMainWindowAction(self.historyAction)
        self.iface.unregisterMainWindowAction(self.resultsAction)

        self.iface.unregisterOptionsWidgetFactory(self.options_factory)
        self.iface.deregisterLocatorFilter(self.locator_filter)
        self.iface.unregisterCustomDropHandler(self.drop_handler)
        QgsApplication.dataItemProviderRegistry().removeProvider(self.item_provider)

        removeMenus()
        Processing.deinitialize()
Ejemplo n.º 3
0
 def unload(self):
     """teardown"""
     QgsApplication.processingRegistry().removeProvider(self.provider)
     QgsApplication.dataItemProviderRegistry().removeProvider(
         self.item_provider)
     self.iface.unregisterCustomDropHandler(self.drop_handler)
     self.iface.unregisterCustomDropHandler(self.lyr_drop_handler)
     self.iface.unregisterCustomDropHandler(self.mxd_drop_handler)
     self.iface.unregisterCustomDropHandler(self.dat_drop_handler)
     self.iface.unregisterCustomDropHandler(self.name_drop_handler)
     self.iface.unregisterOptionsWidgetFactory(self.options_factory)
     self.iface.unregisterCustomLayoutDropHandler(self.layout_drop_handler)
Ejemplo n.º 4
0
 def __init__(self, iface):
     self.iface = iface
     self.options_factory = ProcessingOptionsFactory()
     self.options_factory.setTitle(self.tr('Processing'))
     iface.registerOptionsWidgetFactory(self.options_factory)
     self.drop_handler = ProcessingDropHandler()
     iface.registerCustomDropHandler(self.drop_handler)
     self.item_provider = ProcessingDataItemProvider()
     QgsApplication.dataItemProviderRegistry().addProvider(self.item_provider)
     self.locator_filter = AlgorithmLocatorFilter()
     iface.registerLocatorFilter(self.locator_filter)
     Processing.initialize()
Ejemplo n.º 5
0
 def __init__(self, iface):
     self.iface = iface
     self.options_factory = ProcessingOptionsFactory()
     self.options_factory.setTitle(self.tr('Processing'))
     iface.registerOptionsWidgetFactory(self.options_factory)
     self.drop_handler = ProcessingDropHandler()
     iface.registerCustomDropHandler(self.drop_handler)
     self.item_provider = ProcessingDataItemProvider()
     QgsApplication.dataItemProviderRegistry().addProvider(self.item_provider)
     self.locator_filter = AlgorithmLocatorFilter()
     iface.registerLocatorFilter(self.locator_filter)
     Processing.initialize()
Ejemplo n.º 6
0
    def initGui(self):
        """startup"""
        self.initProcessing()
        self.iface.registerCustomDropHandler(self.drop_handler)
        self.iface.registerCustomDropHandler(self.lyr_drop_handler)
        self.iface.registerCustomDropHandler(self.mxd_drop_handler)
        self.iface.registerCustomDropHandler(self.dat_drop_handler)
        self.iface.registerCustomDropHandler(self.name_drop_handler)
        self.iface.registerCustomLayoutDropHandler(self.layout_drop_handler)
        QgsApplication.dataItemProviderRegistry().addProvider(
            self.item_provider)

        self.options_factory = SlyrOptionsFactory()
        self.options_factory.setTitle('SLYR')
        self.iface.registerOptionsWidgetFactory(self.options_factory)
Ejemplo n.º 7
0
    def testDataItems(self):

        registry = QgsApplication.dataItemProviderRegistry()
        ogrprovider = next(provider for provider in registry.providers() if provider.name() == 'OGR')

        # Single layer
        item = ogrprovider.createDataItem(os.path.join(TEST_DATA_DIR, 'lines.shp'), None)
        self.assertTrue(item.uri().endswith('lines.shp'))

        # Multiple layer
        item = ogrprovider.createDataItem(os.path.join(TEST_DATA_DIR, 'multilayer.kml'), None)
        children = item.createChildren()
        self.assertEqual(len(children), 2)
        self.assertIn('multilayer.kml|layername=Layer1', children[0].uri())
        self.assertIn('multilayer.kml|layername=Layer2', children[1].uri())

        # Multiple layer (geopackage)
        tmpfile = os.path.join(self.basetestpath, 'testDataItems.gpkg')
        ds = ogr.GetDriverByName('GPKG').CreateDataSource(tmpfile)
        lyr = ds.CreateLayer('Layer1', geom_type=ogr.wkbPoint)
        lyr = ds.CreateLayer('Layer2', geom_type=ogr.wkbPoint)
        ds = None
        item = ogrprovider.createDataItem(tmpfile, None)
        children = item.createChildren()
        self.assertEqual(len(children), 2)
        self.assertIn('testDataItems.gpkg|layername=Layer1', children[0].uri())
        self.assertIn('testDataItems.gpkg|layername=Layer2', children[1].uri())
Ejemplo n.º 8
0
 def __init__(self, iface):
     self.iface = iface
     self.options_factory = ProcessingOptionsFactory()
     self.options_factory.setTitle(self.tr('Processing'))
     iface.registerOptionsWidgetFactory(self.options_factory)
     self.drop_handler = ProcessingDropHandler()
     iface.registerCustomDropHandler(self.drop_handler)
     self.item_provider = ProcessingDataItemProvider()
     QgsApplication.dataItemProviderRegistry().addProvider(self.item_provider)
     self.locator_filter = AlgorithmLocatorFilter()
     iface.registerLocatorFilter(self.locator_filter)
     # Invalidate the locator filter for in-place when active layer changes
     iface.currentLayerChanged.connect(lambda _: self.iface.invalidateLocatorResults())
     self.edit_features_locator_filter = InPlaceAlgorithmLocatorFilter()
     iface.registerLocatorFilter(self.edit_features_locator_filter)
     Processing.initialize()
Ejemplo n.º 9
0
    def renameTable(self, table, new_table):
        """Renames the table

        :param table: tuple with schema and table names
        :type table: tuple (str, str)
        :param new_table: new table name
        :type new_table: str
        :return: true on success
        :rtype: bool
        """

        table_name = table[1]
        provider = [
            p for p in QgsApplication.dataItemProviderRegistry().providers()
            if p.name() == 'OGR'
        ][0]
        collection_item = provider.createDataItem(self.dbname, None)
        data_item = [
            c for c in collection_item.createChildren()
            if c.name() == table_name
        ][0]
        result = data_item.rename(new_table)
        # we need to reopen after renaming since OGR doesn't update its
        # internal state
        if result:
            self._opendb()
        return result
Ejemplo n.º 10
0
    def testDataItems(self):

        registry = QgsApplication.dataItemProviderRegistry()
        ogrprovider = next(provider for provider in registry.providers()
                           if provider.name() == 'OGR')

        # Single layer
        item = ogrprovider.createDataItem(
            os.path.join(TEST_DATA_DIR, 'lines.shp'), None)
        self.assertTrue(item.uri().endswith('lines.shp'))

        # Multiple layer
        item = ogrprovider.createDataItem(
            os.path.join(TEST_DATA_DIR, 'multilayer.kml'), None)
        children = item.createChildren()
        self.assertEqual(len(children), 2)
        self.assertIn('multilayer.kml|layername=Layer1', children[0].uri())
        self.assertIn('multilayer.kml|layername=Layer2', children[1].uri())

        # Multiple layer (geopackage)
        tmpfile = os.path.join(self.basetestpath, 'testDataItems.gpkg')
        ds = ogr.GetDriverByName('GPKG').CreateDataSource(tmpfile)
        lyr = ds.CreateLayer('Layer1', geom_type=ogr.wkbPoint)
        lyr = ds.CreateLayer('Layer2', geom_type=ogr.wkbPoint)
        ds = None
        item = ogrprovider.createDataItem(tmpfile, None)
        children = item.createChildren()
        self.assertEqual(len(children), 2)
        self.assertIn('testDataItems.gpkg|layername=Layer1', children[0].uri())
        self.assertIn('testDataItems.gpkg|layername=Layer2', children[1].uri())
Ejemplo n.º 11
0
    def testDataItemsRaster(self):

        registry = QgsApplication.dataItemProviderRegistry()
        ogrprovider = next(provider for provider in registry.providers() if provider.name() == 'OGR')

        # Multiple layer (geopackage)
        path = os.path.join(unitTestDataPath(), 'two_raster_layers.gpkg')
        item = ogrprovider.createDataItem(path, None)
        children = item.createChildren()
        self.assertEqual(len(children), 2)
        self.assertIn('GPKG:' + path + ':layer01', children[0].uri())
        self.assertIn('GPKG:' + path + ':layer02', children[1].uri())
Ejemplo n.º 12
0
    def renameTable(self, table, new_table):
        """Renames the table

        :param table: tuple with schema and table names
        :type table: tuple (str, str)
        :param new_table: new table name
        :type new_table: str
        :return: true on success
        :rtype: bool
        """

        table_name = table[1]
        provider = [p for p in QgsApplication.dataItemProviderRegistry().providers() if p.name() == 'OGR'][0]
        collection_item = provider.createDataItem(self.dbname, None)
        data_item = [c for c in collection_item.createChildren() if c.name() == table_name][0]
        result = data_item.rename(new_table)
        # we need to reopen after renaming since OGR doesn't update its
        # internal state
        if result:
            self._opendb()
        return result
Ejemplo n.º 13
0
    def testShzSupport(self):
        ''' Test support for single layer compressed shapefiles (.shz) '''

        if int(osgeo.gdal.VersionInfo('VERSION_NUM')) < GDAL_COMPUTE_VERSION(
                3, 1, 0):
            return

        tmpfile = os.path.join(self.basetestpath, 'testShzSupport.shz')
        ds = osgeo.ogr.GetDriverByName('ESRI Shapefile').CreateDataSource(
            tmpfile)
        lyr = ds.CreateLayer('testShzSupport', geom_type=osgeo.ogr.wkbPoint)
        lyr.CreateField(osgeo.ogr.FieldDefn('attr', osgeo.ogr.OFTInteger))
        f = osgeo.ogr.Feature(lyr.GetLayerDefn())
        f.SetField('attr', 1)
        f.SetGeometry(osgeo.ogr.CreateGeometryFromWkt('POINT(0 0)'))
        lyr.CreateFeature(f)
        f = None
        ds = None

        vl = QgsVectorLayer(tmpfile, 'test', 'ogr')
        self.assertTrue(vl.isValid())
        self.assertEqual(vl.wkbType(), QgsWkbTypes.Point)
        f = next(vl.getFeatures())
        assert f['attr'] == 1
        self.assertEqual(f.geometry().constGet().asWkt(), 'Point (0 0)')

        self.assertTrue(vl.startEditing())
        self.assertTrue(vl.changeAttributeValue(f.id(), 0, -1))
        self.assertTrue(vl.commitChanges())

        f = next(vl.getFeatures())
        assert f['attr'] == -1

        # Check DataItem
        registry = QgsApplication.dataItemProviderRegistry()
        ogrprovider = next(provider for provider in registry.providers()
                           if provider.name() == 'OGR')
        item = ogrprovider.createDataItem(tmpfile, None)
        self.assertTrue(item.uri().endswith('testShzSupport.shz'))
Ejemplo n.º 14
0
    def testShpZipSupport(self):
        ''' Test support for multi layer compressed shapefiles (.shp.zip) '''

        if int(osgeo.gdal.VersionInfo('VERSION_NUM')) < GDAL_COMPUTE_VERSION(
                3, 1, 0):
            return

        tmpfile = os.path.join(self.basetestpath, 'testShpZipSupport.shp.zip')
        ds = osgeo.ogr.GetDriverByName('ESRI Shapefile').CreateDataSource(
            tmpfile)
        lyr = ds.CreateLayer('layer1', geom_type=osgeo.ogr.wkbPoint)
        lyr.CreateField(osgeo.ogr.FieldDefn('attr', osgeo.ogr.OFTInteger))
        f = osgeo.ogr.Feature(lyr.GetLayerDefn())
        f.SetField('attr', 1)
        f.SetGeometry(osgeo.ogr.CreateGeometryFromWkt('POINT(0 0)'))
        lyr.CreateFeature(f)
        f = None
        lyr = ds.CreateLayer('layer2', geom_type=osgeo.ogr.wkbMultiLineString)
        lyr.CreateField(osgeo.ogr.FieldDefn('attr', osgeo.ogr.OFTInteger))
        f = osgeo.ogr.Feature(lyr.GetLayerDefn())
        f.SetField('attr', 2)
        f.SetGeometry(osgeo.ogr.CreateGeometryFromWkt('LINESTRING(0 0,1 1)'))
        lyr.CreateFeature(f)
        f = None
        ds = None

        vl1 = QgsVectorLayer(tmpfile + '|layername=layer1', 'test', 'ogr')
        vl2 = QgsVectorLayer(tmpfile + '|layername=layer2', 'test', 'ogr')
        self.assertTrue(vl1.isValid())
        self.assertTrue(vl2.isValid())
        self.assertEqual(vl1.wkbType(), QgsWkbTypes.Point)
        self.assertEqual(vl2.wkbType(), QgsWkbTypes.MultiLineString)
        f1 = next(vl1.getFeatures())
        f2 = next(vl2.getFeatures())
        assert f1['attr'] == 1
        self.assertEqual(f1.geometry().constGet().asWkt(), 'Point (0 0)')
        assert f2['attr'] == 2
        self.assertEqual(f2.geometry().constGet().asWkt(),
                         'MultiLineString ((0 0, 1 1))')

        self.assertTrue(vl1.startEditing())
        self.assertTrue(vl2.startEditing())
        self.assertTrue(vl1.changeAttributeValue(f1.id(), 0, -1))
        self.assertTrue(vl2.changeAttributeValue(f2.id(), 0, -2))
        self.assertTrue(vl1.commitChanges())
        self.assertTrue(vl2.commitChanges())

        f = next(vl1.getFeatures())
        assert f['attr'] == -1

        f = next(vl2.getFeatures())
        assert f['attr'] == -2

        # Check DataItem
        registry = QgsApplication.dataItemProviderRegistry()
        ogrprovider = next(provider for provider in registry.providers()
                           if provider.name() == 'OGR')
        item = ogrprovider.createDataItem(tmpfile, None)
        children = item.createChildren()
        self.assertEqual(len(children), 2)
        uris = sorted([children[i].uri() for i in range(2)])
        self.assertIn('testShpZipSupport.shp.zip|layername=layer1', uris[0])
        self.assertIn('testShpZipSupport.shp.zip|layername=layer2', uris[1])

        gdalprovider = next(provider for provider in registry.providers()
                            if provider.name() == 'GDAL')
        item = gdalprovider.createDataItem(tmpfile, None)
        assert not item
Ejemplo n.º 15
0
 def testDataItemProviderRegistry(self):
     self.assertTrue(QgsApplication.dataItemProviderRegistry())
Ejemplo n.º 16
0
    def initGui(self):
        self.options_factory = ProcessingOptionsFactory()
        self.options_factory.setTitle(self.tr('Processing'))
        iface.registerOptionsWidgetFactory(self.options_factory)
        self.drop_handler = ProcessingDropHandler()
        iface.registerCustomDropHandler(self.drop_handler)
        self.item_provider = ProcessingDataItemProvider()
        QgsApplication.dataItemProviderRegistry().addProvider(self.item_provider)
        self.locator_filter = AlgorithmLocatorFilter()
        iface.registerLocatorFilter(self.locator_filter)
        # Invalidate the locator filter for in-place when active layer changes
        iface.currentLayerChanged.connect(lambda _: self.iface.invalidateLocatorResults())
        self.edit_features_locator_filter = InPlaceAlgorithmLocatorFilter()
        iface.registerLocatorFilter(self.edit_features_locator_filter)

        self.toolbox = ProcessingToolbox()
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.toolbox)
        self.toolbox.hide()
        self.toolbox.visibilityChanged.connect(self.toolboxVisibilityChanged)

        self.resultsDock = ResultsDock()
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.resultsDock)
        self.resultsDock.hide()

        self.menu = QMenu(self.iface.mainWindow().menuBar())
        self.menu.setObjectName('processing')
        self.menu.setTitle(self.tr('Pro&cessing'))

        self.toolboxAction = QAction(self.tr('&Toolbox'), self.iface.mainWindow())
        self.toolboxAction.setCheckable(True)
        self.toolboxAction.setObjectName('toolboxAction')
        self.toolboxAction.setIcon(
            QgsApplication.getThemeIcon("/processingAlgorithm.svg"))
        self.iface.registerMainWindowAction(self.toolboxAction,
                                            QKeySequence('Ctrl+Alt+T').toString(QKeySequence.NativeText))
        self.toolboxAction.toggled.connect(self.openToolbox)
        self.iface.attributesToolBar().insertAction(self.iface.actionOpenStatisticalSummary(), self.toolboxAction)
        self.menu.addAction(self.toolboxAction)

        self.modelerAction = QAction(
            QgsApplication.getThemeIcon("/processingModel.svg"),
            QCoreApplication.translate('ProcessingPlugin', 'Graphical &Modeler…'), self.iface.mainWindow())
        self.modelerAction.setObjectName('modelerAction')
        self.modelerAction.triggered.connect(self.openModeler)
        self.iface.registerMainWindowAction(self.modelerAction,
                                            QKeySequence('Ctrl+Alt+M').toString(QKeySequence.NativeText))
        self.menu.addAction(self.modelerAction)

        self.historyAction = QAction(
            QgsApplication.getThemeIcon("/mIconHistory.svg"),
            QCoreApplication.translate('ProcessingPlugin', '&History…'), self.iface.mainWindow())
        self.historyAction.setObjectName('historyAction')
        self.historyAction.triggered.connect(self.openHistory)
        self.iface.registerMainWindowAction(self.historyAction,
                                            QKeySequence('Ctrl+Alt+H').toString(QKeySequence.NativeText))
        self.menu.addAction(self.historyAction)
        self.toolbox.processingToolbar.addAction(self.historyAction)

        self.resultsAction = QAction(
            QgsApplication.getThemeIcon("/processingResult.svg"),
            self.tr('&Results Viewer'), self.iface.mainWindow())
        self.resultsAction.setCheckable(True)
        self.iface.registerMainWindowAction(self.resultsAction,
                                            QKeySequence('Ctrl+Alt+R').toString(QKeySequence.NativeText))

        self.menu.addAction(self.resultsAction)
        self.toolbox.processingToolbar.addAction(self.resultsAction)
        self.resultsDock.visibilityChanged.connect(self.resultsAction.setChecked)
        self.resultsAction.toggled.connect(self.resultsDock.setUserVisible)

        self.toolbox.processingToolbar.addSeparator()

        self.editInPlaceAction = QAction(
            QgsApplication.getThemeIcon("/mActionProcessSelected.svg"),
            self.tr('Edit Features In-Place'), self.iface.mainWindow())
        self.editInPlaceAction.setObjectName('editInPlaceFeatures')
        self.editInPlaceAction.setCheckable(True)
        self.editInPlaceAction.toggled.connect(self.editSelected)
        self.menu.addAction(self.editInPlaceAction)
        self.toolbox.processingToolbar.addAction(self.editInPlaceAction)

        self.toolbox.processingToolbar.addSeparator()

        self.optionsAction = QAction(
            QgsApplication.getThemeIcon("/mActionOptions.svg"),
            self.tr('Options'), self.iface.mainWindow())
        self.optionsAction.setObjectName('optionsAction')
        self.optionsAction.triggered.connect(self.openProcessingOptions)
        self.toolbox.processingToolbar.addAction(self.optionsAction)

        menuBar = self.iface.mainWindow().menuBar()
        menuBar.insertMenu(
            self.iface.firstRightStandardMenu().menuAction(), self.menu)

        self.menu.addSeparator()

        initializeMenus()
        createMenus()

        # In-place editing button state sync
        self.iface.currentLayerChanged.connect(self.sync_in_place_button_state)
        self.iface.mapCanvas().selectionChanged.connect(self.sync_in_place_button_state)
        self.iface.actionToggleEditing().triggered.connect(partial(self.sync_in_place_button_state, None))
        self.sync_in_place_button_state()
 def testAppRegistry(self):
     # ensure there is an application instance
     self.assertIsNotNone(QgsApplication.dataItemProviderRegistry())
Ejemplo n.º 18
0
 def testAppRegistry(self):
     # ensure there is an application instance
     self.assertIsNotNone(QgsApplication.dataItemProviderRegistry())
Ejemplo n.º 19
0
 def testDataItemProviderRegistry(self):
     self.assertTrue(QgsApplication.dataItemProviderRegistry())
Ejemplo n.º 20
0
    def initGui(self):
        self.options_factory = ProcessingOptionsFactory()
        self.options_factory.setTitle(self.tr('Processing'))
        iface.registerOptionsWidgetFactory(self.options_factory)
        self.drop_handler = ProcessingDropHandler()
        iface.registerCustomDropHandler(self.drop_handler)
        self.item_provider = ProcessingDataItemProvider()
        QgsApplication.dataItemProviderRegistry().addProvider(self.item_provider)
        self.locator_filter = AlgorithmLocatorFilter()
        iface.registerLocatorFilter(self.locator_filter)
        # Invalidate the locator filter for in-place when active layer changes
        iface.currentLayerChanged.connect(lambda _: self.iface.invalidateLocatorResults())
        self.edit_features_locator_filter = InPlaceAlgorithmLocatorFilter()
        iface.registerLocatorFilter(self.edit_features_locator_filter)

        self.toolbox = ProcessingToolbox()
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.toolbox)
        self.toolbox.hide()
        self.toolbox.visibilityChanged.connect(self.toolboxVisibilityChanged)

        self.resultsDock = ResultsDock()
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.resultsDock)
        self.resultsDock.hide()

        self.menu = QMenu(self.iface.mainWindow().menuBar())
        self.menu.setObjectName('processing')
        self.menu.setTitle(self.tr('Pro&cessing'))

        self.toolboxAction = QAction(self.tr('&Toolbox'), self.iface.mainWindow())
        self.toolboxAction.setCheckable(True)
        self.toolboxAction.setObjectName('toolboxAction')
        self.toolboxAction.setIcon(
            QgsApplication.getThemeIcon("/processingAlgorithm.svg"))
        self.iface.registerMainWindowAction(self.toolboxAction,
                                            QKeySequence('Ctrl+Alt+T').toString(QKeySequence.NativeText))
        self.toolboxAction.toggled.connect(self.openToolbox)
        self.iface.attributesToolBar().insertAction(self.iface.actionOpenStatisticalSummary(), self.toolboxAction)
        self.menu.addAction(self.toolboxAction)

        self.modelerAction = QAction(
            QgsApplication.getThemeIcon("/processingModel.svg"),
            QCoreApplication.translate('ProcessingPlugin', '&Graphical Modeler…'), self.iface.mainWindow())
        self.modelerAction.setObjectName('modelerAction')
        self.modelerAction.triggered.connect(self.openModeler)
        self.iface.registerMainWindowAction(self.modelerAction,
                                            QKeySequence('Ctrl+Alt+G').toString(QKeySequence.NativeText))
        self.menu.addAction(self.modelerAction)

        self.historyAction = QAction(
            QgsApplication.getThemeIcon("/mIconHistory.svg"),
            QCoreApplication.translate('ProcessingPlugin', '&History…'), self.iface.mainWindow())
        self.historyAction.setObjectName('historyAction')
        self.historyAction.triggered.connect(self.openHistory)
        self.iface.registerMainWindowAction(self.historyAction,
                                            QKeySequence('Ctrl+Alt+H').toString(QKeySequence.NativeText))
        self.menu.addAction(self.historyAction)
        self.toolbox.processingToolbar.addAction(self.historyAction)

        self.resultsAction = QAction(
            QgsApplication.getThemeIcon("/processingResult.svg"),
            self.tr('&Results Viewer'), self.iface.mainWindow())
        self.resultsAction.setObjectName('resultsViewer')
        self.resultsAction.setCheckable(True)
        self.iface.registerMainWindowAction(self.resultsAction,
                                            QKeySequence('Ctrl+Alt+R').toString(QKeySequence.NativeText))

        self.menu.addAction(self.resultsAction)
        self.toolbox.processingToolbar.addAction(self.resultsAction)
        self.resultsDock.visibilityChanged.connect(self.resultsAction.setChecked)
        self.resultsAction.toggled.connect(self.resultsDock.setUserVisible)

        self.toolbox.processingToolbar.addSeparator()

        self.editInPlaceAction = QAction(
            QgsApplication.getThemeIcon("/mActionProcessSelected.svg"),
            self.tr('Edit Features In-Place'), self.iface.mainWindow())
        self.editInPlaceAction.setObjectName('editInPlaceFeatures')
        self.editInPlaceAction.setCheckable(True)
        self.editInPlaceAction.toggled.connect(self.editSelected)
        self.menu.addAction(self.editInPlaceAction)
        self.toolbox.processingToolbar.addAction(self.editInPlaceAction)

        self.toolbox.processingToolbar.addSeparator()

        self.optionsAction = QAction(
            QgsApplication.getThemeIcon("/mActionOptions.svg"),
            self.tr('Options'), self.iface.mainWindow())
        self.optionsAction.setObjectName('optionsAction')
        self.optionsAction.triggered.connect(self.openProcessingOptions)
        self.toolbox.processingToolbar.addAction(self.optionsAction)

        menuBar = self.iface.mainWindow().menuBar()
        menuBar.insertMenu(
            self.iface.firstRightStandardMenu().menuAction(), self.menu)

        self.menu.addSeparator()

        initializeMenus()
        createMenus()
        createButtons()

        # In-place editing button state sync
        self.iface.currentLayerChanged.connect(self.sync_in_place_button_state)
        self.iface.mapCanvas().selectionChanged.connect(self.sync_in_place_button_state)
        self.iface.actionToggleEditing().triggered.connect(partial(self.sync_in_place_button_state, None))
        self.sync_in_place_button_state()