def initGui(self): self.action = QAction( QIcon(os.path.join(pluginPath, "plugin.png")), "Start testing", self.iface.mainWindow()) self.action.triggered.connect(self.test) self.iface.addPluginToMenu("Tester", self.action) addHelpMenu("Tester", self.iface.addPluginToMenu) addAboutMenu("Tester", self.iface.addPluginToMenu)
def initGui(self): self.dockWidget = getConnectDockWidget() self.iface.addDockWidget(Qt.RightDockWidgetArea, self.dockWidget) self.dockWidget.hide() utils.setRepositoryUrl() self.actionRunWizard = self.dockWidget.toggleViewAction() self.actionRunWizard.setText('Boundless Connect') self.actionRunWizard.setIcon( QIcon(os.path.join(pluginPath, 'icons', 'connect.svg'))) self.actionRunWizard.setWhatsThis('Boundless Connect') self.actionRunWizard.setObjectName('actionRunWizard') # If Boundless repository is a directory, add menu entry # to start modified Plugin Manager which works with local repositories if utils.isRepositoryInDirectory(): self.actionPluginManager = QAction( 'Manage plugins (local folder)', self.iface.mainWindow()) self.actionPluginManager.setIcon( QIcon(os.path.join(pluginPath, 'icons', 'plugin.svg'))) self.actionPluginManager.setWhatsThis( 'Manage and install plugins from local repository') self.actionPluginManager.setObjectName('actionPluginManager') self.iface.addPluginToMenu( 'Boundless Connect', self.actionPluginManager) self.actionPluginManager.triggered.connect(self.pluginManagerLocal) actions = self.iface.mainWindow().menuBar().actions() for action in actions: if action.menu().objectName() == 'mPluginMenu': menuPlugin = action.menu() separator = menuPlugin.actions()[1] menuPlugin.insertAction(separator, self.actionRunWizard) if utils.isRepositoryInDirectory(): menuPlugin.insertAction(separator, self.actionPluginManager) addSettingsMenu('Boundless Connect') addHelpMenu('Boundless Connect') addAboutMenu('Boundless Connect') # Enable check for updates if it is not enabled utils.addCheckForUpdates() try: from lessons import addLessonsFolder, addGroup folder = os.path.join(os.path.dirname(__file__), "_lessons") addLessonsFolder(folder, "boundlessconnect") group_description = os.path.join(folder, "group.md") addGroup("Boundless Connect plugin", group_description) except: pass
def initGui(self): readTrackedLayers() QgsMapLayerRegistry.instance().layerWasAdded.connect(trackLayer) QgsMapLayerRegistry.instance().layerRemoved.connect(layerRemoved) icon = QIcon(os.path.dirname(__file__) + "/ui/resources/geogig.png") self.explorerAction = navigatorInstance.toggleViewAction() self.explorerAction.setIcon(icon) self.explorerAction.setText("GeoGig Navigator") icon = QIcon(os.path.dirname(__file__) + "/ui/resources/identify.png") self.toolAction = QAction(icon, "GeoGig Feature Info Tool", self.iface.mainWindow()) self.toolAction.setCheckable(True) self.toolAction.triggered.connect(self.setTool) self.menu = QMenu(self.iface.mainWindow()) self.menu.setTitle("GeoGig") self.menu.addAction(self.explorerAction) self.menu.addAction(self.toolAction) bar = self.iface.layerToolBar() self.toolButton = QToolButton() self.toolButton.setMenu(self.menu) self.toolButton.setPopupMode(QToolButton.MenuButtonPopup) self.toolButton.setDefaultAction(self.explorerAction) bar.addWidget(self.toolButton) self.iface.addPluginToMenu("&GeoGig", self.explorerAction) self.iface.addPluginToMenu("&GeoGig", self.toolAction) addSettingsMenu("GeoGig") addHelpMenu("GeoGig") addAboutMenu("GeoGig") self.mapTool = MapToolGeoGigInfo(self.iface.mapCanvas()) #This crashes QGIS, so we comment it out until finding a solution #self.mapTool.setAction(self.toolAction) self.iface.addDockWidget(Qt.RightDockWidgetArea, navigatorInstance) try: from lessons import addLessonsFolder, addGroup folder = os.path.join(os.path.dirname(__file__), "_lessons") addLessonsFolder(folder, "geogig") group_description = os.path.join(folder, "group.md") addGroup("GeoGig lessons", group_description) except Exception as e: pass
def initGui(self): icon = QIcon(os.path.dirname(__file__) + "/images/geoserver.png") self.explorerAction = QAction(icon, "GeoServer Explorer", self.iface.mainWindow()) self.explorerAction.triggered.connect(self.openExplorer) self.iface.addPluginToWebMenu(u"GeoServer", self.explorerAction) self.explorer = GeoServerExplorer() self.iface.addDockWidget(Qt.RightDockWidgetArea, self.explorer) if not pluginSetting("ExplorerVisible"): self.explorer.hide() self.explorer.visibilityChanged.connect(self._explorerVisibilityChanged) addSettingsMenu("GeoServer", self.iface.addPluginToWebMenu) addHelpMenu("GeoServer", self.iface.addPluginToWebMenu) addAboutMenu("GeoServer", self.iface.addPluginToWebMenu) layerwatcher.connectLayerWasAdded(self.explorer)
def initGui(self): lessonIcon = QIcon(os.path.dirname(__file__) + "/lesson.gif") self.action = QAction(lessonIcon, "Open Lessons Library...", self.iface.mainWindow()) self.action.triggered.connect(self.start) self.iface.addPluginToMenu("Lessons", self.action) addSettingsMenu("Lessons") addHelpMenu("Lessons") addAboutMenu("Lessons") self.lessonwidget = None hasErrors = lessons.loadLessons() if hasErrors: QMessageBox.warning(self.iface.mainWindow(), "Lessons", "Some lessons were not loaded. Check QGIS log for more details")
def initGui(self): icon_path = ':/plugins/planet_explorer/planet-logo-p.svg' self.toolbar = self.iface.addToolBar(P_E) self.toolbar.setObjectName(P_E) self.add_action(icon_path, text=self.tr(P_E), callback=self.run, add_to_menu=True, add_to_toolbar=True, parent=self.iface.mainWindow()) addSettingsMenu(P_E, self.iface.addPluginToWebMenu) # addHelpMenu(P_E, self.iface.addPluginToWebMenu) addAboutMenu(P_E, self.iface.addPluginToWebMenu) # Register helper function for dealing with PlanetLabs catalog # metadata # registerFunctions() # noinspection PyBroadException # try: # from lessons import addLessonsFolder, addGroup # folder = os.path.join(os.path.dirname(__file__), "_lessons") # addLessonsFolder(folder, "imagediscovery") # group_description = os.path.join(folder, "group.md") # addGroup("Planet Explorer plugin", group_description) # except: # pass self.run() last_shown = bool( pluginSetting(DOCK_SHOWN_STATE, namespace=SETTINGS_NAMESPACE, typ='bool')) if self.dock_widget is not None: self.dock_widget.setVisible(last_shown) self.provider = MosaicLayerWidgetProvider() QgsGui.layerTreeEmbeddedWidgetRegistry().addProvider(self.provider) QgsProject.instance().projectSaved.connect(self.project_saved) PlanetClient.getInstance().loginChanged.connect(replace_apikeys)
def initGui(self): # Load Images GUI things Manually loadImagesManIcon = QIcon( os.path.join(os.path.dirname(__file__), "icons", "addgtiff.png")) self.loadImagesManAction = QAction(loadImagesManIcon, "Load Geotiff Images Manually.", self.iface.mainWindow()) self.loadImagesManAction.triggered.connect(self.manualSetTool) self.iface.addToolBarIcon(self.loadImagesManAction) self.iface.addPluginToMenu("geotiffloader", self.loadImagesManAction) # Load Images GUI things Continuosly loadImagesIcon = QIcon( os.path.join(os.path.dirname(__file__), "icons", "play.png")) self.loadImagesAction = QAction( loadImagesIcon, "Start Loading Geotiff Images Continuosly.", self.iface.mainWindow()) self.loadImagesAction.triggered.connect(self.setTool) self.iface.addToolBarIcon(self.loadImagesAction) self.iface.addPluginToMenu("geotiffloader", self.loadImagesAction) # Stop Loading Images GUI things stopLoadImagesIcon = QIcon( os.path.join(os.path.dirname(__file__), "icons", "stop.png")) self.stopLoadImagesAction = QAction( stopLoadImagesIcon, "Stop Loading Geotiff Images Continuosly.", self.iface.mainWindow()) self.stopLoadImagesAction.triggered.connect(self.stopAddingNewImages) self.iface.addToolBarIcon(self.stopLoadImagesAction) self.iface.addPluginToMenu("geotiffloader", self.stopLoadImagesAction) # Remove Images GUI Things removeImagesIcon = QIcon( os.path.join(os.path.dirname(__file__), "icons", "removegtiff.png")) self.removeImagesAction = QAction(removeImagesIcon, "Remove Geotiff Images.", self.iface.mainWindow()) self.removeImagesAction.triggered.connect(self.unsetTool) self.iface.addToolBarIcon(self.removeImagesAction) self.iface.addPluginToMenu("geotiffloader", self.removeImagesAction) addSettingsMenu("geotiffloader", self.iface.addPluginToMenu) addHelpMenu("geotiffloader", self.iface.addPluginToMenu) addAboutMenu("geotiffloader", self.iface.addPluginToMenu)
def initGui(self): icon = QIcon(os.path.dirname(__file__) + "/images/geoserver.png") self.explorerAction = QAction(icon, "GeoServer Explorer", self.iface.mainWindow()) self.explorerAction.triggered.connect(self.openExplorer) self.iface.addPluginToWebMenu(u"GeoServer", self.explorerAction) self.explorer = GeoServerExplorer() self.iface.addDockWidget(Qt.RightDockWidgetArea, self.explorer) if not pluginSetting("ExplorerVisible"): self.explorer.hide() self.explorer.visibilityChanged.connect( self._explorerVisibilityChanged) addSettingsMenu("GeoServer", self.iface.addPluginToWebMenu) addHelpMenu("GeoServer", self.iface.addPluginToWebMenu) addAboutMenu("GeoServer", self.iface.addPluginToWebMenu) layerwatcher.connectLayerWasAdded(self.explorer)
def initGui(self): lessonIcon = QIcon(os.path.dirname(__file__) + "/lesson.gif") self.action = QAction(lessonIcon, "Open Lessons Library...", self.iface.mainWindow()) self.action.triggered.connect(self.start) self.iface.addPluginToMenu("Lessons", self.action) addSettingsMenu("Lessons") addHelpMenu("Lessons") addAboutMenu("Lessons") self.lessonwidget = None hasErrors = lessons.loadLessons() if hasErrors: QMessageBox.warning( self.iface.mainWindow(), "Lessons", "Some lessons were not loaded. Check QGIS log for more details" )
def initGui(self): mapToolIcon = QIcon(os.path.join(os.path.dirname(__file__), "icons", "w3w.png")) self.toolAction = QAction(mapToolIcon, "what3words map tool", self.iface.mainWindow()) self.toolAction.triggered.connect(self.setTool) self.toolAction.setCheckable(True) self.iface.addToolBarIcon(self.toolAction) self.iface.addPluginToMenu("what3words", self.toolAction) zoomToIcon = QIcon(':/images/themes/default/mActionZoomIn.svg') self.zoomToAction = QAction(zoomToIcon, "Zoom to 3 word address", self.iface.mainWindow()) self.zoomToAction.triggered.connect(self.zoomTo) self.iface.addPluginToMenu("what3words", self.zoomToAction) addSettingsMenu( "what3words", self.iface.addPluginToMenu) addHelpMenu( "what3words", self.iface.addPluginToMenu) addAboutMenu( "what3words", self.iface.addPluginToMenu) self.iface.mapCanvas().mapToolSet.connect(self.unsetTool) self.zoomToDialog = W3WCoordInputDialog(self.iface.mapCanvas(), self.iface.mainWindow()) self.iface.addDockWidget(Qt.TopDockWidgetArea, self.zoomToDialog) self.zoomToDialog.hide() if processingOk: Processing.addProvider(self.provider) try: from lessons import addLessonsFolder, addGroup folder = os.path.join(os.path.dirname(__file__), "_lessons") addLessonsFolder(folder, "what3words") except: pass
def initGui(self): self.toolbar = self.iface.addToolBar(P_E) self.toolbar.setObjectName(P_E) self.showdailyimages_act = self.add_action( os.path.join(plugin_path, "resources", "search.svg"), text=self.tr(P_E), callback=toggle_images_search, add_to_menu=True, add_to_toolbar=True, parent=self.iface.mainWindow()) self.showbasemaps_act = self.add_action( os.path.join(plugin_path, "resources", "basemap.svg"), text=self.tr("Show Basemaps Search"), callback=toggle_mosaics_search, add_to_menu=True, add_to_toolbar=True, parent=self.iface.mainWindow()) self.showinspector_act = self.add_action( os.path.join(plugin_path, "resources", "inspector.svg"), text=self.tr("Show Planet Inspector..."), callback=toggle_inspector, add_to_menu=False, add_to_toolbar=True, parent=self.iface.mainWindow()) self.showtasking_act = self.add_action( os.path.join(plugin_path, "resources", "tasking.svg"), text=self.tr("Show Tasking..."), callback=toggle_tasking_widget, add_to_menu=False, add_to_toolbar=True, parent=self.iface.mainWindow()) self.add_central_toolbar_button() self.showorders_act = self.add_action( os.path.join(plugin_path, "resources", "orders.svg"), text=self.tr("Show Orders Monitor..."), callback=toggle_orders_monitor, add_to_menu=False, add_to_toolbar=True, parent=self.iface.mainWindow()) self.add_user_button() self.add_info_button() addSettingsMenu(P_E, self.iface.addPluginToWebMenu) addAboutMenu(P_E, self.iface.addPluginToWebMenu) self.provider = BasemapLayerWidgetProvider() QgsGui.layerTreeEmbeddedWidgetRegistry().addProvider(self.provider) QgsProject.instance().projectSaved.connect(self.project_saved) QgsProject.instance().layersAdded.connect(self.layers_added) QgsProject.instance().layerRemoved.connect(self.layer_removed) PlanetClient.getInstance().loginChanged.connect(self.login_changed) self.enable_buttons(False)