From 2c329ce95146f2a27e154f407bb649cc2b557b66 Mon Sep 17 00:00:00 2001 From: Vincent Vinet Date: Wed, 25 Mar 2009 18:37:34 +0000 Subject: Add the disable widget action --- 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) -- cgit v0.9.1