def initGui(self): self.mapTool = MGRSMapTool(self.iface.mapCanvas()) self.iface.mapCanvas().mapToolSet.connect(self.unsetTool) self.toolAction = QAction(QIcon(os.path.join(pluginPath, 'icons', 'mgrs.svg')), 'MGRS map tool', self.iface.mainWindow()) self.toolAction.setCheckable(True) self.iface.addToolBarIcon(self.toolAction) self.iface.addPluginToMenu('MGRS', self.toolAction) self.toolAction.triggered.connect(self.setTool) zoomToIcon = QIcon(':/images/themes/default/mActionZoomIn.svg') self.zoomToAction = QAction(zoomToIcon, 'Zoom to MGRS coordinate', self.iface.mainWindow()) self.iface.addPluginToMenu('MGRS', self.zoomToAction) self.zoomToAction.triggered.connect(self.zoomTo) addHelpMenu("MGRS", self.iface.addPluginToMenu) addAboutMenu("MGRS", self.iface.addPluginToMenu) self.mgrsDock = MgrsDockWidget(self.iface.mapCanvas(), self.iface.mainWindow()) self.iface.addDockWidget(Qt.TopDockWidgetArea, self.mgrsDock) self.mgrsDock.hide() if processingOk: Processing.addProvider(self.provider) try: from lessons import addLessonsFolder, addGroup folder = os.path.join(os.path.dirname(__file__), "_lessons") addLessonsFolder(folder, "MGRS tools") except: pass
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() QgsApplication.processingRegistry().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): try: from lessons import addLessonsFolder folder = os.path.join(os.path.dirname(__file__), "_lessons") addLessonsFolder(folder, "datacubeplugin") except: pass self.dataCubeWidget = DataCubeWidget(self.iface.mainWindow()) self.iface.addDockWidget(Qt.LeftDockWidgetArea, self.dataCubeWidget) self.dataCubeWidget.hide() self.iface.addDockWidget(Qt.BottomDockWidgetArea, plotWidget) plotWidget.hide() self.iface.addDockWidget(Qt.TopDockWidgetArea, mosaicWidget) mosaicWidget.hide() self.dataCubeAction = self.dataCubeWidget.toggleViewAction() icon = QIcon(os.path.dirname(__file__) + "/icons/desktop.svg") self.dataCubeAction.setIcon(icon) self.dataCubeAction.setText("Data Cube panel") self.iface.addPluginToMenu("Data Cube Plugin", self.dataCubeAction) self.mosaicAction = mosaicWidget.toggleViewAction() icon = QIcon(os.path.dirname(__file__) + "/icons/desktop.svg") self.mosaicAction.setIcon(icon) self.mosaicAction.setText("Mosaic tool") self.iface.addPluginToMenu("Data Cube Plugin", self.mosaicAction) #addSettingsMenu("Data Cube Plugin") addHelpMenu("Data Cube Plugin") addAboutMenu("Data Cube Plugin")
def initGui(self): icon = QIcon(os.path.dirname(__file__) + "/ui/resources/geogig.png") self.explorerAction = navigatorInstance.toggleViewAction() self.explorerAction.setIcon(icon) self.explorerAction.setText("GeoGig Navigator") self.iface.addPluginToMenu("&GeoGig", self.explorerAction) 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.iface.addPluginToMenu("&GeoGig", self.toolAction) addSettingsMenu("GeoGig") addHelpMenu("GeoGig") addAboutMenu("GeoGig") self.mapTool = MapToolGeoGigInfo(self.iface.mapCanvas()) self.iface.addDockWidget(Qt.RightDockWidgetArea, navigatorInstance) self.iface.mapCanvas().extentsChanged.connect(refreshGeogigLayers) QgsProject.instance().layersWillBeRemoved.connect(layersRemoved) QgsProject.instance().legendLayersAdded.connect(onLayersLoaded)
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): addHelpMenu("MIL-STD-2525", self.iface.addPluginToMenu) addAboutMenu("MIL-STD-2525", self.iface.addPluginToMenu) try: from lessons import addLessonsFolder, addGroup folder = os.path.join(os.path.dirname(__file__), "_lessons") addLessonsFolder(folder, "milstd2525") except: pass
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): icon = QIcon(os.path.dirname(__file__) + "/icons/sdk.svg") self.action = QAction(icon, "Web App Builder", self.iface.mainWindow()) self.action.setObjectName("startWebAppBuilder") self.action.triggered.connect(self.run) self.iface.addWebToolBarIcon(self.action) self.iface.addPluginToWebMenu("Web App Builder", self.action) addSettingsMenu("Web App Builder", self.iface.addPluginToWebMenu) addHelpMenu("Web App Builder", self.iface.addPluginToWebMenu) addAboutMenu("Web App Builder", self.iface.addPluginToWebMenu)
def initGui(self): addHelpMenu("MIL-STD-2525", self.iface.addPluginToMenu) addAboutMenu("MIL-STD-2525", self.iface.addPluginToMenu) # noinspection PyBroadException try: # noinspection PyUnresolvedReferences from lessons import addLessonsFolder, addGroup folder = os.path.join(os.path.dirname(__file__), "_lessons") addLessonsFolder(folder, "milstd2525") 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): # 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" )