hamster-applet r516 - in trunk: . hamster
- From: wbolster svn gnome org
- To: svn-commits-list gnome org
- Subject: hamster-applet r516 - in trunk: . hamster
- Date: Mon, 15 Sep 2008 13:32:12 +0000 (UTC)
Author: wbolster
Date: Mon Sep 15 13:32:12 2008
New Revision: 516
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=516&view=rev
Log:
2008-09-15 Wouter Bolsterlee <wbolster svn gnome org>
* hamster/reports.py:
* hamster/stats.py:
Use American English date formats. Fixes the issues
in comments 31, 32, 33, 34, and 35 of bug #552156.
Modified:
trunk/ChangeLog
trunk/hamster/reports.py
trunk/hamster/stats.py
Modified: trunk/hamster/reports.py
==============================================================================
--- trunk/hamster/reports.py (original)
+++ trunk/hamster/reports.py Mon Sep 15 13:32:12 2008
@@ -26,14 +26,14 @@
if start_date.year != end_date.year:
- title = _("Overview for %(start_B)s %(start_d)s. %(start_Y)s - %(end_B)s %(end_d)s. %(end_Y)s") % dates_dict
+ title = _("Overview for %(start_B)s %(start_d)s, %(start_Y)s â %(end_B)s %(end_d)s, %(end_Y)s") % dates_dict
elif start_date.month != end_date.month:
- title = _("Overview for %(start_B)s %(start_d)s. - %(end_B)s %(end_d)s. %(end_Y)s") % dates_dict
+ title = _("Overview for %(start_B)s %(start_d)s â %(end_B)s %(end_d)s, %(end_Y)s") % dates_dict
else:
- title = _("Overview for %(start_B)s %(start_d)s - %(end_d)s. %(end_Y)s") % dates_dict
+ title = _("Overview for %(start_B)s %(start_d)s â %(end_d)s, %(end_Y)s") % dates_dict
if start_date == end_date:
- title = _("Overview for %(start_B)s %(start_d)s. %(start_Y)s") % dates_dict
+ title = _("Overview for %(start_B)s %(start_d)s, %(start_Y)s") % dates_dict
report_path = os.path.join(os.path.expanduser("~"), "%s.html" % title)
@@ -108,7 +108,7 @@
<td>%s</td>
<td>%s</td>
<td>%s</td>
-</tr>""" % (_("%(report_d)s.%(report_m)s.%(report_Y)s") % stuff.dateDict(fact["start_time"], "report_"),
+</tr>""" % (_("%(report_b)s %(report_d)s, %(report_Y)s") % stuff.dateDict(fact["start_time"], "report_"),
fact["name"],
category,
fact["start_time"].strftime('%H:%M'),
Modified: trunk/hamster/stats.py
==============================================================================
--- trunk/hamster/stats.py (original)
+++ trunk/hamster/stats.py Mon Sep 15 13:32:12 2008
@@ -156,38 +156,37 @@
def get_facts(self):
self.fact_store.clear()
totals = {}
-
+
by_activity = {}
by_category = {}
by_day = {}
-
+
week = {"days": [], "totals": []}
-
+
facts = storage.get_facts(self.start_date, self.end_date)
-
+
for i in range((self.end_date - self.start_date).days + 1):
current_date = self.start_date + dt.timedelta(i)
# date format in overview window fact listing
# prefix is "o_",letter after prefix is regular python format. you can use all of them
- fact_date = _("%(o_A)s, %(o_b)s %(o_d)s.") % stuff.dateDict(current_date, "o_")
-
-
+ fact_date = _("%(o_A)s, %(o_b)s %(o_d)s") % stuff.dateDict(current_date, "o_")
+
day_row = self.fact_store.append(None, [-1,
fact_date,
"",
current_date.strftime('%Y-%m-%d')])
by_day[self.start_date + dt.timedelta(i)] = {"duration": 0, "row_pointer": day_row}
-
+
for fact in facts:
start_date = fact["start_time"].date()
-
+
duration = None
if fact["end_time"]: # not set if just started
delta = fact["end_time"] - fact["start_time"]
duration = 24 * delta.days + delta.seconds / 60
elif fact["start_time"].date() == dt.date.today():
delta = dt.datetime.now() - fact["start_time"]
- duration = 24 * delta.days + delta.seconds / 60
+ duration = 24 * delta.days + delta.seconds / 60
self.fact_store.append(by_day[start_date]["row_pointer"],
[fact["id"],
@@ -196,7 +195,7 @@
stuff.format_duration(duration),
fact["start_time"].strftime('%Y-%m-%d')
])
-
+
if fact["name"] not in by_activity: by_activity[fact["name"]] = 0
if fact["category"] not in by_category: by_category[fact["category"]] = 0
@@ -204,7 +203,7 @@
by_day[start_date]["duration"] += duration
by_activity[fact["name"]] += duration
by_category[fact["category"]] += duration
-
+
days = 30
if self.week_view.get_active():
days = 7
@@ -220,7 +219,7 @@
else:
# date format in month chart in overview window (click on "month" to see it)
# prefix is "m_", letter after prefix is regular python format. you can use all of them
- strday = _("%(m_d)s., %(m_b)s") % stuff.dateDict(day, "m_")
+ strday = _("%(m_b)s %(m_d)s") % stuff.dateDict(day, "m_")
background = None
if day.weekday() in [5, 6]:
@@ -272,23 +271,23 @@
# overview label if start and end years don't match
# letter after prefixes (start_, end_) is the one of
# standard python date formatting ones- you can use all of them
- overview_label = _("Overview for %(start_B)s %(start_d)s. %(start_Y)s - %(end_B)s %(end_d)s. %(end_Y)s") % dates_dict
+ overview_label = _("Overview for %(start_B)s %(start_d)s, %(start_Y)s â %(end_B)s %(end_d)s, %(end_Y)s") % dates_dict
elif self.start_date.month != self.end_date.month:
#overview label if start and end month do not match
# letter after prefixes (start_, end_) is the one of
# standard python date formatting ones- you can use all of them
- overview_label = _("Overview for %(start_B)s %(start_d)s. - %(end_B)s %(end_d)s. %(end_Y)s") % dates_dict
+ overview_label = _("Overview for %(start_B)s %(start_d)s â %(end_B)s %(end_d)s, %(end_Y)s") % dates_dict
else:
#overview label for interval in same month
# letter after prefixes (start_, end_) is the one of
# standard python date formatting ones- you can use all of them
- overview_label = _("Overview for %(start_B)s %(start_d)s - %(end_d)s. %(end_Y)s") % dates_dict
+ overview_label = _("Overview for %(start_B)s %(start_d)s â %(end_d)s, %(end_Y)s") % dates_dict
if self.day_view.get_active():
# overview label for single day
# letter after prefixes (start_, end_) is the one of
# standard python date formatting ones- you can use all of them
- overview_label = _("Overview for %(start_B)s %(start_d)s. %(start_Y)s") % dates_dict
+ overview_label = _("Overview for %(start_B)s %(start_d)s, %(start_Y)s") % dates_dict
dayview_caption = _("Day")
elif self.week_view.get_active():
dayview_caption = _("Week")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]