[gnome-clocks] Make Renderer update time in the IconView
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Make Renderer update time in the IconView
- Date: Sat, 25 Aug 2012 19:59:20 +0000 (UTC)
commit 7483081583afd433c35f025be1943343d07cc250
Author: Seif Lotfy <seif lotfy com>
Date: Sat Aug 25 21:56:55 2012 +0200
Make Renderer update time in the IconView
Fix the Iconview to update the time time when changed. Could be
done better.
gnomeclocks/clocks.py | 1 +
gnomeclocks/widgets.py | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index 280a74b..4f20e3a 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -146,6 +146,7 @@ class World(Clock):
d.get_pixbuf(),
"<b>" + name + "</b>",
d])
+ d.set_iter(self.liststore, view_iter)
def delete_clocks(self, clocks):
for d in clocks:
diff --git a/gnomeclocks/widgets.py b/gnomeclocks/widgets.py
index 179d407..1203df5 100644
--- a/gnomeclocks/widgets.py
+++ b/gnomeclocks/widgets.py
@@ -106,6 +106,9 @@ class DigitalClock():
self.sunset = self._last_sunset
self.get_sunrise_sunset()
+ self.view_iter = None
+ self.list_store = None
+
self.id = location.id
self.timezone = self.location.get_timezone()
self.offset = self.timezone.get_offset() * 60
@@ -134,7 +137,7 @@ class DigitalClock():
if systemClockFormat == '12h':
t = time.strftime("%I:%M%p", self.get_local_time(time.time()))
else:
- t = time.strftime("%H:%M:%S", self.get_local_time(time.time()))
+ t = time.strftime("%H:%M", self.get_local_time(time.time()))
if not t == self._last_time \
or not self.sunrise == self._last_sunrise \
or not self.sunset == self._last_sunset:
@@ -150,6 +153,9 @@ class DigitalClock():
self.drawing.render(t, img, isDay)
else:
self.drawing.render(t, img, isDay, day)
+ if self.view_iter and self.list_store:
+ self.list_store.set_value(
+ self.view_iter, 1, self.drawing.pixbuf)
self.standalone.update(img, t, systemClockFormat,
self.sunrise, self.sunset)
@@ -219,6 +225,10 @@ class DigitalClock():
else:
return False
+ def set_iter(self, list_store, view_iter):
+ self.view_iter = view_iter
+ self.list_store = list_store
+
class DigitalClockStandalone(Gtk.VBox):
def __init__(self, location, sunrise, sunset):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]