Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/addons/bubblemessage.py
diff options
context:
space:
mode:
authorSimon Poirier <simpoir@gmail.com>2009-10-28 06:15:15 (GMT)
committer Simon Poirier <simpoir@gmail.com>2009-10-28 06:15:15 (GMT)
commit53af01c95abe622c0490b43c12439a04aa449509 (patch)
tree6e7ca498415f8e20874c1eaf7b2c19458218eeb3 /addons/bubblemessage.py
parentd5e7b4d380dfa9b979071b862e67d29ec127c542 (diff)
addon test extension to check interface contraints
Diffstat (limited to 'addons/bubblemessage.py')
-rw-r--r--addons/bubblemessage.py36
1 files changed, 15 insertions, 21 deletions
diff --git a/addons/bubblemessage.py b/addons/bubblemessage.py
index 6572a6a..72ff340 100644
--- a/addons/bubblemessage.py
+++ b/addons/bubblemessage.py
@@ -43,33 +43,28 @@ class BubbleMessage(Action):
self.tail_pos = tail_pos
if message:
self.message = message
-
- self.overlay = None
- self._bubble = None
- self._speaker = None
def do(self):
"""
Show the dialog
"""
# get or inject overlayer
- self.overlay = ObjectStore().activity._overlayer
+ 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.overlay:
- self.overlay = ObjectStore().activity._overlayer
- if not self._bubble:
+ overlay = ObjectStore().activity._overlayer
+ if not hasattr(self, '_bubble'):
x, y = self.position
# 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.tail_pos)
self._bubble.show()
- self.overlay.put(self._bubble, x, y)
- self.overlay.queue_draw()
+ overlay.put(self._bubble, x, y)
+ overlay.queue_draw()
def undo(self):
"""
@@ -84,27 +79,26 @@ class BubbleMessage(Action):
Enters edit mode. The action should display itself in some way,
without affecting the currently running application.
"""
- if not self.overlay:
- self.overlay = ObjectStore().activity._overlayer
+ overlay = ObjectStore().activity._overlayer
assert not self._drag, "bubble action set to editmode twice"
x, y = self.position
self._bubble = overlayer.TextBubble(text=self.message,
tailpos=self.tail_pos)
- self.overlay.put(self._bubble, x, y)
+ overlay.put(self._bubble, x, y)
self._bubble.show()
self._drag = DragWrapper(self._bubble, self.position, True)
def exit_editmode(self, *args):
- x,y = self._drag.position
- self.position = (int(x), int(y))
- if self._drag:
+ overlay = ObjectStore().activity._overlayer
+ if hasattr(self, '_drag'):
+ x,y = self._drag.position
+ self.position = (int(x), int(y))
self._drag.draggable = False
- self._drag = None
- if self._bubble:
- self.overlay.remove(self._bubble)
- self._bubble = None
- self.overlay = None
+ del self._drag
+ if hasattr(self, '_bubble'):
+ overlay.remove(self._bubble)
+ del self._bubble
__action__ = {
"name" : "BubbleMessage",