[hamster-applet] differentiate between None and an empty list in case of facts
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [hamster-applet] differentiate between None and an empty list in case of facts
- Date: Tue, 22 Dec 2009 23:37:43 +0000 (UTC)
commit d828f24a50f66f8737d41dab2a8a35018812e228
Author: Toms Bauģis <toms baugis gmail com>
Date: Tue Dec 22 23:36:52 2009 +0000
differentiate between None and an empty list in case of facts
hamster/stats_overview.py | 14 +++++++++++++-
hamster/stats_reports.py | 10 ++++++----
2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/hamster/stats_overview.py b/hamster/stats_overview.py
index cd72bc1..8da0235 100644
--- a/hamster/stats_overview.py
+++ b/hamster/stats_overview.py
@@ -75,7 +75,9 @@ class OverviewBox(gtk.VBox):
runtime.dispatcher.add_handler('day_updated', self.after_activity_update)
def fill_facts_tree(self, facts = None):
- facts = facts or runtime.storage.get_facts(self.start_date, self.end_date)
+ if facts is None:
+ facts = runtime.storage.get_facts(self.start_date, self.end_date)
+
self.fact_tree.detach_model()
self.fact_tree.clear()
@@ -102,6 +104,16 @@ class OverviewBox(gtk.VBox):
self.fill_facts_tree(facts)
""" events """
+ def on_edit_clicked(self, button):
+ selection = self.fact_tree.get_selection()
+ (model, iter) = selection.get_selected()
+
+ if model[iter][0] == -1:
+ return #not a fact
+
+ custom_fact = CustomFactController(self, None, model[iter][0])
+ custom_fact.show()
+
def after_activity_update(self, widget, renames):
self.fill_facts_tree()
diff --git a/hamster/stats_reports.py b/hamster/stats_reports.py
index a9fe0c7..cad043a 100644
--- a/hamster/stats_reports.py
+++ b/hamster/stats_reports.py
@@ -120,6 +120,7 @@ class ReportsBox(gtk.VBox):
def search(self, start_date, end_date, facts):
+ self.facts = facts
self.start_date = start_date
self.end_date = end_date
self.fill_totals_tree(facts)
@@ -128,8 +129,8 @@ class ReportsBox(gtk.VBox):
def fill_totals_tree(self, facts = None):
- facts = facts or runtime.storage.get_facts(self.start_date, self.end_date)
-
+ if facts is None:
+ facts = runtime.storage.get_facts(self.start_date, self.end_date)
#first group by category, activity and tags
#sort before grouping
@@ -261,7 +262,8 @@ class ReportsBox(gtk.VBox):
stack_keys = all_categories)
def do_graph(self, facts = None):
- facts = facts or runtime.storage.get_facts(self.start_date, self.end_date)
+ if facts is None:
+ facts = runtime.storage.get_facts(self.start_date, self.end_date)
self.fill_totals_tree(facts)
@@ -336,7 +338,7 @@ class ReportsBox(gtk.VBox):
categories):
self.report_chooser = None
- facts = runtime.storage.get_facts(start_date, end_date, category_id = categories)
+ facts = runtime.storage.get_facts(start_date, end_date)
reports.simple(facts,
start_date,
end_date,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]