def __init__(self, dialog, alg, default):
     super(ExtentSelectionPanel, self).__init__(None)
     self.dialog = dialog
     self.params = alg.parameters
     self.horizontalLayout = QtGui.QHBoxLayout(self)
     self.horizontalLayout.setSpacing(2)
     self.horizontalLayout.setMargin(0)
     self.text = QtGui.QLineEdit()
     #self.text.setText(default)
     self.text.setSizePolicy(QtGui.QSizePolicy.Expanding,
                             QtGui.QSizePolicy.Expanding)
     if self.canUseAutoExtent():
         if hasattr(self.text, 'setPlaceholderText'):
             self.text.setPlaceholderText(
                 "[Leave blank to use min covering extent]")
     self.horizontalLayout.addWidget(self.text)
     self.pushButton = QtGui.QPushButton()
     self.pushButton.setText("...")
     self.pushButton.clicked.connect(self.buttonPushed)
     self.horizontalLayout.addWidget(self.pushButton)
     self.setLayout(self.horizontalLayout)
     canvas = QGisLayers.iface.mapCanvas()
     self.prevMapTool = canvas.mapTool()
     self.tool = RectangleMapTool(canvas)
     self.connect(self.tool, SIGNAL("rectangleCreated()"), self.fillCoords)
예제 #2
0
 def __init__(self):
     self.name = "Define GRASS region on canvas"
     self.group = "Tools"
     canvas = QGisLayers.iface.mapCanvas()
     self.prevMapTool = canvas.mapTool()
     self.tool = RectangleMapTool(canvas)
     QtCore.QObject.connect(self.tool, SIGNAL("rectangleCreated()"),
                            self.fillCoords)