[hamster-applet] made the demo bit niftier
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [hamster-applet] made the demo bit niftier
- Date: Wed, 2 Dec 2009 21:51:08 +0000 (UTC)
commit 23be775ce3482c378950b6c87c51eb2166da2dcc
Author: Toms Bauģis <toms baugis gmail com>
Date: Wed Dec 2 21:50:55 2009 +0000
made the demo bit niftier
hamster/graphics.py | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/hamster/graphics.py b/hamster/graphics.py
index f71103e..3c5f9d7 100644
--- a/hamster/graphics.py
+++ b/hamster/graphics.py
@@ -215,19 +215,31 @@ class Area(gtk.DrawingArea):
class SampleArea(Area):
def __init__(self):
Area.__init__(self)
- self.rect_x, self.rect_y = 10.5, 10.5
+ self.rect_x, self.rect_y = 100, -100
self.rect_width, self.rect_height = 50, 50
+
+ self.text_y = -100
+
def on_expose(self):
# on expose is called when we are ready to draw
# fill_area is just a shortcut function
# feel free to use self.context. move_to, line_to and others
+ self.font_size = 32
+ self.layout.set_text("Hello, World!")
+
self.fill_area(self.rect_x,
self.rect_y,
self.rect_width,
self.rect_height, (168, 186, 136))
+ self.context.move_to((self.width - self.layout.get_pixel_size()[0]) / 2,
+ self.text_y)
+
+ self.context.show_layout(self.layout)
+
+
class BasicWindow:
# close the window and quit
def delete_event(self, widget, event, data=None):
@@ -254,6 +266,12 @@ class BasicWindow:
self.window.add(box)
self.window.show_all()
+
+ # drop the hello on init
+ self.graphic.animate(self.graphic,
+ dict(text_y = 120),
+ duration = 0.7,
+ easing = Easing.Bounce.easeOut)
def on_go_clicked(self, widget):
@@ -273,6 +291,7 @@ class BasicWindow:
duration = 0.8,
easing = Easing.Elastic.easeOut)
+
if __name__ == "__main__":
example = BasicWindow()
gtk.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]