Skip to content

Commit

Permalink
feat: update setter attribute on CueSelectPulldown and add a func…
Browse files Browse the repository at this point in the history
…tion `setCheckedFromText`
  • Loading branch information
KernAttila committed Mar 28, 2023
1 parent f494104 commit 65d56b3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cuesubmit/cuesubmit/ui/Widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def __init__(
self.setOptions(options)
self.signals = [self.optionsMenu.triggered]
self.getter = self.text
self.setter = self.setText
self.setter = self.setCheckedFromText
if self.multiselect:
self.toolButton.setText(self.emptyText)
else:
Expand Down Expand Up @@ -248,6 +248,16 @@ def setChecked(self, actionNames):
self.optionsMenu.actions()[0].setChecked(True)
self.updateLabelText()

def setCheckedFromText(self, actionsAstext):
"""Set the given actionNames to be checked and update the label.
@type actionNames: str
@param actionNames: list of action names to set to checked separated by a comma and a space
"""
if ', ' in text and self.multiselect:
self.setChecked(actionsAstext.split(', '))
else:
self.setChecked([actionsAstext])

def text(self):
"""Return the tool button's current text value.
@rtype: str
Expand Down

0 comments on commit 65d56b3

Please sign in to comment.