[billreminder] First cut at getting UI handling new relationship between Bill and Category.



commit 8427a2bc067458f80f7ae785fdcc07698c3a954e
Author: Og B. Maciel <ogmaciel gnome org>
Date:   Thu Nov 26 18:24:20 2009 -0500

    First cut at getting UI handling new relationship between Bill and Category.

 src/gui/adddialog.py  |    5 ++---
 src/gui/maindialog.py |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/adddialog.py b/src/gui/adddialog.py
index c3efe90..a073be3 100644
--- a/src/gui/adddialog.py
+++ b/src/gui/adddialog.py
@@ -438,7 +438,7 @@ class AddDialog(gtk.Dialog):
                     alarm = self.__get_alarm_date(day)
                 rec = Bill(payee, amount, day, sbuffer, 0)
                 if category:
-                    rec.category.append(category)
+                    rec.category = category
                 #rec = Bill(payee, category, day, amount, sbuffer, 0, -1, alarm)
                 records.append (rec)
 
@@ -452,8 +452,7 @@ class AddDialog(gtk.Dialog):
             self.currentrecord.notes = sbuffer
             #self.currentrecord.alarm = alarm
             if category:
-                self.currentrecord.category = []
-                self.currentrecord.category.append(category)
+                self.currentrecord.category = category
 
             #return the bill
             return [self.currentrecord]
diff --git a/src/gui/maindialog.py b/src/gui/maindialog.py
index 927423b..c0565d7 100644
--- a/src/gui/maindialog.py
+++ b/src/gui/maindialog.py
@@ -22,7 +22,6 @@ from gui.widgets.timeline import Timeline, Bullet
 from lib.bill import Bill
 from lib.dal import DAL
 from lib.actions import Actions
-from db.billstable import BillsTable
 
 # Import common utilities
 from lib import common
@@ -272,8 +271,8 @@ class MainDialog:
     def format_row(self, row):
         """ Formats a bill to be displayed as a row. """
 
-        categoryName = len(row.category) and row.category[0].name or _('None')
-        categoryColor = len(row.category) and row.category[0].color or '#d3d7cf'
+        categoryName = row.category.name if row.category else _('None')
+        categoryColor = row.category.color if row.category else '#d3d7cf'
         formatted = [
             row.id,
             create_pixbuf(color=categoryColor),



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