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 20:28:58 (GMT)
committer dave <drykod@gmail.com>2009-10-30 20:28:58 (GMT)
commit9d3229e8e5d927807c1cb5d5cfc9438c8d7b9503 (patch)
tree2e2614122bbafeec525a731828939b83e45e0442
parent56d6689464358341360c854c45fc8c0aed0e88ec (diff)
updated bubble message with image
-rw-r--r--tutorius/overlayer.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/tutorius/overlayer.py b/tutorius/overlayer.py
index 6a2c421..2c6bd41 100644
--- a/tutorius/overlayer.py
+++ b/tutorius/overlayer.py
@@ -488,7 +488,12 @@ class TextBubbleWImg(gtk.Widget):
self.speaker = speaker
self.tailpos = tailpos
self.line_width = 5
- self.padding = 50
+ self.padding = 20
+
+ # image painting
+ self.filename = "/home/dave/Pictures/Favicon_01.png"
+ self.pixbuf = gtk.gdk.pixbuf_new_from_file(self.filename)
+ self.imgsize = (self.pixbuf.get_width(), self.pixbuf.get_height())
self._no_expose = False
self.__exposer = None
@@ -553,23 +558,19 @@ class TextBubbleWImg(gtk.Widget):
text_size = self._text_layout.get_pixel_size()
pangoctx.move_to(
int((self.allocation.width-text_size[0])/2),
- int(self.line_width))
+ int(self.line_width+self.imgsize[1]+self.padding/2))
pangoctx.show_layout(self._text_layout)
- # image painting
- filename = "/home/dave/Pictures/Favicon_01.png"
- pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
- x = pixbuf.get_width()
- y = pixbuf.get_height()
# create a new cairo surface to place the image on
#surface = cairo.ImageSurface(0,x,y)
# create a context to the new surface
#ct = cairo.Context(surface)
+ # paint image
context.set_source_pixbuf(
- pixbuf,
+ self.pixbuf,
int((self.allocation.width-text_size[0])/2),
- int(self.line_width+text_size[1]))
+ int(self.line_width+self.padding/2))
context.paint()
@@ -611,8 +612,8 @@ class TextBubbleWImg(gtk.Widget):
self._text_layout.set_markup(self.__label)
width, height = self._text_layout.get_pixel_size()
- requisition.width = int(width+2*self.padding)
- requisition.height = int(height+2*self.padding)
+ requisition.width = int(width+2*self.padding+self.imgsize[0])
+ requisition.height = int(height+2*self.padding+self.imgsize[1])
def do_size_allocate(self, allocation):
"""Save zone allocated to the widget."""