hamster-applet r747 - trunk/hamster
- From: tbaugis svn gnome org
- To: svn-commits-list gnome org
- Subject: hamster-applet r747 - trunk/hamster
- Date: Thu, 19 Feb 2009 01:47:27 +0000 (UTC)
Author: tbaugis
Date: Thu Feb 19 01:47:27 2009
New Revision: 747
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=747&view=rev
Log:
* escaping user content where we are using pango markup
* using storage.get_last_activity to get last activity - this one
returns results also for late night workers, stuck in calendar yesterday
* refreshing main menu and label on every update -
although more expensive, we win on readability
Modified:
trunk/hamster/applet.py
Modified: trunk/hamster/applet.py
==============================================================================
--- trunk/hamster/applet.py (original)
+++ trunk/hamster/applet.py Thu Feb 19 01:47:27 2009
@@ -109,6 +109,7 @@
else:
label = "%s %s" % (self.activity, self.duration)
+ label = escape_pango(label)
label = '<span gravity=\"south\">' + label + '</span>'
self.label.set_markup(label)
@@ -440,16 +441,20 @@
def load_day(self):
"""sets up today's tree and fills it with records
returns information about last activity"""
- day = DayStore(datetime.date.today());
+ today = datetime.date.today()
+ day = DayStore(today);
self.treeview.set_model(day.fact_store)
+ self.last_activity = None
+ last_activity = storage.get_last_activity()
+ if last_activity and last_activity["end_time"] == None \
+ and last_activity["start_time"].date() >= today - datetime.timedelta(days=1):
+ self.last_activity = last_activity
+
if len(day.facts) == 0:
- self.last_activity = None
self.glade.get_widget("todays_scroll").hide()
-
self.glade.get_widget("fact_totals").set_text(_("No records today"))
else:
- self.last_activity = day.facts[len(day.facts) - 1]
self.glade.get_widget("todays_scroll").show()
total_string = ""
@@ -657,9 +662,8 @@
self.update_label()
def after_fact_update(self, event, date):
- if date.date() == datetime.date.today():
- self.load_day()
- self.update_label()
+ self.load_day()
+ self.update_label()
self.__update_fact()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]