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:
Diffstat (limited to 'src/sugar/tutorius/actions.py')
-rw-r--r--src/sugar/tutorius/actions.py35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/sugar/tutorius/actions.py b/src/sugar/tutorius/actions.py
index 7ecf86b..12de298 100644
--- a/src/sugar/tutorius/actions.py
+++ b/src/sugar/tutorius/actions.py
@@ -16,10 +16,13 @@
"""
This module defines Actions that can be done and undone on a state
"""
+from gettext import gettext as _
from sugar.tutorius import gtkutils
from dialog import TutoriusDialog
import overlayer
+from sugar.tutorius.editor import WidgetIdentifier
+from sugar.tutorius.services import ObjectStore
class Action(object):
@@ -125,11 +128,18 @@ class BubbleMessage(Action):
Show the dialog
"""
# get or inject overlayer
- self.overlay = gtkutils.activity()._overlayer #FIXME:handle subwin
+ self.overlay = ObjectStore().activity._overlayer
+ # FIXME: subwindows, are left to overlap this. This behaviour is
+ # undesirable. subwindows (i.e. child of top level windows) should be
+ # handled either by rendering over them, or by finding different way to
+ # draw the overlay.
if not self._bubble:
x, y = self.position
- self._bubble = overlayer.TextBubble(text=self._message, tailpos=self._tailpos) #TODO: add tail
+ # TODO: tails are relative to tailpos. They should be relative to
+ # the speaking widget. Same of the bubble position.
+ self._bubble = overlayer.TextBubble(text=self._message,
+ tailpos=self._tailpos)
self._bubble.show()
self.overlay.put(self._bubble, x, y)
self.overlay.queue_draw()
@@ -139,8 +149,25 @@ class BubbleMessage(Action):
Destroy the dialog
"""
if self._bubble:
-## self.overlay.remove(self._bubble)
-## self.overlay.bin_window.clear()
self._bubble.destroy()
self._bubble = None
+
+class WidgetIdentifyAction(Action):
+ def __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()
+