def __init__(self, iface, toolBar): DtSingleButton.__init__(self, iface, toolBar, QtGui.QIcon(":/splitter.png"), QtCore.QCoreApplication.translate("digitizingtools", "Split selected features with selected line from another layer"), geometryTypes = [2, 3, 5, 6], dtName = "dtSplitWithLine") self.enable()
def __init__(self, iface, toolBar): DtSingleButton.__init__(self, iface, toolBar, QtGui.QIcon(":/Merge.png"), QtCore.QCoreApplication.translate("digitizingtools", "Merge selected features"), geometryTypes = [1, 2, 3, 4, 5, 6], dtName = "dtMerge") self.enable()
def __init__(self, iface, toolBar): DtSingleButton.__init__(self, iface, toolBar, QtGui.QIcon(":/clipper.png"), QtCore.QCoreApplication.translate( "digitizingtools", "Clip with polygon from another layer"), geometryTypes = [2, 3, 5, 6], dtName = "dtClipper") self.enable()
def __init__(self, iface, toolBar): DtSingleButton.__init__(self, iface, toolBar, QtGui.QIcon(":/exchangeGeometry.png"), QtCore.QCoreApplication.translate("digitizingtools", "Exchange the geomteries between selected features"), geometryTypes = [1, 2, 3, 4, 5, 6], dtName = "dtExchangeGeometry") self.enable()
def __init__(self, iface, toolBar): DtSingleButton.__init__(self, iface, toolBar, QtGui.QIcon(":/cutter.png"), QtCore.QCoreApplication.translate( "digitizingtools", "Cut with polygon from another layer"), geometryTypes=[2, 3, 5, 6], dtName="dtCutter") self.enable()
def enable(self): '''Enables/disables the corresponding button.''' DtSingleButton.enable(self) # call parent's method if self.act.isEnabled(): layer = self.iface.activeLayer() try: layer.selectionChanged.disconnect(self.enable) # disconnect, will be reconnected except: pass doEnable = layer.selectedFeatureCount() > 1 self.act.setEnabled(doEnable) layer.selectionChanged.connect(self.enable)
def __init__(self, iface, toolBar): DtSingleButton.__init__( self, iface, toolBar, QtGui.QIcon(":/splitter.png"), QtCore.QCoreApplication.translate( "digitizingtools", "Split selected features with selected line from another layer" ), geometryTypes=[2, 3, 5, 6], dtName="dtSplitWithLine") self.enable()
def enable(self): '''Enables/disables the corresponding button.''' DtSingleButton.enable(self) # call parent's method if self.act.isEnabled(): layer = self.iface.activeLayer() try: layer.selectionChanged.disconnect( self.enable) # disconnect, will be reconnected except: pass doEnable = layer.selectedFeatureCount() == 2 self.act.setEnabled(doEnable) layer.selectionChanged.connect(self.enable)