[clocks] Improve stadnalone clock



commit 4149c2acbda4eec106498b883f2469074f180c76
Author: Seif Lotfy <seif lotfy collabora co uk>
Date:   Mon May 21 16:31:24 2012 +0200

    Improve stadnalone clock

 data/cities/day.jpg |  Bin 111672 -> 79416 bytes
 data/cities/day.png |  Bin 309499 -> 271188 bytes
 main.py             |    3 ++-
 widgets.py          |   33 ++++++++++++++++++++++++---------
 4 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/data/cities/day.jpg b/data/cities/day.jpg
index a8afd76..6d29ef5 100644
Binary files a/data/cities/day.jpg and b/data/cities/day.jpg differ
diff --git a/data/cities/day.png b/data/cities/day.png
index 508d423..ce13b3e 100644
Binary files a/data/cities/day.png and b/data/cities/day.png differ
diff --git a/main.py b/main.py
index 8b058ce..087b18a 100644
--- a/main.py
+++ b/main.py
@@ -170,7 +170,8 @@ class ClocksToolbar (Gtk.Toolbar):
         self.buttonBox.hide ()
         self.newButton.hide ()
         self.applyButton.hide ()
-        self.leftBox.pack_start (self.backButton, False, False, 3)
+        if not self.backButton.get_parent ():
+          self.leftBox.pack_start (self.backButton, False, False, 3)
         self.backButton.show_all ()
 
     def _on_toggled (self, widget):
diff --git a/widgets.py b/widgets.py
index bed99a1..c8cf216 100644
--- a/widgets.py
+++ b/widgets.py
@@ -109,7 +109,7 @@ class DigitalClock ():
         self.list_store = None
 
         self.drawing = DigitalClockDrawing ()
-        self.standalone = DigitalClockStandalone ()
+        self.standalone = DigitalClockStandalone (self.location)
         self.update ()
         GObject.timeout_add(1000, self.update)
 
@@ -157,18 +157,33 @@ class DigitalClock ():
         return self.standalone
 
 
-class DigitalClockStandalone (Gtk.HBox):
-    def __init__ (self):
-        Gtk.HBox.__init__ (self, True)
+class DigitalClockStandalone (Gtk.VBox):
+    def __init__ (self, location):
+        Gtk.VBox.__init__ (self, False)
         self.img = Gtk.Image ()
-        self.label = Gtk.Label ()
-        self.pack_start (self.img, True, True, 0)
-        self.pack_start (self.label, True, True, 0)
+        self.time_label = Gtk.Label ()
+        self.city_label = Gtk.Label ()
+        self.city_label.set_markup ("<b>"+location.get_city_name()+"</b>")
+
+        box = Gtk.VBox ()
+        box.pack_start (self.img, False, False, 3)
+        box.pack_start (self.city_label, False, False, 3)
+
+        hbox = Gtk.HBox ()
+        hbox.pack_start (Gtk.Label (), True, True, 0)
+        hbox.pack_start (box, False, False, 16)
+        hbox.pack_start (Gtk.Label (), True, True, 0)
+        hbox.pack_start (self.time_label, False, False, 16)
+        hbox.pack_start (Gtk.Label (), True, True, 0)
+        self.pack_start (Gtk.Label (), True, True, 3)
+        self.pack_start (hbox, True, True, 0)
+        self.pack_start (Gtk.Label (), True, True, 6)
 
     def update (self, img, text):
-        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size (img, 256, 256)
+        pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size (img, 500, 380)
+        pixbuf = pixbuf.new_subpixbuf(0 , 0 , 208, 208)
         self.img.set_from_pixbuf (pixbuf)
-        self.label.set_markup ("<span size='xx-large'><b>%s</b></span>" %(text,))
+        self.time_label.set_markup ("<span size='72000'><b>%s</b></span>" %(text,))
 
 
 class DigitalClockDrawing (Gtk.DrawingArea):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]