Beispiel #1
0
    def initGui(self):
        # create action that will start plugin configuration
        #self.action = QAction(QIcon(":/plugins/valuetool/icon.png"), "Value Tool", self.iface.getMainWindow())
        #self.action.setWhatsThis("Value Tool")
        #QObject.connect(self.action, SIGNAL("activated()"), self.run)
        ## add toolbar button and menu item
        #self.iface.addToolBarIcon(self.action)
        #self.iface.addPluginMenu("Analyses", self.action)
        ## add the tool to select feature
        #self.tool = selectPointTool(self.iface.getMapCanvas(),self.action)

        # add action to toolbar
        self.action = QAction(QIcon(":/plugins/valuetool/icon.svg"),
                              "Value Tool", self.iface.mainWindow())
        self.iface.addToolBarIcon(self.action)
        self.tool = ValueMapTool(self.canvas, self.action)
        self.saveTool = None
        QObject.connect(self.action, SIGNAL("triggered()"), self.activateTool)
        QObject.connect(self.tool, SIGNAL("deactivate"), self.deactivateTool)

        # create the widget to display information
        self.valuewidget = ValueWidget(self.iface)
        QObject.connect(self.tool, SIGNAL("moved"), self.valuewidget.toolMoved)
        QObject.connect(self.tool, SIGNAL("pressed"),
                        self.valuewidget.toolPressed)
        QObject.connect(self.valuewidget.cbxEnable, SIGNAL("clicked( bool )"),
                        self.toggleTool)
        QObject.connect(self.valuewidget.cbxClick, SIGNAL("clicked( bool )"),
                        self.toggleMouseClick)

        # create the dockwidget with the correct parent and add the valuewidget
        self.valuedockwidget = QDockWidget("Value Tool",
                                           self.iface.mainWindow())
        self.valuedockwidget.setObjectName("Value Tool")
        self.valuedockwidget.setWidget(self.valuewidget)
        #QObject.connect(self.valuedockwidget, SIGNAL('visibilityChanged ( bool )'), self.showHideDockWidget)

        # add the dockwidget to iface
        self.iface.addDockWidget(Qt.LeftDockWidgetArea, self.valuedockwidget)
Beispiel #2
0
    def initGui(self):
        # create action that will start plugin configuration
        # self.action = QAction(QIcon(":/plugins/valuetool/icon.png"), "Value Tool", self.iface.getMainWindow())
        # self.action.setWhatsThis("Value Tool")
        # QObject.connect(self.action, SIGNAL("activated()"), self.run)
        # # add toolbar button and menu item
        # self.iface.addToolBarIcon(self.action)
        # self.iface.addPluginMenu("Analyses", self.action)
        # # add the tool to select feature
        # self.tool = selectPointTool(self.iface.getMapCanvas(),self.action)

        # create the widget to display information
        self.valuewidget = ValueWidget(self.iface)
        # create the dockwidget with the correct parent and add the valuewidget
        self.valuedockwidget = QDockWidget("Value Tool",
                                           self.iface.mainWindow())
        self.valuedockwidget.setObjectName("Value Tool")
        self.valuedockwidget.setWidget(self.valuewidget)
        QObject.connect(self.valuedockwidget,
                        SIGNAL('visibilityChanged ( bool )'),
                        self.showHideDockWidget)

        self.iface.addDockWidget(Qt.LeftDockWidgetArea, self.valuedockwidget)