Skip to content
Permalink
Browse files

Sync in-place button state

  • Loading branch information
elpaso authored and nyalldawson committed Sep 14, 2018
1 parent e75ebad commit d1ec4ac0aa041066d42a48f63f5f004034d49e28
Showing with 10 additions and 2 deletions.
  1. +10 −2 python/plugins/processing/ProcessingPlugin.py
@@ -28,6 +28,7 @@
import shutil
import os
import sys
from functools import partial

from qgis.core import (QgsApplication,
QgsProcessingUtils,
@@ -254,9 +255,16 @@ def initGui(self):
initializeMenus()
createMenus()

self.iface.currentLayerChanged.connect(self.layer_changed)
# In-place editing button state sync
self.iface.currentLayerChanged.connect(self.sync_in_place_button_state)
self.iface.mapCanvas().selectionChanged.connect(self.sync_in_place_button_state)
self.iface.actionToggleEditing().triggered.connect(partial(self.sync_in_place_button_state, None))
self.sync_in_place_button_state()

def layer_changed(self, layer):
def sync_in_place_button_state(self, layer=None):
"""Synchronise the button state with layer state and selection"""
if layer is None:
layer = self.iface.activeLayer()
if layer is None or layer.type() != QgsMapLayer.VectorLayer or not layer.isEditable() or not layer.selectedFeatureCount():
self.editSelectedAction.setChecked(False)
self.editSelectedAction.setEnabled(False)

0 comments on commit d1ec4ac

Please sign in to comment.
You can’t perform that action at this time.