Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar
diff options
context:
space:
mode:
authorVincent Vinet <vince.vinet@gmail.com>2009-03-03 15:53:02 (GMT)
committer Vincent Vinet <vince.vinet@gmail.com>2009-03-10 17:37:10 (GMT)
commitf63d7dd22618af7e229885d183f482829e96b2a3 (patch)
treefea9a252238b29a2c96e4c0fb331e1953a65fc9a /src/sugar
parent37e224a7301ab8a5845bb688e452a6c186403ba7 (diff)
Remove the Mixin Action classes. They were never meant to be.
Hope they don't feel too rejected. Because they are.
Diffstat (limited to 'src/sugar')
-rw-r--r--src/sugar/tutorius/actions.py47
1 files changed, 3 insertions, 44 deletions
diff --git a/src/sugar/tutorius/actions.py b/src/sugar/tutorius/actions.py
index 68ec374..34802c3 100644
--- a/src/sugar/tutorius/actions.py
+++ b/src/sugar/tutorius/actions.py
@@ -38,49 +38,12 @@ class Action(object):
pass #Should raise NotImplemented?
-class DoOnceMixin(object):
- """Mixin class used to have an action be called only on the first do().
-
- To use this mixin, create a new class that derives from this and from
- the action you want executed only once.
-
- class ConcreteOnceAction(DoOnceMixin, ConcreteAction):
- pass
+class OnceWrapper(object):
+ """
+ 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
-
- Maybe it would be better off just using a wrapper class instead of this.
-
- But it was fun to play with.
-
- Did I mention the wrapper is 25 lines "south" of here? Besides, this mixin
- class fails at __init__ ..... mixins... right....narwhals!
- """
- def __init__(self ):
- super(DoOnceMixin, self).__init__()
- self._called = False
- self._need_undo = False
-
- def do(self):
- """
- Do the action only on the first time
- """
- if not self._called:
- self._called = True
- super(DoOnceMixin, self).do()
- self._need_undo = True
-
- def undo(self):
- """
- Undo the action if it's been done
- """
- if self._need_undo:
- super(DoOnceMixin, self).undo()
- self._need_undo = False
-
-class OnceWrapper(object):
- """Wraps a class to perform an action once only
"""
def __init__(self, action):
self._action = action
@@ -136,7 +99,3 @@ class DialogMessage(Action):
self._dialog = None
-
-class OnceDialogMessage(DoOnceMixin, DialogMessage):
- """Broken!"""
- pass