Skip to content

Commit

Permalink
Merge pull request #32 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Enhancement: Added state method for some widgets
  • Loading branch information
seamm authored Oct 10, 2024
2 parents ec4db9a + aedc216 commit 2da767f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
=======
History
=======
2024.10.10 -- Enhancement: Added state method for some widgets
* Added a state method to LabeledWidget, LabeledComboBox, LabeledEntry, UnitEntry
and UnitComboBox. This method sets or returns the state of the widget

2024.7.21 -- Return the width of aligned labels
* The align_labels procedure now returns the width of the labels. This is useful for
laying out indented widgets.
Expand Down
6 changes: 6 additions & 0 deletions seamm_widgets/labeled_combobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,9 @@ def config(self, **kwargs):

def configure(self, **kwargs):
return self.config(**kwargs)

def state(self, stateSpec=None):
"""Set the state of the widget"""
result = super().state(stateSpec)
tmp = self.combobox.state(stateSpec)
return result + tmp
6 changes: 6 additions & 0 deletions seamm_widgets/labeled_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,9 @@ def config(self, **kwargs):

# having removed our options, pass rest to parent
super().config(**kwargs)

def state(self, stateSpec=None):
"""Set the state of the widget"""
result = super().state(stateSpec)
tmp = self.entry.state(stateSpec)
return result + tmp
5 changes: 5 additions & 0 deletions seamm_widgets/labeled_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,8 @@ def config(self, **kwargs):
# Since this is the base class, raise an error force
# unrecognized options
raise RuntimeError("Unknown option '{}'".format(k))

def state(self, stateSpec=None):
"""Set the state of the widget"""
result = self.label.state(stateSpec)
return result
6 changes: 6 additions & 0 deletions seamm_widgets/unit_combobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,9 @@ def config(self, **kwargs):

# having removed our options, pass rest to parent
super().config(**kwargs)

def state(self, stateSpec=None):
"""Set the state of the widget"""
result = super().state(stateSpec)
tmp = self.units.state(stateSpec)
return result + tmp
6 changes: 6 additions & 0 deletions seamm_widgets/unit_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,9 @@ def config(self, **kwargs):

# having removed our options, pass rest to parent
super().config(**kwargs)

def state(self, stateSpec=None):
"""Set the state of the widget"""
result = super().state(stateSpec)
tmp = self.units.state(stateSpec)
return result + tmp

0 comments on commit 2da767f

Please sign in to comment.