Navigation Menu

Skip to content

Commit

Permalink
Dynamically change button text for in-place editing
Browse files Browse the repository at this point in the history
The button title changes if there are selected features
  • Loading branch information
elpaso committed Oct 5, 2018
1 parent ca1c65d commit 0782b9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/plugins/processing/gui/AlgorithmDialog.py
Expand Up @@ -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)
Expand Down

0 comments on commit 0782b9d

Please sign in to comment.