def __init__(self, edit_dialog): """Constructor""" ProductionChanges.__init__(self, edit_dialog) iface.actionToggleEditing().trigger() # set editing to edit polygon iface.actionVertexTool().trigger() selecttools = iface.attributesToolBar().findChildren(QToolButton) # selection actions iface.building_toolbar.addSeparator() for sel in selecttools: if sel.text() == "Select Feature(s)": for a in sel.actions()[0:3]: iface.building_toolbar.addAction(a) # editing actions iface.building_toolbar.addSeparator() for dig in iface.digitizeToolBar().actions(): if dig.objectName() in ["mActionVertexTool", "mActionMoveFeature"]: iface.building_toolbar.addAction(dig) # advanced Actions iface.building_toolbar.addSeparator() for adv in iface.advancedDigitizeToolBar().actions(): if adv.objectName() in [ "mActionUndo", "mActionRedo", "mActionReshapeFeatures", "mActionOffsetCurve" ]: iface.building_toolbar.addAction(adv) iface.building_toolbar.show() self.disable_UI_functions()
def setup_toolbar(self): """Called on opening of from to set up the buildings toolbar for selection only""" selecttools = iface.attributesToolBar().findChildren(QToolButton) # selection actions iface.building_toolbar.addSeparator() for sel in selecttools: if sel.text() == "Select Feature(s)": for a in sel.actions()[0:3]: iface.building_toolbar.addAction(a) # editing actions iface.building_toolbar.addSeparator() for dig in iface.digitizeToolBar().actions(): if dig.objectName() in [ "mActionAddFeature", "mActionNodeTool", "mActionMoveFeature" ]: iface.building_toolbar.addAction(dig) # advanced Actions iface.building_toolbar.addSeparator() for adv in iface.advancedDigitizeToolBar().actions(): if adv.objectName() in [ "mActionUndo", "mActionRedo", "mActionReshapeFeatures", "mActionOffsetCurve" ]: iface.building_toolbar.addAction(adv) iface.building_toolbar.show()
def __init__(self, canvas, pluginM, cadDockWidget): QgsMapToolAdvancedDigitizing.__init__(self, canvas, cadDockWidget) #Asignacion inicial self.canvas = canvas self.pluginM = pluginM self.modoDividir = False self.modoEliminar = False self.modoEditar = False self.moviendoVertice = False self.activate() for x in iface.advancedDigitizeToolBar().actions(): if x.objectName() == 'mEnableAction': self.botonAD = x self.relaciones = {} self.punteroRelaciones = 0 self.relaciones[self.punteroRelaciones] = RelacionRubberGeom( self.crearNuevoRubberLinea(), None) self.rubberPunto = QgsRubberBand(self.canvas, QgsWkbTypes.PointGeometry) self.rubberPunto.setFillColor(QColor(0, 0, 0, 0)) self.rubberPunto.setStrokeColor(QColor(255, 0, 0, 255)) self.rubberPunto.setWidth(6) self.primerClick = False self.snapper = self.canvas.snappingUtils() self.listaPuntosLineaTemp = [] self.cuentaClickLinea = 0 self.relacionEnEdicion = -1
def run(self): """Run method that performs all the real work""" # show the dialog for x in iface.mapNavToolToolBar().actions(): if x.objectName() == 'mActionPan': x.trigger() for x in iface.advancedDigitizeToolBar().actions(): if x.objectName() == 'mEnableAction': x.trigger() self.dlg.show() # Run the dialog event loop iface.mapCanvas().setMapTool(self.eventos) result = self.dlg.exec_() # See if OK was pressed self.dlg.btnFusionar.setEnabled(True) self.dlg.comboPredios.setEnabled(True) self.dlg.btnCargarPredio.setEnabled(True) self.dlg.btnDibujarCortes.setEnabled(False) self.dlg.btnEditarCortes.setEnabled(False) self.dlg.btnEliminarCortes.setEnabled(False) self.dlg.btnApagarHerramientas.setEnabled(False) self.dlg.btnConfirmarCortes.setEnabled(False) self.dlg.btnDeshacerTodo.setEnabled(False) # llena los predios en el combo self.dlg.comboPredios.clear() lista = [] capaPredios = QgsProject.instance().mapLayer( self.ACA.obtenerIdCapa('predios.geom')) if capaPredios is None: return # lista de features for predio in capaPredios.getFeatures(): lista.append(str(predio['clave'])) lista.sort() for elemento in lista: self.dlg.comboPredios.addItem(elemento) if result: # Do something useful here - delete the line containing pass and # substitute with your code. pass
from PyQt5.QtCore import QSettings from qgis.utils import iface packageName = 'qgmesh' # Name of your plugin folder QSettings().setValue("PythonPlugins/" + packageName, True) iface.mapCanvas().snappingUtils().toggleEnabled() iface.advancedDigitizeToolBar().show() iface.shapeDigitizeToolBar().show()