Python qgis.PyQt.QtWidgets.QAction() Examples

The following are 19 code examples of qgis.PyQt.QtWidgets.QAction(). 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.PyQt.QtWidgets , or try the search function .
Example #1
Source File: QgsFmv.py    From QGISFMV with GNU General Public License v3.0 6 votes vote down vote up
def initGui(self):
        ''' FMV Action '''
        self.actionFMV = QAction(QIcon(":/imgFMV/images/icon.png"),
                                 u"FMV", self.iface.mainWindow(),
                                 triggered=self.run)

        self.iface.registerMainWindowAction(
            self.actionFMV, qgsu.SetShortcutForPluginFMV(u"FMV"))
        self.iface.addToolBarIcon(self.actionFMV)
        self.iface.addPluginToMenu(QCoreApplication.translate(
            "QgsFmv", "Full Motion Video (FMV)"), self.actionFMV)

        ''' About Action '''
        self.actionAbout = QAction(QIcon(":/imgFMV/images/Information.png"),
                                   u"FMV About", self.iface.mainWindow(),
                                   triggered=self.About)
        self.iface.registerMainWindowAction(
            self.actionAbout, qgsu.SetShortcutForPluginFMV(u"FMV About", "Alt+A"))
        self.iface.addPluginToMenu(QCoreApplication.translate(
            "QgsFmv", "Full Motion Video (FMV)"), self.actionAbout) 
Example #2
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 #3
Source File: dsgRasterInfoTool.py    From DsgTools with GNU General Public License v2.0 6 votes vote down vote up
def stretch_raster(self):
        try:
            formerLayer = self.iface.activeLayer()
            layer = self.rasterComboBox.currentLayer()
            # keep track of current tool status
            assignValueStatus = self.valueSetterButton.isChecked()
            self.iface.setActiveLayer(layer)
            self.iface.mainWindow().findChild( QAction, 'mActionLocalCumulativeCutStretch' ).trigger()
            self.iface.setActiveLayer(formerLayer)
            # make sure it still be on, if necessary
            if assignValueStatus:
                self.valueSetterButton.setChecked(assignValueStatus)
        except AttributeError:
            pass

    # @pyqtSlot(bool, name = 'on_valueSetterButton_toggled') 
Example #4
Source File: ee_plugin.py    From qgis-earthengine-plugin with MIT License 5 votes vote down vote up
def initGui(self):
        ### Main dockwidget menu
        # Create action that will start plugin configuration
        icon_path = ':/plugins/ee_plugin/icons/earth_engine.svg'
        self.dockable_action = QAction(
            QIcon(icon_path), "User Guide", self.iface.mainWindow())
        # connect the action to the run method
        self.dockable_action.triggered.connect(self.run)
        # Add menu item
        self.iface.addPluginToMenu(self.menu_name_plugin, self.dockable_action)
        # Register signal to initialize EE layers on project load
        self.iface.projectRead.connect(self.updateLayers) 
Example #5
Source File: mainPlugin.py    From PyRAT with Mozilla Public License 2.0 5 votes vote down vote up
def addMenuEntry(self, pyratTool):
        """Adds a PyRAT Tool to the QGIS-Menu"""
        menus = pyratTool.gui['menu'].split('|')
        submenu = self.pyratMenu
        for menu in menus:
            if menu not in [action.text() for action in submenu.actions()]:
                submenu = submenu.addMenu(menu)
            else:
                submenu = [action.menu() for action in submenu.actions() if
                           action.text() == menu][0]

        action = QAction(pyratTool.gui['entry'], iface.mainWindow())
        action.triggered.connect(lambda:
                                 PyRATBridge.menuAction(self, pyratTool))
        submenu.addAction(action) 
Example #6
Source File: data_sources_list.py    From quickmapservices with GNU General Public License v2.0 5 votes vote down vote up
def _fill_data_sources_list(self):
        self.data_sources = {}
        for ds_path in self.ds_paths:
            for root, dirs, files in os.walk(ds_path):
                for ini_file in [f for f in files if f.endswith('.ini')]:
                    try:
                        ini_full_path = os.path.join(root, ini_file)
                        ds = DataSourceSerializer.read_from_ini(ini_full_path)

                        # set contrib&user
                        if ds_path in ROOT_MAPPING.keys():
                            ds.category = ROOT_MAPPING[ds_path]
                        else:
                            ds.category = DataSourceCategory.USER

                        # action
                        ds.action = QAction(QIcon(ds.icon_path), self.tr(ds.alias), None)
                        ds.action.setData(ds)

                        # append to array
                        self.data_sources[ds.id] = ds

                    except Exception as e:
                        error_message = 'INI file can\'t be parsed: ' + e.message
                        QgsMessageLog.logMessage(error_message, level=QgsMessageLog.CRITICAL)

    # noinspection PyMethodMayBeStatic 
Example #7
Source File: quick_map_services.py    From quickmapservices with GNU General Public License v2.0 5 votes vote down vote up
def append_menu_buttons(self):
        """
        Append menus and buttons to appropriate toolbar
        :return:
        """
        # add to QGIS menu
        if PluginSettings.move_to_layers_menu():
            self.iface.addLayerMenu().addMenu(self.menu)
        else:
            # need workaround for WebMenu
            _temp_act = QAction('temp', self.iface.mainWindow())
            self.iface.addPluginToWebMenu("_tmp", _temp_act)
            self.iface.webMenu().addMenu(self.menu)
            self.iface.removePluginWebMenu("_tmp", _temp_act)

        # add to QGIS toolbar
        toolbutton = QToolButton()
        toolbutton.setPopupMode(QToolButton.InstantPopup)
        toolbutton.setMenu(self.menu)
        toolbutton.setIcon(self.menu.icon())
        toolbutton.setText(self.menu.title())
        toolbutton.setToolTip(self.menu.title())
        # self.tb_action = toolbutton.defaultAction()
        # print "self.tb_action: ", self.tb_action
        if PluginSettings.move_to_layers_menu():
            self.tb_action = self.iface.layerToolBar().addWidget(toolbutton)
            self.iface.layerToolBar().addAction(self.qms_search_action)
        else:
            self.tb_action = self.iface.webToolBar().addWidget(toolbutton)
            self.iface.webToolBar().addAction(self.qms_search_action) 
Example #8
Source File: dsgRasterInfoTool.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def add_action(self, icon_path, text, callback, parent=None):
        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        if parent:
            parent.addAction(action)
        return action 
Example #9
Source File: minimumAreaTool.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def add_action(self, icon_path, text, callback, parent=None):
        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        if parent:
            parent.addAction(action)
        return action 
Example #10
Source File: inspectFeatures.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def add_action(self, icon_path, text, callback, parent=None):
        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        if parent:
            parent.addAction(action)
        return action 
Example #11
Source File: d3datavis.py    From qgis-d3datavis-plugin with GNU General Public License v2.0 5 votes vote down vote up
def initGui(self):
        """ Initialize the menu and dialog boxes for the D3 heatmap chart """
        icon = QIcon(os.path.dirname(__file__) + "/icon.png")
        self.heatmapAction = QAction(icon, "Circular Date/Time Heatmap", self.iface.mainWindow())
        self.heatmapAction.triggered.connect(self.showHeatmapDialog)
        self.heatmapAction.setCheckable(False)
        self.iface.addWebToolBarIcon(self.heatmapAction)
        # Add a D3 Data Visualization menu item to the Web menu
        self.iface.addPluginToWebMenu("D3 Data Visualization", self.heatmapAction) 
Example #12
Source File: searchLayers.py    From qgis-searchlayers-plugin with GNU General Public License v2.0 5 votes vote down vote up
def initGui(self):
        # Create the menu items in the Plugin menu and attach the icon to the toolbar
        icon = QIcon(os.path.dirname(__file__) + "/icon.png")
        self.searchAction = QAction(icon, "Search Layers", self.iface.mainWindow())
        self.searchAction.setObjectName('searchLayers')
        self.searchAction.triggered.connect(self.showSearchDialog)
        self.iface.addToolBarIcon(self.searchAction)
        self.iface.addPluginToMenu("Search Layers", self.searchAction)

        # Help
        icon = QIcon(os.path.dirname(__file__) + '/help.png')
        self.helpAction = QAction(icon, "Help", self.iface.mainWindow())
        self.helpAction.setObjectName('searchLayersHelp')
        self.helpAction.triggered.connect(self.help)
        self.iface.addPluginToMenu('Search Layers', self.helpAction) 
Example #13
Source File: data_plotly.py    From DataPlotly 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.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(message_bar=self.iface.messageBar())
        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) 
Example #14
Source File: project_configuration_dialog.py    From qfieldsync with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, iface, parent=None):
        """Constructor."""
        super(ProjectConfigurationDialog, self).__init__(parent=parent)
        self.iface = iface

        self.accepted.connect(self.onAccepted)
        self.project = QgsProject.instance()
        self.__project_configuration = ProjectConfiguration(self.project)

        self.setupUi(self)
        self.multipleToggleButton.setIcon(QIcon(os.path.join(os.path.dirname(__file__), '../resources/visibility.svg')))

        self.toggle_menu = QMenu(self)
        self.remove_all_action = QAction(self.tr("remove all layers"), self.toggle_menu)
        self.toggle_menu.addAction(self.remove_all_action)
        self.remove_hidden_action = QAction(self.tr("remove hidden layers"), self.toggle_menu)
        self.toggle_menu.addAction(self.remove_hidden_action)
        self.add_all_copy_action = QAction(self.tr("add all layers"), self.toggle_menu)
        self.toggle_menu.addAction(self.add_all_copy_action)
        self.add_visible_copy_action = QAction(self.tr("add visible layers"), self.toggle_menu)
        self.toggle_menu.addAction(self.add_visible_copy_action)
        self.add_all_offline_action = QAction(self.tr("add all vector layers as offline"), self.toggle_menu)
        self.toggle_menu.addAction(self.add_all_offline_action)
        self.add_visible_offline_action = QAction(self.tr("add visible vector layers as offline"), self.toggle_menu)
        self.toggle_menu.addAction(self.add_visible_offline_action)
        self.multipleToggleButton.setMenu(self.toggle_menu)
        self.multipleToggleButton.setAutoRaise(True)
        self.multipleToggleButton.setPopupMode(QToolButton.InstantPopup)
        self.toggle_menu.triggered.connect(self.toggle_menu_triggered)

        self.singleLayerRadioButton.toggled.connect(self.baseMapTypeChanged)
        self.unsupportedLayersList = list()

        self.reloadProject() 
Example #15
Source File: bulkNominatim.py    From qgis-bulk-nominatim with GNU General Public License v2.0 5 votes vote down vote up
def initGui(self):
        """Initialize BulkNominatim GUI."""
        # Initialize the Dialog Boxes
        self.settingsDialog = SettingsWidget(self.iface.mainWindow())
        self.reverseGeocodeTool = ReverseGeocodeTool(self.iface, self.settingsDialog)
        self.bulkNominatimDialog = BulkNominatimDialog(self.iface, self.iface.mainWindow(), self.settingsDialog)

        self.canvas.mapToolSet.connect(self.unsetTool)
        
        # Initialize the bulk nominatim dialog box
        icon = QIcon(os.path.dirname(__file__) + "/images/icon.png")
        self.nominatimAction = QAction(icon, u"Bulk GeoCoding", self.iface.mainWindow())
        self.nominatimAction.triggered.connect(self.nominatimTool)
        self.iface.addToolBarIcon(self.nominatimAction)
        self.iface.addPluginToMenu(u"Nominatim GeoCoding", self.nominatimAction)
        
        # Add Interface for Reverse GeoCoding
        icon = QIcon(os.path.dirname(__file__) + "/images/reverse.png")
        self.reverseGeocodeAction = QAction(icon, u"Reverse Point GeoCoding", self.iface.mainWindow())
        self.reverseGeocodeAction.triggered.connect(self.setReverseGeocodeTool)
        self.reverseGeocodeAction.setCheckable(True)
        self.iface.addToolBarIcon(self.reverseGeocodeAction)
        self.iface.addPluginToMenu(u"Nominatim GeoCoding", self.reverseGeocodeAction)


        # Initialize the Settings Menu
        settingsicon = QIcon(os.path.dirname(__file__) + '/images/settings.png')
        self.settingsAction = QAction(settingsicon, u"Settings", self.iface.mainWindow())
        self.settingsAction.triggered.connect(self.settings)
        self.iface.addPluginToMenu(u"Nominatim GeoCoding", self.settingsAction)

        # Help
        helpicon = QIcon(os.path.dirname(__file__) + '/images/help.png')
        self.helpAction = QAction(helpicon, u"Help", self.iface.mainWindow())
        self.helpAction.triggered.connect(self.help)
        self.iface.addPluginToMenu(u"Nominatim GeoCoding", self.helpAction) 
Example #16
Source File: opeNoise.py    From openoise-map with GNU General Public License v3.0 4 votes vote down vote up
def initGui(self):
        
        # opeNoise         
        self.opeNoise_menu = QMenu(QCoreApplication.translate("opeNoise", "&opeNoise"))
        self.opeNoise_menu.setIcon(QIcon(":/plugins/opeNoise/icons/icon_opeNoise.png"))

        # CreateReceiverPoints
        # self.CreateReceiverPoints_item = QAction(QIcon(":/plugins/opeNoise/icons/icon_CreateReceiverPoints.png"),
        #                                 QCoreApplication.translate("opeNoise", self.tr("Create Receiver Points")), self.iface.mainWindow())
        self.CreateReceiverPoints_item = QAction(QIcon(":/plugins/opeNoise/icons/icon_CreateReceiverPoints.png"),
                                                                            self.tr("Create Receiver Points"),
                                                 self.iface.mainWindow())

        self.CreateReceiverPoints_item.triggered.connect(self.CreateReceiverPoints_show)

        # CalculateNoiseLevels
        self.CalculateNoiseLevels_item = QAction(QIcon(":/plugins/opeNoise/icons/icon_CalculateNoiseLevels.png"),
                                        self.tr("Calculate Noise Levels"), self.iface.mainWindow())
        self.CalculateNoiseLevels_item.triggered.connect(self.CalculateNoiseLevels_show)

        # AssignLevelsToBuildings
        self.AssignLevelsToBuildings_item = QAction(QIcon(":/plugins/opeNoise/icons/icon_AssignLevelsToBuildings.png"),
                                        self.tr("Assign Levels To Buildings"), self.iface.mainWindow())
        self.AssignLevelsToBuildings_item.triggered.connect(self.AssignLevelsToBuildings_show)
        
        # AssignLevelsToBuildings
        self.ApplyNoiseSymbology_item = QAction(QIcon(":/plugins/opeNoise/icons/icon_ApplyNoiseSymbology.png"),
                                        QCoreApplication.translate("opeNoise", "Apply Noise Symbology"), self.iface.mainWindow())
        self.ApplyNoiseSymbology_item.triggered.connect(self.ApplyNoiseSymbology_show)
        
        # Information
        self.Informations_item = QAction(QIcon(":/plugins/opeNoise/icons/icon_Informations.png"),
                                        QCoreApplication.translate("opeNoise", "Information"), self.iface.mainWindow())
        self.Informations_item.triggered.connect(self.Informations_show)

        # Credits
        self.Credits_item = QAction(QIcon(":/plugins/opeNoise/icons/icon_Credits.png"),
                                        QCoreApplication.translate("opeNoise", "Credits"), self.iface.mainWindow())
        self.Credits_item.triggered.connect(self.Credits_show)  
        
        # add items
        self.opeNoise_menu.addActions([self.CreateReceiverPoints_item, 
                                       self.CalculateNoiseLevels_item,
                                       self.AssignLevelsToBuildings_item, 
                                       self.ApplyNoiseSymbology_item, 
                                       self.Informations_item,
                                       self.Credits_item])
        
        self.menu = self.iface.pluginMenu()
        self.menu.addMenu( self.opeNoise_menu ) 
Example #17
Source File: mainPlugin.py    From PyRAT with Mozilla Public License 2.0 4 votes vote down vote up
def initGui(self):
        """Initalise the Plugin-UI"""
        if not pyratImport:
            iface.messageBar().pushMessage("PyRAT not found!",
                                           level=Qgis.Critical)
            return

        if 'PyRAT' not in [action.text() for action in
                           iface.mainWindow().menuBar().actions()]:
            self.pyratMenu = iface.mainWindow().menuBar().addMenu('PyRAT')
        else:
            self.pyratMenu = [action.menu() for action in
                              iface.mainWindow().menuBar().actions() if
                              action.text() == 'PyRAT'][0]

        action = QAction("Layer2PyRAT", iface.mainWindow())
        action.triggered.connect(PyRATBridge.layerToPyrat)
        self.pyratMenu.addAction(action)

        action = QAction("PyRAT2Layer", iface.mainWindow())
        action.triggered.connect(PyRATBridge.pyratToLayer)
        self.pyratMenu.addAction(action)

        action = QAction("Cleanup PyRAT", iface.mainWindow())
        action.triggered.connect(PyRATBridge.clearPyRAT)
        self.pyratMenu.addAction(action)

        action = QAction("Show PyRAT GUI", iface.mainWindow())
        action.triggered.connect(self.showPyrat)
        self.pyratMenu.addAction(action)

        self.pyratMenu.addSeparator()

        # Init PyRAT-Tools, adapted from pyrat.viewer for qgis
        from inspect import getmembers, isclass

        modules = [pyrat.load, pyrat.save, pyrat.transform, pyrat.filter,
                   pyrat.polar, pyrat.insar, pyrat.plugins, pyrat.viewer]

        for current_module in modules:
            modules = getmembers(current_module, isclass)
            for mod in modules:
                if issubclass(mod[1], pyrat.Worker):
                    plugin = mod[1]
                    if(hasattr(plugin, 'gui') and
                       plugin.gui['entry'] != "Python console"):
                        self.addMenuEntry(plugin)

        self.pyratLayerTree = QDockWidget("PyRAT Layers", iface.mainWindow())
        PyRATBridge.layerTreeWidget = LayerTreeWidget(
                parent=self.pyratLayerTree,
                viewer=ViewerToQGISInterface)
        self.pyratLayerTree.setObjectName("PyRAT Layers")
        self.pyratLayerTree.setWidget(PyRATBridge.layerTreeWidget)
        iface.addDockWidget(Qt.LeftDockWidgetArea, self.pyratLayerTree) 
Example #18
Source File: quick_map_services.py    From quickmapservices with GNU General Public License v2.0 4 votes vote down vote up
def build_menu_tree(self):
        # Main Menu
        self.menu.clear()

        self.groups_list = GroupsList()
        self.ds_list = DataSourcesList()

        data_sources = self.ds_list.data_sources.values()
        data_sources = sorted(data_sources, key=lambda x: x.alias or x.id)

        ds_hide_list = PluginSettings.get_hide_ds_id_list()

        for ds in data_sources:
            if ds.id in ds_hide_list:
                continue
            ds.action.triggered.connect(self.insert_layer)
            gr_menu = self.groups_list.get_group_menu(ds.group)
            gr_menu.addAction(ds.action)
            if gr_menu not in self.menu.children():
                self.menu.addMenu(gr_menu)

        # QMS web service
        self.menu.addSeparator()

        self.service_actions.append(self.qms_search_action)
        self.menu.addAction(self.qms_search_action)

        icon_create_service_path = self.plugin_dir + '/icons/mActionCreate.svg'
        qms_create_service_action = QAction(self.tr('Add to Search'), self.iface.mainWindow())
        qms_create_service_action.setIcon(QIcon(icon_create_service_path))
        qms_create_service_action.triggered.connect(self.openURL)
        self.menu.addAction(qms_create_service_action)

        # Scales, Settings and About actions
        self.menu.addSeparator()
        icon_set_nearest_scale_path = self.plugin_dir + '/icons/mActionSettings.svg'  # TODO change icon
        set_nearest_scale_act = QAction(QIcon(icon_set_nearest_scale_path), self.tr('Set proper scale'), self.iface.mainWindow())
        set_nearest_scale_act.triggered.connect(self.set_nearest_scale)
        self.menu.addAction(set_nearest_scale_act)  # TODO: uncomment after fix
        self.service_actions.append(set_nearest_scale_act)

        icon_scales_path = self.plugin_dir + '/icons/mActionSettings.svg'  # TODO change icon
        scales_act = QAction(QIcon(icon_scales_path), self.tr('Set SlippyMap scales'), self.iface.mainWindow())
        scales_act.triggered.connect(self.set_tms_scales)
        #self.menu.addAction(scales_act)  # TODO: uncomment after fix
        self.service_actions.append(scales_act)

        icon_settings_path = self.plugin_dir + '/icons/mActionSettings.svg'
        settings_act = QAction(QIcon(icon_settings_path), self.tr('Settings'), self.iface.mainWindow())
        self.service_actions.append(settings_act)
        settings_act.triggered.connect(self.show_settings_dialog)
        self.menu.addAction(settings_act)

        icon_about_path = self.plugin_dir + '/icons/mActionAbout.svg'
        info_act = QAction(QIcon(icon_about_path), self.tr('About'), self.iface.mainWindow())
        self.service_actions.append(info_act)
        info_act.triggered.connect(self.info_dlg.show)
        self.menu.addAction(info_act) 
Example #19
Source File: mapillary_explorer.py    From go2mapillary with GNU General Public License v3.0 4 votes vote down vote up
def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""
        icon_path = os.path.join(self.plugin_dir,'res','icon.png')
        self.mainAction = self.add_action(
            icon_path,
            text=self.tr(u'go2mapillary'),
            callback=self.run,
            checkable=True,
            parent=self.iface.mainWindow())

        self.dlg = go2mapillaryDockWidget()

        self.dockwidget=QDockWidget("go2mapillary" , self.iface.mainWindow() )
        self.dockwidget.setObjectName("go2mapillary")
        self.dockwidget.setWidget(self.dlg)
        self.dockwidget.visibilityChanged.connect(self.mlyDockwidgetvisibilityChanged)
        self.dlg.webView.page().setNetworkAccessManager(QgsNetworkAccessManager.instance())
        self.dlg.webView.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
        self.dlg.webView.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
        self.canvas.mapToolSet.connect(self.toggleViewer)
        self.viewer = mapillaryViewer(self)
        self.viewer.messageArrived.connect(self.viewerConnection)
        self.viewer.openFilter.connect(self.filter_images_func)
        #QgsExpressionContextUtils.setGlobalVariable( "mapillaryCurrentKey","noKey")
        QgsExpressionContextUtils.removeGlobalVariable("mapillaryCurrentKey")
        self.mapSelectionTool = None
        self.coverage = mapillary_coverage(self)
        self.filterDialog = mapillaryFilter(self)
        self.filterAction_images = QAction(QIcon(icon_path), 'filter mapillary coverage', self.iface.mainWindow())
        self.filterAction_sequences = QAction(QIcon(icon_path), 'filter mapillary coverage', self.iface.mainWindow())
        self.filterAction_overview = QAction(QIcon(icon_path), 'filter mapillary coverage', self.iface.mainWindow())
        self.filterAction_images.triggered.connect(self.filter_images_func)
        self.filterAction_sequences.triggered.connect(self.filter_sequences_func)
        self.filterAction_overview.triggered.connect(self.filter_overview_func)
        self.sample_cursor = mapillary_cursor(self)
        self.sample_settings = mapillarySettings(self)
        self.sample_cursor.update_ds(self.sample_settings.settings['sample_source'])
        self.samples_form = mapillaryForm(self)
        self.iface.projectRead.connect(self.removeMapillaryLayerGroup)
        self.canvas.mapCanvasRefreshed.connect(self.mapRefreshed)
        self.enableMapillaryRender = False


    #--------------------------------------------------------------------------