billreminder r684 - in trunk: . src/gui



Author: ogmaciel
Date: Sat Dec 20 05:47:39 2008
New Revision: 684
URL: http://svn.gnome.org/viewvc/billreminder?rev=684&view=rev

Log:
Notify user when the end date is prior to start date.

Modified:
   trunk/ChangeLog
   trunk/src/gui/adddialog.py
   trunk/src/gui/maindialog.py

Modified: trunk/src/gui/adddialog.py
==============================================================================
--- trunk/src/gui/adddialog.py	(original)
+++ trunk/src/gui/adddialog.py	Sat Dec 20 05:47:39 2008
@@ -386,10 +386,17 @@
         frequency = self.frequency.get_active_text()
         # Extracts the date off the calendar widget
         # Create datetime object
-        selectedDate = scheduler.timestamp_from_datetime(self.dueDate.get_date())
+        selectedDate = self.dueDate.get_date()
         # End date
         if frequency != scheduler.SC_ONCE:
-            endDate = scheduler.timestamp_from_datetime(self.endDate.currentDate)
+            endDate = self.endDate.get_date()
+            # Notify user that the endDate is set in the past
+            if endDate < selectedDate:
+                endDate = selectedDate
+                message = utils.Message()
+                text = _("The end date is set to a date prior to the start date. Setting it to match the start date.")
+                title = _("Date set in the past")
+                message.ShowInfo(text=text, parentWindow=self, title=title)
         else:
             endDate = None
 
@@ -420,7 +427,7 @@
             # this will only work for new bills
             records = []
             days = scheduler.get_schedule_timestamp(
-                frequency, self.dueDate.get_date(), self.endDate.get_date())
+                frequency, selectedDate, endDate)
 
             for day in days:
                 if alarm != -1:
@@ -434,7 +441,7 @@
             # Edit existing bill
             self.currentrecord.Category = category
             self.currentrecord.Payee = payee
-            self.currentrecord.DueDate = int(selectedDate)
+            self.currentrecord.DueDate = int(scheduler.timestamp_from_datetime(selectedDate))
             self.currentrecord.AmountDue = amount
             self.currentrecord.Notes = sbuffer
             self.currentrecord.Alarm = alarm

Modified: trunk/src/gui/maindialog.py
==============================================================================
--- trunk/src/gui/maindialog.py	(original)
+++ trunk/src/gui/maindialog.py	Sat Dec 20 05:47:39 2008
@@ -377,6 +377,8 @@
     def add_bill(self):
         #selectedDate = scheduler.datetime_from_timestamp(selectedDate)
         selectedDate = self.timeline.value
+        # Convert from datetime.date to datetime.datetime
+        selectedDate = datetime.datetime(selectedDate.year, selectedDate.month, selectedDate.day)
         records = dialogs.add_dialog(parent=self.window, selectedDate=selectedDate)
 
         # Checks if the user did not cancel the action



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