Skip to content
Permalink
Browse files

Dynamically change button text for in-place editing

The button title changes if there are selected features
  • Loading branch information
elpaso committed Oct 5, 2018
1 parent ca1c65d commit 0782b9d869e919edeeabd51b2dfe5ea4b00de8fd
Showing with 4 additions and 2 deletions.
  1. +4 −2 python/plugins/processing/gui/AlgorithmDialog.py
@@ -81,8 +81,10 @@ def __init__(self, alg, in_place=False, parent=None):
self.buttonBox().addButton(self.runAsBatchButton, QDialogButtonBox.ResetRole) # reset role to ensure left alignment
else:
self.runAsBatchButton = None
self.buttonBox().button(QDialogButtonBox.Ok).setText('Modify Selected Features')
self.buttonBox().button(QDialogButtonBox.Close).setText('Cancel')
has_selection = iface.activeLayer() and (iface.activeLayer().selectedFeatureCount() > 0)
self.buttonBox().button(QDialogButtonBox.Ok).setText(QCoreApplication.translate("AlgorithmDialog", "Modify Selected Features")
if has_selection else QCoreApplication.translate("AlgorithmDialog", "Modify All Features"))
self.buttonBox().button(QDialogButtonBox.Close).setText(QCoreApplication.translate("AlgorithmDialog", "Cancel"))

def getParametersPanel(self, alg, parent):
return ParametersPanel(parent, alg, self.in_place)

0 comments on commit 0782b9d

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