hamster-applet r628 - in trunk: data hamster
- From: tbaugis svn gnome org
- To: svn-commits-list gnome org
- Subject: hamster-applet r628 - in trunk: data hamster
- Date: Mon, 17 Nov 2008 23:30:46 +0000 (UTC)
Author: tbaugis
Date: Mon Nov 17 23:30:46 2008
New Revision: 628
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=628&view=rev
Log:
show totals by category in day view
Modified:
trunk/data/menu.glade
trunk/hamster/applet.py
trunk/hamster/stuff.py
Modified: trunk/data/menu.glade
==============================================================================
--- trunk/data/menu.glade (original)
+++ trunk/data/menu.glade Mon Nov 17 23:30:46 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Thu Aug 21 13:58:01 2008 -->
+<!--Generated with glade3 3.4.5 on Mon Nov 17 23:09:58 2008 -->
<glade-interface>
<widget class="GtkWindow" id="hamster-window">
<property name="can_focus">True</property>
@@ -129,11 +129,11 @@
</widget>
</child>
<child>
- <widget class="GtkLabel" id="no_facts_today">
+ <widget class="GtkLabel" id="fact_totals">
<property name="height_request">32</property>
- <property name="sensitive">False</property>
+ <property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0.090000003576278687</property>
+ <property name="xalign">0</property>
<property name="label" translatable="yes">No records today</property>
</widget>
<packing>
Modified: trunk/hamster/applet.py
==============================================================================
--- trunk/hamster/applet.py (original)
+++ trunk/hamster/applet.py Mon Nov 17 23:30:46 2008
@@ -406,11 +406,19 @@
if len(day.facts) == 0:
self.last_activity = None
self.glade.get_widget("todays_scroll").hide()
- self.glade.get_widget("no_facts_today").show()
+
+ 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()
- self.glade.get_widget("no_facts_today").hide()
+
+ total_string = ""
+ for total in day.totals:
+ total_string += _("%(category)s: %(duration)s, ") % ({'category': total,
+ 'duration': format_duration(day.totals[total])})
+
+ total_string = total_string.rstrip(", ") # trailing slash
+ self.glade.get_widget("fact_totals").set_text(total_string)
def refresh_menu(self):
Modified: trunk/hamster/stuff.py
==============================================================================
--- trunk/hamster/stuff.py (original)
+++ trunk/hamster/stuff.py Mon Nov 17 23:30:46 2008
@@ -121,13 +121,13 @@
delta = dt.datetime.now() - fact["start_time"]
duration = 24 * delta.days + delta.seconds / 60
- fact_name = fact['name']
+ fact_category = fact['category']
- if fact_name not in self.totals:
- self.totals[fact_name] = 0
+ if fact_category not in self.totals:
+ self.totals[fact_category] = 0
if duration:
- self.totals[fact_name] += duration
+ self.totals[fact_category] += duration
current_duration = format_duration(duration)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]