From e1ed58a1a9b8674559824c158b4ed7375a0f7c18 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 05 Oct 2009 15:42:28 +0000 Subject: LP 439980 : Adding tests for the addon module --- (limited to 'tutorius/actions.py') diff --git a/tutorius/actions.py b/tutorius/actions.py index 0db7988..89e71ae 100644 --- a/tutorius/actions.py +++ b/tutorius/actions.py @@ -177,148 +177,3 @@ class Action(TPropContainer): self.position = [int(x), int(y)] self.__edit_img.destroy() -##class OnceWrapper(Action): -## """ -## Wraps a class to perform an action once only -## -## This ConcreteActions's do() method will only be called on the first do() -## and the undo() will be callable after do() has been called -## """ -## -## _action = TAddonProperty() -## -## def __init__(self, action): -## Action.__init__(self) -## self._called = False -## self._need_undo = False -## self._action = action -## -## def do(self): -## """ -## Do the action only on the first time -## """ -## if not self._called: -## self._called = True -## self._action.do() -## self._need_undo = True -## -## def undo(self): -## """ -## Undo the action if it's been done -## """ -## if self._need_undo: -## self._action.undo() -## self._need_undo = False -## -##class WidgetIdentifyAction(Action): -## def __init__(self): -## Action.__init__(self) -## self.activity = None -## self._dialog = None - -## def do(self): -## os = ObjectStore() -## if os.activity: -## self.activity = os.activity - -## self._dialog = WidgetIdentifier(self.activity) -## self._dialog.show() - - -## def undo(self): -## if self._dialog: -## self._dialog.destroy() - -##class ChainAction(Action): -## """Utility class to allow executing actions in a specific order""" -## def __init__(self, *actions): -## """ChainAction(action1, ... ) builds a chain of actions""" -## Action.__init__(self) -## self._actions = actions -## -## def do(self,**kwargs): -## """do() each action in the chain""" -## for act in self._actions: -## act.do(**kwargs) -## -## def undo(self): -## """undo() each action in the chain, starting with the last""" -## for act in reversed(self._actions): -## act.undo() - -##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) - - -##class TypeTextAction(Action): -## """ -## Simulate a user typing text in a widget -## Work on any widget that implements a insert_text method -## -## @param widget The treehish representation of the widget -## @param text the text that is typed -## """ -## def __init__(self, widget, text): -## Action.__init__(self) -## -## self._widget = widget -## self._text = text -## -## def do(self, **kwargs): -## """ -## Type the text -## """ -## widget = gtkutils.find_widget(ObjectStore().activity, self._widget) -## if hasattr(widget, "insert_text"): -## widget.insert_text(self._text, -1) -## -## def undo(self): -## """ -## no undo -## """ -## pass -## -##class ClickAction(Action): -## """ -## Action that simulate a click on a widget -## Work on any widget that implements a clicked() method -## -## @param widget The threehish representation of the widget -## """ -## def __init__(self, widget): -## Action.__init__(self) -## self._widget = widget -## -## def do(self): -## """ -## click the widget -## """ -## widget = gtkutils.find_widget(ObjectStore().activity, self._widget) -## if hasattr(widget, "clicked"): -## widget.clicked() -## -## def undo(self): -## """ -## No undo -## """ -## pass - -- cgit v0.9.1