[billreminder] Set repeats=True for repeating bills. This will allows us to eventually warn users about deleting a



commit 6263a94937ee95cef1ea267045f1a0c7ba6f316b
Author: Og B. Maciel <ogmaciel gnome org>
Date:   Wed Dec 2 23:12:47 2009 -0500

    Set repeats=True for repeating bills. This will allows us to eventually warn users about deleting a repeatable bill and prompt if all other remaining bills should also be deleted, etc.

 src/gui/adddialog.py          |   14 ++++++++++----
 src/gui/widgets/datepicker.py |    2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/adddialog.py b/src/gui/adddialog.py
index cda0592..2e1bd59 100644
--- a/src/gui/adddialog.py
+++ b/src/gui/adddialog.py
@@ -30,7 +30,7 @@ class AddDialog(object):
     def __init__(self, title=None, parent=None, record=None, selectedDate=None):
         self.ui = gtk.Builder()
         self.ui.add_from_file(os.path.join(DEFAULT_CFG_PATH, "add_bill.ui"))
-        
+
         self.window = self.ui.get_object("add_bill_dialog")
 
         self.window.set_icon_from_file(common.APP_ICON)
@@ -319,17 +319,23 @@ class AddDialog(object):
             # Verify how many bills will be inserted
             # this will only work for new bills
             records = []
+
+            # Figures out how many times we're repeating this bill
             days = scheduler.get_schedule_date(
                 frequency, selectedDate, endDate)
 
             for day in days:
                 if alarm != -1:
                     alarm = self.__get_alarm_date(day)
-                rec = Bill(payee, amount, day, sbuffer, 0)
+                rec = Bill(payee, amount, day, sbuffer, False)
+
+                # Bill repeats...
+                if len(days) > 1:
+                    rec.repeats = True
+                # ... and has a category.
                 if category:
                     rec.category = category
-                #rec = Bill(payee, category, day, amount, sbuffer, 0, -1, alarm)
-                records.append (rec)
+                records.append(rec)
             return records
         else:
             # Edit existing bill
diff --git a/src/gui/widgets/datepicker.py b/src/gui/widgets/datepicker.py
index 554e2ee..99beb1f 100644
--- a/src/gui/widgets/datepicker.py
+++ b/src/gui/widgets/datepicker.py
@@ -31,7 +31,7 @@ class DatePicker(gtk.VBox):
 
         # Create a new calendar
         self.calendar = gtk.Calendar()
-        self.calendar.select_month(date.month, date.year)
+        self.calendar.select_month(date.month - 1, date.year)
         self.calendar.select_day(date.day)
 
         # Label to display the date selected



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