Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordave <drykod@gmail.com>2009-10-30 21:10:46 (GMT)
committer dave <drykod@gmail.com>2009-10-30 21:10:46 (GMT)
commitd3652ff76a15977328d60860ed05b5cc52fdec4c (patch)
tree365ff4acd499051aaf0bc2aece1fdda788c579c0
parent9d3229e8e5d927807c1cb5d5cfc9438c8d7b9503 (diff)
update bubble msg w image
-rw-r--r--addons/bubblemessagewimg.py16
-rw-r--r--tutorius/overlayer.py4
2 files changed, 13 insertions, 7 deletions
diff --git a/addons/bubblemessagewimg.py b/addons/bubblemessagewimg.py
index eb0f750..b214460 100644
--- a/addons/bubblemessagewimg.py
+++ b/addons/bubblemessagewimg.py
@@ -24,8 +24,9 @@ class BubbleMessageWImg(Action):
position = TArrayProperty((0,0), 2, 2)
# Do the same for the tail position
tail_pos = TArrayProperty((0,0), 2, 2)
-
- def __init__(self, message=None, position=None, speaker=None, tail_pos=None):
+ imgpath = TStringProperty("")
+
+ def __init__(self, message=None, position=None, speaker=None, tail_pos=None, imgpath=None):
"""
Shows a dialog with a given text, at the given position on the screen.
@@ -43,6 +44,11 @@ class BubbleMessageWImg(Action):
self.tail_pos = tail_pos
if message:
self.message = message
+ if imgpath:
+ self.imgpath = imgpath
+
+ # temporary image file path
+ self.imgpath = "/home/dave/Pictures/Favicon_01.png"
self.overlay = None
self._bubble = None
@@ -66,7 +72,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 = overlayer.TextBubbleWImg(text=self.message,
- tailpos=self.tail_pos)
+ tailpos=self.tail_pos,imagepath=self.imgpath)
self._bubble.show()
self.overlay.put(self._bubble, x, y)
self.overlay.queue_draw()
@@ -89,7 +95,7 @@ class BubbleMessageWImg(Action):
assert not self._drag, "bubble action set to editmode twice"
x, y = self.position
self._bubble = overlayer.TextBubbleWImg(text=self.message,
- tailpos=self.tail_pos)
+ tailpos=self.tail_pos,imagepath=self.imgpath)
self.overlay.put(self._bubble, x, y)
self._bubble.show()
@@ -111,6 +117,6 @@ __action__ = {
"display_name" : "Message Bubble with image",
"icon" : "message-bubble",
"class" : BubbleMessageWImg,
- "mandatory_props" : ["message"]
+ "mandatory_props" : ["message",'imgpath']
}
diff --git a/tutorius/overlayer.py b/tutorius/overlayer.py
index 2c6bd41..17734cd 100644
--- a/tutorius/overlayer.py
+++ b/tutorius/overlayer.py
@@ -468,7 +468,7 @@ class TextBubbleWImg(gtk.Widget):
A CanvasDrawableWidget drawing a round textbox and a tail pointing
to a specified widget.
"""
- def __init__(self, text, speaker=None, tailpos=(0,0)):
+ def __init__(self, text, speaker=None, tailpos=(0,0), imagepath=None):
"""
Creates a new cairo rendered text bubble.
@@ -491,7 +491,7 @@ class TextBubbleWImg(gtk.Widget):
self.padding = 20
# image painting
- self.filename = "/home/dave/Pictures/Favicon_01.png"
+ self.filename = imagepath
self.pixbuf = gtk.gdk.pixbuf_new_from_file(self.filename)
self.imgsize = (self.pixbuf.get_width(), self.pixbuf.get_height())