[clocks] Fix style issue and improve standalone clock widget.
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clocks] Fix style issue and improve standalone clock widget.
- Date: Mon, 21 May 2012 17:07:16 +0000 (UTC)
commit 9aa17bc5492d47cf87ec06053a32e852ca81e521
Author: Seif Lotfy <seif lotfy collabora co uk>
Date: Mon May 21 19:06:47 2012 +0200
Fix style issue and improve standalone clock widget.
clocks.py | 18 +++++++++++++-----
main.py | 3 ++-
widgets.py | 13 ++++++++++---
3 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/clocks.py b/clocks.py
index 5c578e7..102930e 100644
--- a/clocks.py
+++ b/clocks.py
@@ -70,6 +70,9 @@ class Clock (Gtk.EventBox):
def add_new_clock(self):
pass
+
+ def unselect_all (self):
+ pass
class World (Clock):
def __init__ (self):
@@ -81,14 +84,14 @@ class World (Clock):
#self.add(self.grid)
self.liststore = liststore = Gtk.ListStore(Pixbuf, str, GObject.TYPE_PYOBJECT)
- iconview = Gtk.IconView.new()
+ self.iconview = iconview = Gtk.IconView.new()
iconview.set_model(liststore)
iconview.set_spacing(3)
iconview.set_pixbuf_column(0)
iconview.set_markup_column(1)
- iconview.set_item_width(160)
+ iconview.set_item_width(32)
scrolledwindow = Gtk.ScrolledWindow()
scrolledwindow.add(iconview)
@@ -100,10 +103,15 @@ class World (Clock):
self.load_clocks()
self.show_all()
+ def unselect_all (self):
+ self.iconview.unselect_all ()
+
def _on_selection_changed (self, iconview):
- path = iconview.get_selected_items ()[0]
- d = self.liststore [path][2]
- self.emit ("show-clock", d)
+ items = iconview.get_selected_items ()
+ if items:
+ path = iconview.get_selected_items ()[0]
+ d = self.liststore [path][2]
+ self.emit ("show-clock", d)
def set_addButton(self, btn):
self.addButton = btn
diff --git a/main.py b/main.py
index 087b18a..a0d3d75 100644
--- a/main.py
+++ b/main.py
@@ -76,6 +76,7 @@ class Window (Gtk.Window):
def _on_view_clock (self, button, index):
self.notebook.set_current_page (index)
self.toolbar._set_overview_toolbar ()
+ self.notebook.get_nth_page(index).unselect_all()
def _on_new_clicked (self, button):
self.show_all()
@@ -88,7 +89,7 @@ class ClocksToolbar (Gtk.Toolbar):
None, (GObject.TYPE_INT,))}
def __init__ (self):
Gtk.Toolbar.__init__ (self)
- self.get_style_context ().add_class ("osd");
+ #self.get_style_context ().add_class ("osd");
self.set_size_request(-1, -1)
self.get_style_context ().add_class (Gtk.STYLE_CLASS_MENUBAR);
diff --git a/widgets.py b/widgets.py
index c8cf216..0ffe8c4 100644
--- a/widgets.py
+++ b/widgets.py
@@ -173,11 +173,18 @@ class DigitalClockStandalone (Gtk.VBox):
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)
+
+ box = Gtk.VBox ()
+ box.pack_start (Gtk.Label (), True, True, 3)
+ box.pack_start (self.time_label, False, False, 3)
+ box.pack_start (Gtk.Label (), True, True, 66)
+
+ hbox.pack_start (box, False, False, 16)
hbox.pack_start (Gtk.Label (), True, True, 0)
- self.pack_start (Gtk.Label (), True, True, 3)
+
+ self.pack_start (Gtk.Label (), True, True, 12)
self.pack_start (hbox, True, True, 0)
- self.pack_start (Gtk.Label (), True, True, 6)
+ self.pack_start (Gtk.Label (), True, True, 3)
def update (self, img, text):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size (img, 500, 380)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]