[billreminder] Don't allow the end date for recurring records to be set before the start date. This should take car
- From: Og B. Maciel <ogmaciel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [billreminder] Don't allow the end date for recurring records to be set before the start date. This should take car
- Date: Sun, 12 Dec 2010 17:35:43 +0000 (UTC)
commit 3938a92348f74b5d9637a8e6b3a50c4c8e5d3212
Author: Og B. Maciel <ogmaciel gnome org>
Date: Sun Dec 12 12:35:35 2010 -0500
Don't allow the end date for recurring records to be set before the start date. This should take care of b.g.o #563736 but some refactoring will be needed.
src/gui/adddialog.py | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/adddialog.py b/src/gui/adddialog.py
index 2417c1f..5cc36ca 100644
--- a/src/gui/adddialog.py
+++ b/src/gui/adddialog.py
@@ -78,6 +78,7 @@ class AddDialog(object):
self.endDate = DatePicker()
self.ui.get_object("end_date_box").add(self.endDate)
+ self.endDate.connect('date_changed', self._on_datepicker_date_changed)
self.payee = self.ui.get_object("payee")
self.payeecompletion = gtk.EntryCompletion()
@@ -412,10 +413,26 @@ class AddDialog(object):
self.window.response(gtk.RESPONSE_ACCEPT)
def _on_datepicker_date_changed(self, widget, args):
- # Only reprogram alarm if it is not None
- print "Date changed"
- # Update endDate to be equal to dueDate
- self.endDate.set_date(self.dueDate.get_date())
+
+ startDate = self.dueDate.get_date()
+ endDate = self.endDate.get_date()
+
+ if widget == self.dueDate:
+ if startDate > endDate:
+ # Update endDate to be equal to dueDate
+ self.endDate.set_date(self.dueDate.get_date())
+ 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.window, title=title)
+ else:
+ if startDate > endDate:
+ # Update endDate to be equal to dueDate
+ self.endDate.set_date(self.dueDate.get_date())
+ 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.window, title=title)
if self.alarmbutton.get_date():
# Extracts the date off the datepicker widget
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]