diff options
author | Vincent Vinet <vince.vinet@gmail.com> | 2009-03-25 18:37:34 (GMT) |
---|---|---|
committer | Vincent Vinet <vince.vinet@gmail.com> | 2009-03-31 14:02:59 (GMT) |
commit | 2c329ce95146f2a27e154f407bb649cc2b557b66 (patch) | |
tree | 9af3e067fd40adbd1f808c0e97240b032771a1c3 | |
parent | 474d482f53ca7fc89183993d9a0992b71cfcfc02 (diff) |
Add the disable widget action
-rw-r--r-- | src/sugar/tutorius/actions.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sugar/tutorius/actions.py b/src/sugar/tutorius/actions.py index 60ccd8b..a2e8aeb 100644 --- a/src/sugar/tutorius/actions.py +++ b/src/sugar/tutorius/actions.py @@ -214,3 +214,24 @@ class WidgetIdentifyAction(Action): self._dialog.destroy() +class DisableWidgetAction(Action): + def __init__(self, target): + """Constructor + @param target target treeish + """ + Action.__init__(self) + self._target = target + self._widget = None + + def do(self): + """Action do""" + os = ObjectStore() + if os.activity: + self._widget = gtkutils.find_widget(os.activity, self._target) + if self._widget: + self._widget.set_sensitive(False) + + def undo(self): + """Action undo""" + if self._widget: + self._widget.set_sensitive(True) |