[billreminder] Re-wire timeline code to fetch records based on date range displayed; handle editing existing Bill o



commit 8fe0751c5b161363c263ddd8f9d7ffd60e7fa30a
Author: Og B. Maciel <ogmaciel gnome org>
Date:   Fri Oct 2 22:25:56 2009 -0400

    Re-wire timeline code to fetch records based on date range displayed; handle editing existing Bill objects.

 src/gui/adddialog.py  |   23 +++++++++++++----------
 src/gui/maindialog.py |   11 +++--------
 2 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/src/gui/adddialog.py b/src/gui/adddialog.py
index c83f1eb..464ccad 100644
--- a/src/gui/adddialog.py
+++ b/src/gui/adddialog.py
@@ -268,19 +268,22 @@ class AddDialog(gtk.Dialog):
         dt = self.currentrecord.dueDate
         self.dueDate.set_date(dt)
         utils.select_combo_text(self.payee, self.currentrecord.payee)
-        actions = Actions()
-        records = actions.get_categories(id=self.currentrecord.category[0])
-        if records:
-            categoryname = records[0].name
-            utils.select_combo_text(self.category, categoryname, 1)
+
+        if self.currentrecord.category:
+            actions = Actions()
+            records = actions.get_categories(id=self.currentrecord.category[0])
+            if records:
+                categoryname = records[0].name
+                utils.select_combo_text(self.category, categoryname, 1)
         else:
             self.category.set_active(0)
 
-        self.txtbuffer.set_text(self.currentrecord.notes)
+        if self.currentrecord.notes:
+            self.txtbuffer.set_text(self.currentrecord.notes)
         #self.chkPaid.set_active(self.currentrecord.Paid)
 
-        if self.currentrecord.alarm > 0:
-            self.alarmbutton.set_date(self.currentrecord.alarm)
+        #if self.currentrecord.alarm > 0:
+        #    self.alarmbutton.set_date(self.currentrecord.alarm)
 
     def _populate_payee(self):
         """ Populates combobox with existing payees """
@@ -444,9 +447,9 @@ class AddDialog(gtk.Dialog):
             # Edit existing bill
             self.currentrecord.payee = payee
             self.currentrecord.dueDate = selectedDate
-            self.currentrecord.amountDue = amount
+            self.currentrecord.amount = amount
             self.currentrecord.notes = sbuffer
-            self.currentrecord.alarm = alarm
+            #self.currentrecord.alarm = alarm
             if category:
                 self.currentrecord.category.append(category)
 
diff --git a/src/gui/maindialog.py b/src/gui/maindialog.py
index ee09e1a..82f0abd 100644
--- a/src/gui/maindialog.py
+++ b/src/gui/maindialog.py
@@ -124,7 +124,7 @@ class MainDialog:
         # Timeline
         self.timelinebox = gtk.HBox(homogeneous=False, spacing=4)
         self.timeline = Timeline(callback=self.on_timeline_cb)
-        #self.timeline.connect("value-changed", self._on_timeline_changed)
+        self.timeline.connect("value-changed", self._on_timeline_changed)
         ## Pack it all up
         self.timelinebox.pack_start(self.timeline, expand=True, fill=True)
 
@@ -261,7 +261,7 @@ class MainDialog:
         # Populate treeview
         self.populate_view(records)
         # Update status bar
-        #self._update_statusbar()
+        self.update_statusbar()
         # populate chart
         #self._populate_chart(status, first, last)
 
@@ -400,12 +400,7 @@ class MainDialog:
             for rec in records:
                 try:
                     # Edit bill to database
-                    self.actions.edit_bill(rec.Dictionary)
-                    # Update list with updated record
-                    idx = self.list.get_cursor()[0][0]
-                    self.list.listStore[idx] = \
-                        self.format_row(rec.Dictionary)
-                    self.update_statusbar(idx)
+                    rec = self.actions.add_bill(rec)
                 except Exception, e:
                     print str(e)
             # Reload records tree (something changed)



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