Skip to main content
deleted 40 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

While doing some research for above question, I found some details to stop editingStarted signal with following code.

    layer=iface.activeLayer()
    if layer.name()=="Fiber":
        layer.editingStarted.connect(lambda:first_method())
        layer.editingStopped.connect(lambda:first_method())
    def first_method():
        if layer.isEditable():
            print("In first method")
       else:
           try:
               layer.editingStarted.disconnect()
           except:
               print("editingStarted signal is not disconnected")
           try:
               layer.editingStopped.disconnect()
           except:
               print("editingStopped signal is not disconnected")

Things are working fine for single layer, but if I have multiple layers in project and I start and stop editing for other layer and again start editing for my required layer at then QgisQGIS is not starting editing for my required layer. Please suggest the workaround for this.

While doing some research for above question, I found some details to stop editingStarted signal with following code.

    layer=iface.activeLayer()
    if layer.name()=="Fiber":
        layer.editingStarted.connect(lambda:first_method())
        layer.editingStopped.connect(lambda:first_method())
    def first_method():
        if layer.isEditable():
            print("In first method")
       else:
           try:
               layer.editingStarted.disconnect()
           except:
               print("editingStarted signal is not disconnected")
           try:
               layer.editingStopped.disconnect()
           except:
               print("editingStopped signal is not disconnected")

Things are working fine for single layer, but if I have multiple layers in project and I start and stop editing for other layer and again start editing for my required layer at then Qgis is not starting editing for my required layer. Please suggest the workaround for this.

While doing some research for above question, I found some details to stop editingStarted signal with following code.

    layer=iface.activeLayer()
    if layer.name()=="Fiber":
        layer.editingStarted.connect(lambda:first_method())
        layer.editingStopped.connect(lambda:first_method())
    def first_method():
        if layer.isEditable():
            print("In first method")
       else:
           try:
               layer.editingStarted.disconnect()
           except:
               print("editingStarted signal is not disconnected")
           try:
               layer.editingStopped.disconnect()
           except:
               print("editingStopped signal is not disconnected")

Things are working fine for single layer, but if I have multiple layers in project and I start and stop editing for other layer and again start editing for my required layer at then QGIS is not starting editing for my required layer.

Source Link

While doing some research for above question, I found some details to stop editingStarted signal with following code.

    layer=iface.activeLayer()
    if layer.name()=="Fiber":
        layer.editingStarted.connect(lambda:first_method())
        layer.editingStopped.connect(lambda:first_method())
    def first_method():
        if layer.isEditable():
            print("In first method")
       else:
           try:
               layer.editingStarted.disconnect()
           except:
               print("editingStarted signal is not disconnected")
           try:
               layer.editingStopped.disconnect()
           except:
               print("editingStopped signal is not disconnected")

Things are working fine for single layer, but if I have multiple layers in project and I start and stop editing for other layer and again start editing for my required layer at then Qgis is not starting editing for my required layer. Please suggest the workaround for this.