示例#1
0
class VectorsTool:
    """QGIS Plugin Implementation."""
    def __init__(self, iface, bbox_tool):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        self.bbox_tool = bbox_tool

        # Create the dialog (after translation) and keep reference
        self.dlg = VectorsDialog(self.iface.mainWindow())
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.dlg)

        self.dialog_tool = VectorsDialogTool(self.iface, self.dlg.dialog_base,
                                             self.bbox_tool)

    def unload(self):
        self.bbox_tool.reset()
        self.dlg.close()
        # remove the tool
        self.iface.mapCanvas().unsetMapTool(self.bbox_tool)

    def run(self):
        """Run method that performs all the real work"""
        # show the dialog
        self.dlg.show()
示例#2
0
    def __init__(self, iface, bbox_tool):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        self.bbox_tool = bbox_tool

        # Create the dialog (after translation) and keep reference
        self.dlg = VectorsDialog(self.iface.mainWindow())
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.dlg)

        self.dialog_tool = VectorsDialogTool(self.iface, self.dlg.dialog_base,
                                             self.bbox_tool)