Python qgis.core.QgsApplication.processingRegistry() Examples

The following are 22 code examples of qgis.core.QgsApplication.processingRegistry(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module qgis.core.QgsApplication , or try the search function .
Example #1
Source File: dzetsaka.py    From dzetsaka with GNU General Public License v3.0 6 votes vote down vote up
def unload(self):
        """Removes the plugin menu item and icon from QGIS GUI."""

        # close dock
        self.pluginIsActive = False
        if self.dockwidget is not None:
            self.dockwidget.close()

        # Remove processing algorithms
        QgsApplication.processingRegistry().removeProvider(self.provider)
        
        
#        self.iface.removePluginMenu(self.pluginName, self.settingsIcon)
#        self.iface.removePluginMenu(self.tr(u'&dzetsaka'),self.actions[0])
        
        for action in self.actions:
            self.iface.removeToolBarIcon(action)
            self.iface.removePluginMenu(
                self.tr(u'&dzetsaka'),
                action)
#
#        # remove the toolbar
#       qg del self.toolbar
    # -------------------------------------------------------------------------- 
Example #2
Source File: delete_script.py    From qgis-processing-r with GNU General Public License v3.0 6 votes vote down vote up
def execute(self):
        """
        Called whenever the action is triggered
        """
        reply = QMessageBox.question(None,
                                     self.tr("Delete Script"),
                                     self.tr("Are you sure you want to delete this script?"),
                                     QMessageBox.Yes | QMessageBox.No,
                                     QMessageBox.No)
        if reply == QMessageBox.Yes:
            file_path = self.itemData.description_file
            if file_path is not None:
                os.remove(file_path)
                QgsApplication.processingRegistry().providerById("r").refreshAlgorithms()
            else:
                QMessageBox.warning(None,
                                    self.tr("Delete Script"),
                                    self.tr("Can not find corresponding script file.")) 
Example #3
Source File: dsg_tools.py    From DsgTools with GNU General Public License v2.0 6 votes vote down vote up
def unload(self):
        """
        Removes the plugin menu item and icon from QGIS GUI
        """
        self.guiManager.unload()
        for action in self.actions:
            self.iface.removePluginMenu(
                '&DSGTools',
                action)
            self.iface.removeToolBarIcon(action)
            self.iface.unregisterMainWindowAction(action)

        if self.dsgTools is not None:
            self.menuBar.removeAction(self.dsgTools.menuAction())
        self.iface.mainWindow().removeToolBar(self.toolbar)
        QgsApplication.processingRegistry().removeProvider(self.provider)
        del self.dsgTools
        del self.toolbar 
Example #4
Source File: kmltools.py    From qgis-kmltools-plugin with GNU General Public License v2.0 6 votes vote down vote up
def initGui(self):
        """Create the menu & tool bar items within QGIS"""
        icon = QIcon(os.path.dirname(__file__) + "/icon.png")
        self.kmlAction = QAction(icon, "Import KML/KMZ", self.iface.mainWindow())
        self.kmlAction.triggered.connect(self.showDialog)
        self.kmlAction.setCheckable(False)
        self.iface.addToolBarIcon(self.kmlAction)
        self.iface.addPluginToVectorMenu("KML Tools", self.kmlAction)
        # Expansion of HTML description field
        icon = QIcon(os.path.dirname(__file__) + "/html.png")
        self.htmlDescAction = QAction(icon, "Expand HTML description field", self.iface.mainWindow())
        self.htmlDescAction.triggered.connect(self.htmlDescDialog)
        self.htmlDescAction.setCheckable(False)
        self.iface.addToolBarIcon(self.htmlDescAction)
        self.iface.addPluginToVectorMenu("KML Tools", self.htmlDescAction)
        # Help
        icon = QIcon(os.path.dirname(__file__) + '/help.png')
        self.helpAction = QAction(icon, "Help", self.iface.mainWindow())
        self.helpAction.triggered.connect(self.help)
        self.iface.addPluginToVectorMenu('KML Tools', self.helpAction)

        # Add the processing provider
        QgsApplication.processingRegistry().addProvider(self.provider) 
Example #5
Source File: kmltools.py    From qgis-kmltools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def unload(self):
        """Remove the plugin menu item and icon from QGIS GUI."""
        self.iface.removePluginVectorMenu("KML Tools", self.kmlAction)
        self.iface.removePluginVectorMenu("KML Tools", self.htmlDescAction)
        self.iface.removePluginVectorMenu("KML Tools", self.helpAction)
        self.iface.removeToolBarIcon(self.kmlAction)
        self.iface.removeToolBarIcon(self.htmlDescAction)
        QgsApplication.processingRegistry().removeProvider(self.provider) 
Example #6
Source File: trajectoryProviderPlugin.py    From qgis-processing-trajectory with GNU General Public License v3.0 5 votes vote down vote up
def unload(self):
        QgsApplication.processingRegistry().removeProvider(self.provider) 
Example #7
Source File: trajectoryProviderPlugin.py    From qgis-processing-trajectory with GNU General Public License v3.0 5 votes vote down vote up
def initGui(self):
        QgsApplication.processingRegistry().addProvider(self.provider) 
Example #8
Source File: r_plugin.py    From qgis-processing-r with GNU General Public License v3.0 5 votes vote down vote up
def unload(self):
        """Removes the plugin menu item and icon from QGIS GUI."""
        QgsApplication.processingRegistry().removeProvider(self.provider) 
Example #9
Source File: r_plugin.py    From qgis-processing-r with GNU General Public License v3.0 5 votes vote down vote up
def initProcessing(self):
        """Create the Processing provider"""
        QgsApplication.processingRegistry().addProvider(self.provider) 
Example #10
Source File: dsg_tools.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def initGui(self):
        """
        Create the menu entries and toolbar icons inside the QGIS GUI
        """

        self.dsgTools = QMenu(self.iface.mainWindow())
        self.dsgTools.setObjectName(u'DsgTools')
        self.dsgTools.setTitle(u'DSGTools')
        self.menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.dsgTools)
        #GuiManager
        self.guiManager = GuiManager(self.iface, parentMenu = self.dsgTools, toolbar = self.toolbar)
        self.guiManager.initGui()
        #provider
        QgsApplication.processingRegistry().addProvider(self.provider) 
Example #11
Source File: shapeTools.py    From qgis-shapetools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def unload(self):
        self.canvas.unsetMapTool(self.azDigitizerTool)
        self.canvas.unsetMapTool(self.lineDigitizerTool)

        # remove from menu
        self.iface.removePluginVectorMenu('Shape Tools', self.createShapesAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.xyLineAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.geodesicDensifyAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.simplifyGeomAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.geodesicLineBreakAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.measureAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.measureLayerAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.transformsAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.digitizeAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.lineDigitizeAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.settingsAction)
        self.iface.removePluginVectorMenu('Shape Tools', self.helpAction)
        # Remove from toolbar
        self.iface.removeToolBarIcon(self.createShapeToolbar)
        self.iface.removeToolBarIcon(self.xyLineAction)
        self.iface.removeToolBarIcon(self.geodesicDensifyAction)
        self.iface.removeToolBarIcon(self.simplifyToolbar)
        self.iface.removeToolBarIcon(self.geodesicLineBreakAction)
        self.iface.removeToolBarIcon(self.measureAction)
        self.iface.removeToolBarIcon(self.measureLayerAction)
        self.iface.removeToolBarIcon(self.transformationsAction)
        self.iface.removeToolBarIcon(self.digitizeAction)
        self.iface.removeToolBarIcon(self.lineDigitizeAction)
        self.iface.removeToolBarIcon(self.tranformToolbar)
        self.azDigitizerTool = None
        self.lineDigitizerTool = None
        # remove the toolbar
        del self.toolbar

        QgsApplication.processingRegistry().removeProvider(self.provider) 
Example #12
Source File: data_plotly.py    From DataPlotly with GNU General Public License v2.0 5 votes vote down vote up
def unload(self):
        """Removes the plugin menu item and icon from QGIS GUI."""
        self.show_dock_action.deleteLater()
        self.show_dock_action = None
        self.menu.deleteLater()
        self.menu = None
        self.toolbar.deleteLater()
        self.toolbar = None

        # Remove processing provider
        QgsApplication.processingRegistry().removeProvider(self.provider) 
Example #13
Source File: data_plotly.py    From DataPlotly with GNU General Public License v2.0 5 votes vote down vote up
def initProcessing(self):
        """Create the Processing provider"""
        QgsApplication.processingRegistry().addProvider(self.provider) 
Example #14
Source File: edgebundlingProviderPlugin.py    From qgis-edge-bundling with GNU General Public License v2.0 5 votes vote down vote up
def initGui(self):
        QgsApplication.processingRegistry().addProvider(self.provider) 
Example #15
Source File: Qneat3Plugin.py    From QNEAT3 with GNU General Public License v3.0 5 votes vote down vote up
def unload(self):
        QgsApplication.processingRegistry().removeProvider(self.provider) 
Example #16
Source File: Qneat3Plugin.py    From QNEAT3 with GNU General Public License v3.0 5 votes vote down vote up
def initGui(self):
        QgsApplication.processingRegistry().addProvider(self.provider) 
Example #17
Source File: ORStoolsPlugin.py    From orstools-qgis-plugin with MIT License 5 votes vote down vote up
def unload(self):
        """remove menu entry and toolbar icons"""
        QgsApplication.processingRegistry().removeProvider(self.provider)
        self.dialog.unload() 
Example #18
Source File: ORStoolsPlugin.py    From orstools-qgis-plugin with MIT License 5 votes vote down vote up
def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""

        QgsApplication.processingRegistry().addProvider(self.provider)
        self.dialog.initGui() 
Example #19
Source File: latLonTools.py    From qgis-latlontools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def unload(self):
        '''Unload LatLonTools from the QGIS interface'''
        self.zoomToDialog.removeMarker()
        self.multiZoomDialog.removeMarkers()
        if self.mapTool:
            self.canvas.unsetMapTool(self.mapTool)
        if self.showMapTool:
            self.canvas.unsetMapTool(self.showMapTool)
        self.iface.removePluginMenu('Lat Lon Tools', self.copyAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.copyCanvasAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.externMapAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.zoomToAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.multiZoomToAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.convertCoordinatesAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.conversionsAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.settingsAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.helpAction)
        self.iface.removePluginMenu('Lat Lon Tools', self.digitizeAction)
        self.iface.removeDockWidget(self.zoomToDialog)
        self.iface.removeDockWidget(self.multiZoomDialog)
        # Remove Toolbar Icons
        self.iface.removeToolBarIcon(self.copyAction)
        self.iface.removeToolBarIcon(self.copyCanvasAction)
        self.iface.removeToolBarIcon(self.zoomToAction)
        self.iface.removeToolBarIcon(self.externMapAction)
        self.iface.removeToolBarIcon(self.multiZoomToAction)
        self.iface.removeToolBarIcon(self.convertCoordinatesAction)
        self.iface.removeToolBarIcon(self.digitizeAction)
        del self.toolbar

        self.zoomToDialog = None
        self.multiZoomDialog = None
        self.settingsDialog = None
        self.showMapTool = None
        self.mapTool = None
        self.digitizerDialog = None
        self.convertCoordinateDialog = None
        QgsApplication.processingRegistry().removeProvider(self.provider) 
Example #20
Source File: dzetsaka.py    From dzetsaka with GNU General Public License v3.0 5 votes vote down vote up
def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""

        QgsApplication.processingRegistry().addProvider(self.provider)

        icon_path = ':/plugins/dzetsaka/img/icon.png'
        self.add_action(
            icon_path,
            text=self.tr(u'welcome message'),
            callback=self.showWelcomeWidget,
            add_to_toolbar=False,
            parent=self.iface.mainWindow())

        icon_path = ':/plugins/dzetsaka/img/icon.png'
        self.add_action(
            icon_path,
            text=self.tr(u'classification dock'),
            callback=self.run,
            parent=self.iface.mainWindow())

        icon_settings_path = ':/plugins/dzetsaka/img/dzetsaka_settings.png'
        self.add_action(
            icon_settings_path,
            text=self.tr(u'settings'),
            callback=self.loadSettings,
            add_to_toolbar=True,
            parent=self.iface.mainWindow())
        
        self.dockIcon = QAction(QIcon(':/plugins/dzetsaka/img/icon.png'), 'dzetsaka classification dock', self.iface.mainWindow())
        self.dockIcon.triggered.connect(self.run)
        self.iface.addToolBarIcon(self.dockIcon)
        self.actions.append(self.dockIcon)
        
        self.settingsIcon = QAction(QIcon(':/plugins/dzetsaka/img/dzetsaka_settings.png'), 'dzetsaka settings', self.iface.mainWindow())
        self.settingsIcon.triggered.connect(self.loadSettings)
        self.iface.addToolBarIcon(self.settingsIcon)
        self.actions.append(self.settingsIcon)
        
    # -------------------------------------------------------------------------- 
Example #21
Source File: edgebundlingProviderPlugin.py    From qgis-edge-bundling with GNU General Public License v2.0 5 votes vote down vote up
def unload(self):
        QgsApplication.processingRegistry().removeProvider(self.provider) 
Example #22
Source File: dzetsaka.py    From dzetsaka with GNU General Public License v3.0 4 votes vote down vote up
def saveSettings(self):
        """!@brief save settings if modifications"""
        # Change classifier
        if self.sender() == self.settingsdock.selectClassifier:
            if self.settingsdock.selectClassifier.currentText() != 'Gaussian Mixture Model':
                # try if Sklearn is installed, or force GMM
                try:
                    from sklearn import metrics
                    if self.classifier != self.settingsdock.selectClassifier.currentText():
                        # self.modifyConfig('Classification','classifier',self.settingsdock.selectClassifier.currentText())
                        self.settings.setValue(
                            '/dzetsaka/classifier',
                            self.settingsdock.selectClassifier.currentText())
                except BaseException:
                    QMessageBox.warning(
                        self,
                        'Library missing',
                        'Scikit-learn library is missing on your computer.<br><br> You must use Gaussian Mixture Model, or <a href=\'https://github.com/lennepkade/dzetsaka/#installation-of-scikit-learn\'>consult dzetsaka homepage to learn on to install the missing library</a>.',
                        QMessageBox.Ok)
                    # reset to GMM
                    self.settingsdock.selectClassifier.setCurrentIndex(0)
                    #self.modifyConfig('Classification','classifier','Gaussian Mixture Model')
                    self.settings.setValue(
                        '/dzetsaka/classifier', 'Gaussian Mixture Model')
            else:
                #self.modifyConfig('Classification','classifier','Gaussian Mixture Model')
                self.settings.setValue(
                    '/dzetsaka/classifier',
                    'Gaussian Mixture Model')

        if self.sender() == self.settingsdock.classSuffix:
            if self.classSuffix != self.settingsdock.classSuffix.text():
                # self.modifyConfig('Classification','suffix',self.settingsdock.classSuffix.text())
                self.settings.setValue(
                    '/dzetsaka/classSuffix',
                    self.settingsdock.classSuffix.text())
        if self.sender() == self.settingsdock.classPrefix:
            if self.classPrefix != self.settingsdock.classPrefix.text():
                # self.modifyConfig('Classification','prefix',self.settingsdock.classPrefix.text())
                self.settings.setValue(
                    '/dzetsaka/classPrefix',
                    self.settingsdock.classPrefix.text())
        if self.sender() == self.settingsdock.maskSuffix:
            if self.maskSuffix != self.settingsdock.maskSuffix.text():
                # self.modifyConfig('Classification','maskSuffix',self.settingsdock.maskSuffix.text())
                self.settings.setValue(
                    '/dzetsaka/maskSuffix',
                    self.settingsdock.maskSuffix.text())
        if self.sender() == self.settingsdock.selectProviders:
            self.providerType = self.settingsdock.selectProviders.currentText()

            # self.modifyConfig('Providers','provider',self.settingsdock.selectProviders.currentText())
            self.settings.setValue(
                '/dzetsaka/providerType',
                self.settingsdock.selectProviders.currentText())
            QgsApplication.processingRegistry().removeProvider(self.provider)

            from .dzetsaka_provider import dzetsakaProvider
            self.provider = dzetsakaProvider(self.providerType)
            QgsApplication.processingRegistry().addProvider(self.provider)