[billreminder] bar colors



commit e6bd33fae798ecdadce520977d0132d017d7bbb8
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Nov 29 14:50:33 2009 +0000

    bar colors

 src/gui/maindialog.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/gui/maindialog.py b/src/gui/maindialog.py
index 1bc1b5c..509aadd 100644
--- a/src/gui/maindialog.py
+++ b/src/gui/maindialog.py
@@ -232,10 +232,13 @@ class MainDialog:
 
         records = self.actions.get_monthly_totals(start, end)
         # Chart widget takes data in format (('CategoryName', amount),)
-        categories = ['None' if not cat else cat for cat,total in records]
+        categories = [cat or 'None' for cat, total in records]
         totals = [float(total) for cat,total in records]
         #records = [(c if c else 'None',float(t)) for c,t in records]
 
+        # set bar colors
+        all_categories = self.actions.get_categories()
+        self.chart.chart.key_colors = dict([(cat.name, cat.color) for cat in all_categories])
 
         self.chart.plot(categories, totals)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]