diff options
Diffstat (limited to 'addons/bubblemessagewimg.py')
-rw-r--r-- | addons/bubblemessagewimg.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/addons/bubblemessagewimg.py b/addons/bubblemessagewimg.py index 974dd19..2f6c36f 100644 --- a/addons/bubblemessagewimg.py +++ b/addons/bubblemessagewimg.py @@ -23,7 +23,7 @@ class BubbleMessageWImg(Action): position = TArrayProperty((0,0), 2, 2) # Do the same for the tail position tail_pos = TArrayProperty((0,0), 2, 2) - imgpath = TResourceProperty("") + imgpath = TResourceProperty('') def __init__(self, **kwargs): """ @@ -61,7 +61,7 @@ class BubbleMessageWImg(Action): # TODO: tails are relative to tailpos. They should be relative to # the speaking widget. Same of the bubble position. self._bubble = TextBubbleWImg(text=self.message, - tailpos=self.tail_pos,imagepath=self.imgpath.default) + tailpos=self.tail_pos,imagepath=self.imgpath) self._bubble.show() self.overlay.put(self._bubble, x, y) self.overlay.queue_draw() @@ -87,17 +87,21 @@ class BubbleMessageWImg(Action): self.overlay = overlayer assert not self._drag, "bubble action set to editmode twice" x, y = self.position - self._bubble = TextBubbleWImg(text=self.message, - tailpos=self.tail_pos,imagepath=self.imgpath) - self.overlay.put(self._bubble, x, y) - self._bubble.show() + if self.imgpath: + self._bubble = TextBubbleWImg(text=self.message, + tailpos=self.tail_pos,imagepath=self.imgpath) + self.overlay.put(self._bubble, x, y) + self._bubble.show() - self._drag = DragWrapper(self._bubble, self.position, update_action_cb=self.update_property, draggable=True) + self._drag = DragWrapper(self._bubble, self.position, + update_action_cb=self.update_property, + draggable=True) def exit_editmode(self, *args): - x,y = self._drag.position - self.position = (int(x), int(y)) if self._drag: + x,y = self._drag.position + self.position = (int(x), int(y)) + self._drag.draggable = False self._drag = None if self._bubble: @@ -110,6 +114,6 @@ __action__ = { "display_name" : "Message Bubble with image", "icon" : "message-bubble", "class" : BubbleMessageWImg, - "mandatory_props" : ["message",'imgpath'] + "mandatory_props" : ["message"] } |