Skip to content
Permalink
Browse files

Remember button checked status

  • Loading branch information
elpaso authored and nyalldawson committed Sep 14, 2018
1 parent d1ec4ac commit db98a38c021a88c5331545bf28c0d7b205a84c08
Showing with 9 additions and 5 deletions.
  1. +9 −5 python/plugins/processing/ProcessingPlugin.py
@@ -263,13 +263,17 @@ def initGui(self):

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)
else:
self.editSelectedAction.setEnabled(True)

old_enabled_state = self.editSelectedAction.isEnabled()

new_enabled_state = layer is not None and layer.type() == QgsMapLayer.VectorLayer and layer.isEditable() and layer.selectedFeatureCount()
self.editSelectedAction.setEnabled(new_enabled_state)

if new_enabled_state != old_enabled_state:
self.toolbox.set_in_place_edit_mode(new_enabled_state and self.editSelectedAction.isChecked())

def openProcessingOptions(self):
self.iface.showOptionsDialog(self.iface.mainWindow(), currentPage='processingOptions')

0 comments on commit db98a38

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