Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/actions.py
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-04-17 04:36:31 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-04-17 04:36:31 (GMT)
commite784a2f0b92ecaf46a77ddca94b31fcc86e0cbae (patch)
tree56e23c87959b877e70614e0692b158eae2fd4fc8 /src/sugar/tutorius/actions.py
parente3633a2cc4a5aa061172f4962da86ce346151ff8 (diff)
parent544b836dab71d36290d3da5131afaef77c88ccd8 (diff)
Merge branch 'jc_support' into mike
Conflicts: source/external/source/sugar-toolkit/src/sugar/tutorius/tests/coretests.py source/external/source/sugar-toolkit/src/sugar/tutorius/tests/run-tests.py
Diffstat (limited to 'src/sugar/tutorius/actions.py')
-rw-r--r--src/sugar/tutorius/actions.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/sugar/tutorius/actions.py b/src/sugar/tutorius/actions.py
index fc364e0..d81e3c2 100644
--- a/src/sugar/tutorius/actions.py
+++ b/src/sugar/tutorius/actions.py
@@ -222,3 +222,56 @@ class DisableWidgetAction(Action):
"""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