billreminder r676 - in trunk: . po src/gui src/gui/widgets



Author: ogmaciel
Date: Mon Nov 17 00:35:48 2008
New Revision: 676
URL: http://svn.gnome.org/viewvc/billreminder?rev=676&view=rev

Log:
Added new DatePicker widget and replaced calendar with it; updated the translation catalog. More work is required to make the add/edit dialog fully functional.

Added:
   trunk/src/gui/widgets/datepicker.py
Modified:
   trunk/ChangeLog
   trunk/po/POTFILES.in
   trunk/po/billreminder.pot
   trunk/po/pt_BR.po
   trunk/src/gui/adddialog.py
   trunk/src/gui/maindialog.py
   trunk/src/gui/widgets/Makefile.am

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Mon Nov 17 00:35:48 2008
@@ -20,7 +20,7 @@
 src/gui/categoriesdialog.py
 src/gui/maindialog.py
 src/gui/prefdialog.py
-src/gui/widgets/calendarwidget.py
+src/gui/widgets/datepicker.py
 src/gui/widgets/datebutton.py
 src/gui/widgets/genericlistview.py
 src/gui/widgets/statusbar.py

Modified: trunk/po/billreminder.pot
==============================================================================
--- trunk/po/billreminder.pot	(original)
+++ trunk/po/billreminder.pot	Mon Nov 17 00:35:48 2008
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-10-05 17:31-0400\n"
+"POT-Creation-Date: 2008-11-16 19:32-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL ADDRESS>\n"
 "Language-Team: LANGUAGE <LL li org>\n"
@@ -211,8 +211,8 @@
 msgstr ""
 
 #. Button Title
-#: ../src/daemon/alarm.py:128 ../src/gui/maindialog.py:314
-#: ../src/gui/maindialog.py:347 ../src/lib/utils.py:135
+#: ../src/daemon/alarm.py:128 ../src/gui/maindialog.py:298
+#: ../src/gui/maindialog.py:331 ../src/lib/utils.py:135
 msgid "Mark as paid"
 msgstr ""
 
@@ -220,28 +220,28 @@
 msgid "Edit"
 msgstr ""
 
-#: ../src/daemon/main.py:118
+#: ../src/daemon/main.py:85
 #, python-format
 msgid "Lock File found: You have another instance running. (pid=%d)"
 msgstr ""
 
-#: ../src/daemon/main.py:123
+#: ../src/daemon/main.py:90
 msgid "Lock File found: Possibly the program was exited unexpectedly."
 msgstr ""
 
-#: ../src/daemon/main.py:126
+#: ../src/daemon/main.py:93
 msgid "Removing Lock File..."
 msgstr ""
 
-#: ../src/daemon/main.py:128
+#: ../src/daemon/main.py:95
 msgid "Successfully."
 msgstr ""
 
-#: ../src/daemon/main.py:130
+#: ../src/daemon/main.py:97
 msgid "Failed."
 msgstr ""
 
-#: ../src/daemon/main.py:134
+#: ../src/daemon/main.py:101
 msgid "BillReminder Notifier is already running."
 msgstr ""
 
@@ -253,72 +253,82 @@
 msgid "BillReminder Website"
 msgstr ""
 
-#: ../src/gui/adddialog.py:96
-msgid "<b>_Due Date:</b>"
-msgstr ""
-
-#: ../src/gui/adddialog.py:104
+#: ../src/gui/adddialog.py:95
 msgid "<b>_Repeat:</b>"
 msgstr ""
 
-#: ../src/gui/adddialog.py:108
+#: ../src/gui/adddialog.py:99
 msgid "How many times to repeat this bill."
 msgstr ""
 
-#: ../src/gui/adddialog.py:141
+#: ../src/gui/adddialog.py:125
 msgid "<b>_Payee:</b>"
 msgstr ""
 
-#: ../src/gui/adddialog.py:144
+#: ../src/gui/adddialog.py:128
 msgid "<b>_Amount:</b>"
 msgstr ""
 
-#: ../src/gui/adddialog.py:147
+#: ../src/gui/adddialog.py:131
 msgid "<b>_Category:</b>"
 msgstr ""
 
-#: ../src/gui/adddialog.py:150
+#: ../src/gui/adddialog.py:134
 msgid "<b>_Notes:</b>"
 msgstr ""
 
-#: ../src/gui/adddialog.py:153
+#: ../src/gui/adddialog.py:137
 msgid "<b>A_larm:</b>"
 msgstr ""
 
-#: ../src/gui/adddialog.py:179
+#: ../src/gui/adddialog.py:163
 msgid "Manage Categories"
 msgstr ""
 
-#: ../src/gui/adddialog.py:202 ../src/gui/widgets/datebutton.py:40
+#: ../src/gui/adddialog.py:187 ../src/gui/widgets/datebutton.py:40
 msgid "Select Date and Time"
 msgstr ""
 
+#: ../src/gui/adddialog.py:191
+msgid "<b>Due Date:</b>"
+msgstr ""
+
+#. TRANSLATORS: This is the end date for repeating bills.
+#: ../src/gui/adddialog.py:195
+msgid "<b>End:</b>"
+msgstr ""
+
+#. # Expander
+#: ../src/gui/adddialog.py:229
+msgid "<b>Optional Fields:</b>"
+msgstr ""
+
 #. TRANSLATORS: No date selected
-#: ../src/gui/adddialog.py:336 ../src/gui/adddialog.py:360
-#: ../src/gui/maindialog.py:295 ../src/gui/widgets/datebutton.py:18
+#: ../src/gui/adddialog.py:345 ../src/gui/adddialog.py:369
+#: ../src/gui/maindialog.py:279 ../src/gui/widgets/datebutton.py:18
 #: ../src/gui/widgets/datebutton.py:26
 msgid "None"
 msgstr ""
 
-#: ../src/gui/adddialog.py:342 ../src/gui/categoriesdialog.py:48
+#: ../src/gui/adddialog.py:351 ../src/gui/categoriesdialog.py:48
 msgid "New Category"
 msgstr ""
 
-#: ../src/gui/adddialog.py:477
+#: ../src/gui/adddialog.py:486
 #, python-format
 msgid "\"%s\" and \"%s\" are required fields."
 msgstr ""
 
-#: ../src/gui/adddialog.py:478 ../src/gui/adddialog.py:482
+#: ../src/gui/adddialog.py:487 ../src/gui/adddialog.py:491
 #: ../src/gui/widgets/viewbill.py:89
 msgid "Payee"
 msgstr ""
 
-#: ../src/gui/adddialog.py:478 ../src/gui/widgets/viewbill.py:93
+#: ../src/gui/adddialog.py:487 ../src/gui/widgets/viewbill.py:93
 msgid "Amount"
 msgstr ""
 
-#: ../src/gui/adddialog.py:482
+#: ../src/gui/adddialog.py:491
 #, python-format
 msgid "\"%s\" is required field."
 msgstr ""
@@ -358,119 +368,119 @@
 msgstr[0] ""
 msgstr[1] ""
 
-#: ../src/gui/categoriesdialog.py:248 ../src/gui/maindialog.py:581
+#: ../src/gui/categoriesdialog.py:248 ../src/gui/maindialog.py:564
 msgid "Confirmation"
 msgstr ""
 
-#: ../src/gui/maindialog.py:307
+#: ../src/gui/maindialog.py:291
 msgid "New"
 msgstr ""
 
 #. Dialog Title
-#: ../src/gui/maindialog.py:307 ../src/gui/maindialog.py:343
+#: ../src/gui/maindialog.py:291 ../src/gui/maindialog.py:327
 #: ../src/lib/dialogs.py:51
 msgid "Add a new bill"
 msgstr ""
 
 #. Dialog Title
-#: ../src/gui/maindialog.py:309 ../src/gui/maindialog.py:344
+#: ../src/gui/maindialog.py:293 ../src/gui/maindialog.py:328
 #: ../src/lib/dialogs.py:62
 msgid "Edit a bill"
 msgstr ""
 
-#: ../src/gui/maindialog.py:311 ../src/gui/maindialog.py:345
+#: ../src/gui/maindialog.py:295 ../src/gui/maindialog.py:329
 msgid "Delete selected bill"
 msgstr ""
 
-#: ../src/gui/maindialog.py:314 ../src/gui/widgets/viewbill.py:97
+#: ../src/gui/maindialog.py:298 ../src/gui/widgets/viewbill.py:97
 msgid "Paid"
 msgstr ""
 
-#: ../src/gui/maindialog.py:317
+#: ../src/gui/maindialog.py:301
 msgid "Not Paid"
 msgstr ""
 
-#: ../src/gui/maindialog.py:317 ../src/gui/maindialog.py:348
+#: ../src/gui/maindialog.py:301 ../src/gui/maindialog.py:332
 msgid "Mark as not paid"
 msgstr ""
 
-#: ../src/gui/maindialog.py:342
+#: ../src/gui/maindialog.py:326
 msgid "_File"
 msgstr ""
 
-#: ../src/gui/maindialog.py:343 ../src/gui/maindialog.py:539
+#: ../src/gui/maindialog.py:327 ../src/gui/maindialog.py:522
 msgid "_Add New"
 msgstr ""
 
-#: ../src/gui/maindialog.py:346
+#: ../src/gui/maindialog.py:330
 msgid "_Edit"
 msgstr ""
 
-#: ../src/gui/maindialog.py:347 ../src/gui/maindialog.py:549
+#: ../src/gui/maindialog.py:331 ../src/gui/maindialog.py:532
 msgid "_Paid"
 msgstr ""
 
-#: ../src/gui/maindialog.py:348
+#: ../src/gui/maindialog.py:332
 msgid "_Not Paid"
 msgstr ""
 
-#: ../src/gui/maindialog.py:349
+#: ../src/gui/maindialog.py:333
 msgid "Edit preferences"
 msgstr ""
 
-#: ../src/gui/maindialog.py:350
+#: ../src/gui/maindialog.py:334
 msgid "Quit the Program"
 msgstr ""
 
-#: ../src/gui/maindialog.py:351
+#: ../src/gui/maindialog.py:335
 msgid "_View"
 msgstr ""
 
-#: ../src/gui/maindialog.py:352
+#: ../src/gui/maindialog.py:336
 msgid "_Help"
 msgstr ""
 
-#: ../src/gui/maindialog.py:353
+#: ../src/gui/maindialog.py:337
 msgid "About the application"
 msgstr ""
 
-#: ../src/gui/maindialog.py:363
+#: ../src/gui/maindialog.py:347
 msgid "_Show Toolbar"
 msgstr ""
 
-#: ../src/gui/maindialog.py:363
+#: ../src/gui/maindialog.py:347
 msgid "Show the toolbar"
 msgstr ""
 
-#: ../src/gui/maindialog.py:367
+#: ../src/gui/maindialog.py:351
 msgid "_Not Paid Only"
 msgstr ""
 
-#: ../src/gui/maindialog.py:367
+#: ../src/gui/maindialog.py:351
 msgid "Display all unpaid bills only"
 msgstr ""
 
-#: ../src/gui/maindialog.py:368
+#: ../src/gui/maindialog.py:352
 msgid "_Paid Only"
 msgstr ""
 
-#: ../src/gui/maindialog.py:368
+#: ../src/gui/maindialog.py:352
 msgid "Display all paid bills only"
 msgstr ""
 
-#: ../src/gui/maindialog.py:369
+#: ../src/gui/maindialog.py:353
 msgid "_All Bills"
 msgstr ""
 
-#: ../src/gui/maindialog.py:369
+#: ../src/gui/maindialog.py:353
 msgid "Display all bills"
 msgstr ""
 
-#: ../src/gui/maindialog.py:552
+#: ../src/gui/maindialog.py:535
 msgid "Not _Paid"
 msgstr ""
 
-#: ../src/gui/maindialog.py:579
+#: ../src/gui/maindialog.py:562
 #, python-format
 msgid "Do you really want to delete \"%s\"?"
 msgstr ""
@@ -538,12 +548,10 @@
 msgid "<b>Note:</b> BillReminder Notifier is now running."
 msgstr ""
 
-#: ../src/gui/widgets/calendarwidget.py:55
-msgid "<b>_Monthly Report:</b>"
-msgstr ""
-
-#: ../src/gui/widgets/calendarwidget.py:62
-msgid "<b>_Year:</b>"
+#. Label to display the date selected
+#. TRANSLATORS: This is the date that is selected from the calendar. Try to keep it small.
+#: ../src/gui/widgets/datepicker.py:40 ../src/gui/widgets/datepicker.py:64
+msgid "%m/%d/%Y"
 msgstr ""
 
 #: ../src/gui/widgets/datebutton.py:32 ../src/gui/widgets/datebutton.py:65

Modified: trunk/src/gui/adddialog.py
==============================================================================
--- trunk/src/gui/adddialog.py	(original)
+++ trunk/src/gui/adddialog.py	Mon Nov 17 00:35:48 2008
@@ -18,6 +18,7 @@
 from lib.utils import create_pixbuf
 from lib import i18n
 from gui.widgets.datebutton import DateButton
+from gui.widgets.datepicker import DatePicker
 from gui.categoriesdialog import CategoriesDialog
 from lib.common import GCONF_PATH, GCONF_GUI_PATH, GCONF_ALARM_PATH
 
@@ -27,7 +28,8 @@
     """
     def __init__(self, title=None, parent=None, record=None, selectedDate=None):
         gtk.Dialog.__init__(self, title=title, parent=parent,
-                            flags=gtk.DIALOG_MODAL|gtk.DIALOG_NO_SEPARATOR,
+                            #flags=gtk.DIALOG_MODAL|gtk.DIALOG_NO_SEPARATOR,
+                            flags=gtk.DIALOG_NO_SEPARATOR,
                             buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                                      gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT))
 
@@ -86,19 +88,8 @@
 
     def _initialize_dialog_widgets(self):
         self.vbox.set_spacing(12)
-        self.topcontainer = gtk.HBox(homogeneous=False, spacing=12)
-        self.topcontainer.set_border_width(6)
-        self.calbox = gtk.VBox(homogeneous=False, spacing=6)
         self.fieldbox = gtk.VBox(homogeneous=False, spacing=6)
 
-        # Add calendar and label
-        self.callabel = gtk.Label()
-        self.callabel.set_markup_with_mnemonic(_("<b>_Due Date:</b>"))
-        self.callabel.set_alignment(0.00, 0.50)
-
-        self.calendar = gtk.Calendar()
-        self.callabel.set_mnemonic_widget(self.calendar)
-
         ## repeat times
         self.repeatlabel = gtk.Label()
         self.repeatlabel.set_markup_with_mnemonic(_("<b>_Repeat:</b>"))
@@ -118,20 +109,13 @@
         #self.frequency.set_row_separator_func(self._determine_separator)
         self._populate_frequency()
         hbox = gtk.HBox(homogeneous=False, spacing=12)
-        hbox.pack_start(self.repeatlabel, expand=False, fill=True, padding=0)
-        hbox.pack_start(self.frequency, expand=True, fill=True, padding=0)
+        #hbox.pack_start(self.repeatlabel, expand=False, fill=True, padding=0)
+        #hbox.pack_start(self.frequency, expand=True, fill=True, padding=0)
         hbox.pack_start(self.repeatSpinner, expand=True, fill=True, padding=0)
-        ## Pack it all up
-        self.calbox.pack_start(self.callabel,
-           expand=False, fill=True)
-        self.calbox.pack_start(self.calendar,
-           expand=True, fill=True)
-        self.calbox.pack_start(hbox,
-           expand=True, fill=True)
 
         # Fields
-        ## Table of 5 x 2
-        self.table = gtk.Table(rows=5, columns=2, homogeneous=False)
+        ## Table of 6 x 2
+        self.table = gtk.Table(rows=6, columns=2, homogeneous=False)
         ### Spacing to make things look better
         self.table.set_col_spacings(12)
         self.table.set_row_spacings(6)
@@ -186,6 +170,7 @@
         self.categorydock.pack_start(self.categorybutton, expand=False,
                                      fill=True, padding=0)
         self._populate_category() # Populate combobox with category from db
+
         ### Notes
         self.notesdock = gtk.ScrolledWindow()
         self.notesdock.set_shadow_type(gtk.SHADOW_OUT)
@@ -200,34 +185,58 @@
         self.alarmbutton = DateButton(self)
         self.alarmlabel.set_mnemonic_widget(self.alarmbutton)
         self.alarmbutton.set_tooltip_text(_("Select Date and Time"))
-        # Event responsible for updating alarm date
-        self.calendar.connect("day_selected", self._on_calendar_day_selected)
-        self.calendar.select_day(self.selectedDate.day)
-        self.calendar.select_month(self.selectedDate.month - 1, self.selectedDate.year)
-        self.calendar.mark_day(self.selectedDate.day)
+
+        # Datepickers
+        self.dueDateLabel = gtk.Label()
+        self.dueDateLabel.set_markup_with_mnemonic(_("<b>Due Date:</b>"))
+        self.dueDate = DatePicker()
+        self.endDatelabel = gtk.Label()
+        #TRANSLATORS: This is the end date for repeating bills.
+        self.endDatelabel.set_markup_with_mnemonic(_("<b>End:</b>"))
+        self.endDate = DatePicker()
 
         ## Pack it all into the table
-        self.table.attach(self.payeelabel, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
-        self.table.attach(self.amountlabel, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
-        self.table.attach(self.categorylabel, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
-        self.table.attach(self.noteslabel, 0, 1, 4, 5, gtk.FILL, gtk.FILL)
-        self.table.attach(self.alarmlabel, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
-        self.table.attach(self.payee, 1, 2, 0, 1, gtk.FILL, gtk.FILL)
-        self.table.attach(self.amount, 1, 2, 1, 2, gtk.FILL, gtk.FILL)
-        self.table.attach(self.categorydock, 1, 2, 2, 3, gtk.FILL, gtk.FILL)
-        self.table.attach(self.notesdock, 1, 2, 4, 5, gtk.FILL, gtk.FILL)
-        self.table.attach(self.alarmbutton, 1, 2, 3, 4, gtk.FILL, gtk.FILL)
+        ### Label widgets
+        self.table.attach(self.payeelabel,      0, 1, 0, 1, gtk.FILL, gtk.FILL)
+        self.table.attach(self.amountlabel,     0, 1, 1, 2, gtk.FILL, gtk.FILL)
+        self.table.attach(self.dueDateLabel,    0, 1, 2, 3, gtk.FILL, gtk.FILL)
+        self.table.attach(self.categorylabel,   0, 1, 3, 4, gtk.FILL, gtk.FILL)
+        self.table.attach(self.repeatlabel,     0, 1, 4, 5, gtk.FILL, gtk.FILL)
+        self.table.attach(self.endDatelabel,    0, 1, 5, 6, gtk.FILL, gtk.FILL)
+        ### "Value" widgets
+        self.table.attach(self.payee,           1, 2, 0, 1, gtk.FILL, gtk.FILL)
+        self.table.attach(self.amount,          1, 2, 1, 2, gtk.FILL, gtk.FILL)
+        self.table.attach(self.dueDate,         1, 2, 2, 3, gtk.FILL, gtk.FILL)
+        self.table.attach(self.categorydock,    1, 2, 3, 4, gtk.FILL, gtk.FILL)
+        self.table.attach(self.frequency,       1, 2, 4, 5, gtk.FILL, gtk.FILL)
+        self.table.attach(self.endDate,         1, 2, 5, 6, gtk.FILL, gtk.FILL)
 
         ## Pack table
         self.fieldbox.pack_start(self.table, expand=True, fill=True, padding=0)
 
+        ## Table of 2 x 2 containing optional fields
+        self.optionalTable = gtk.Table(rows=2, columns=2, homogeneous=False)
+        ### Spacing to make things look better
+        self.optionalTable.set_col_spacings(12)
+        self.optionalTable.set_row_spacings(6)
+        ### Label widgets
+        self.optionalTable.attach(self.noteslabel,      0, 1, 0, 1, gtk.FILL, gtk.FILL)
+        self.optionalTable.attach(self.alarmlabel,      0, 1, 1, 2, gtk.FILL, gtk.FILL)
+        ### "Value" widgets
+        self.optionalTable.attach(self.notesdock,       1, 2, 0, 1, gtk.EXPAND, gtk.EXPAND)
+        self.optionalTable.attach(self.alarmbutton,     1, 2, 1, 2, gtk.EXPAND, gtk.EXPAND)
+        ## Expander
+        self.optExpander = gtk.Expander(_("<b>Optional Fields:</b>"))
+        self.optExpander.set_use_markup(True)
+        self.optExpander.set_expanded(False)
+        vbox = gtk.VBox(False, 4)
+        vbox.pack_start(self.optionalTable, expand=True, padding=1)
+        self.optExpander.add(vbox)
+
+
         # Everything
-        self.topcontainer.pack_start(self.calbox,
-             expand=False, fill=False)
-        self.topcontainer.pack_start(self.fieldbox,
-             expand=False, fill=False)
-        self.vbox.pack_start(self.topcontainer,
-             expand=False, fill=True)
+        self.vbox.pack_start(self.fieldbox, expand=False, fill=True)
+        self.vbox.pack_start(self.optExpander, expand=True, fill=True, padding=0)
 
         # Show all widgets
         self.show_all()
@@ -250,8 +259,8 @@
             self.amount.set_text("")
         # Format the dueDate field
         dt = scheduler.datetime_from_timestamp(self.currentrecord.DueDate)
-        self.calendar.select_day(dt.day)
-        self.calendar.select_month(dt.month - 1, dt.year)
+        self.dueDate.calendar.select_day(dt.day)
+        self.dueDate.calendar.select_month(dt.month - 1, dt.year)
         utils.select_combo_text(self.payee, self.currentrecord.Payee)
         actions = Actions()
         records = actions.get_categories({'id': self.currentrecord.Category})
@@ -372,7 +381,7 @@
         frequency = self.frequency.get_active_text()
         # Extracts the date off the calendar widget
         # Create datetime object
-        selectedDate = scheduler.time_from_calendar(self.calendar.get_date())
+        selectedDate = scheduler.time_from_calendar(self.dueDate.calendar.get_date())
 
         #buffer = self.txtNotes.get_buffer()
         startiter, enditer = self.txtbuffer.get_bounds()
@@ -490,7 +499,7 @@
             atime = self.gconf_client.get_string(GCONF_ALARM_PATH + 'show_alarm_at_time')
             adays = self.gconf_client.get_int(GCONF_ALARM_PATH + 'show_alarm_before_days')
             # Extracts the date off the calendar widget
-            selDate = self.calendar.get_date()
+            selDate = self.dueDate.calendar.get_date()
             selDate = scheduler.time_from_calendar(selDate)
 
             alarmDate = scheduler.get_alarm_timestamp(adays, atime, selDate)

Modified: trunk/src/gui/maindialog.py
==============================================================================
--- trunk/src/gui/maindialog.py	(original)
+++ trunk/src/gui/maindialog.py	Mon Nov 17 00:35:48 2008
@@ -16,7 +16,6 @@
 from gui.widgets.viewbill import ViewBill as ViewBill
 from gui.widgets.trayicon import NotifyIcon
 from gui.widgets.chartwidget import ChartWidget
-from gui.widgets.calendarwidget import CalendarWidget
 from gui.widgets.timeline import Timeline, Bullet
 
 # Import data model modules
@@ -122,13 +121,6 @@
         # Statusbar
         self.statusbar = Statusbar()
 
-        # Calendar
-        self.calbox = gtk.HBox(homogeneous=False, spacing=4)
-        self.calendar = CalendarWidget()
-        self.calendar.connect("date_changed", self._on_calendar_month_changed)
-        ## Pack it all up
-        self.calbox.pack_start(self.calendar, expand=True, fill=True)
-
         # Timeline
         self.timelinebox = gtk.HBox(homogeneous=False, spacing=4)
         self.timeline = Timeline(callback=self.on_timeline_cb)
@@ -136,18 +128,12 @@
         ## Pack it all up
         self.timelinebox.pack_start(self.timeline, expand=True, fill=True)
 
-        #self.calbox.pack_start(self.filter_hbox, expand=True)
-
-        #self.calendar.mark_day(datetime.datetime.today().day)
-
         # Chart
         self.chart = ChartWidget()
 
         # Pack it all up
         self.box.pack_start(self.toolbar,
             expand=False, fill=True, padding=0)
-        #self.box.pack_start(self.calbox,
-        #    expand=False, fill=True, padding=4)
         self.box.pack_start(self.timelinebox,
             expand=False, fill=True, padding=0)
         self.box.pack_start(self.listbox,
@@ -268,13 +254,11 @@
 
         # Populate treeview
         self._populateTreeView(records)
-        # Mark days in calendar
-        #self._markCalendar(records)
         # Update status bar
         self._update_statusbar()
         # populate chart
         self._populate_chart(status, first, last)
-        
+
         return len(records)
 
     def _formated_row(self, row):
@@ -391,7 +375,6 @@
         self.box.pack_start(menubar, expand=False, fill=True, padding=0)
 
     def add_bill(self):
-        #selectedDate = scheduler.time_from_calendar(self.calendar.get_date())
         #selectedDate = scheduler.datetime_from_timestamp(selectedDate)
         selectedDate = self.timeline.value
         records = dialogs.add_dialog(parent=self.window, selectedDate=selectedDate)
@@ -598,9 +581,6 @@
     def on_delete_event(self, widget, event, data=None):
         self._quit_application()
 
-    def _on_calendar_month_changed(self, widget, args):
-        self.reloadTreeView()
-
     def _on_timeline_changed(self, widget, args):
         self.reloadTreeView()
 

Modified: trunk/src/gui/widgets/Makefile.am
==============================================================================
--- trunk/src/gui/widgets/Makefile.am	(original)
+++ trunk/src/gui/widgets/Makefile.am	Mon Nov 17 00:35:48 2008
@@ -3,10 +3,10 @@
 billreminder_widgetsdir = $(pythondir)/billreminder/gui/widgets
 billreminder_widgets_PYTHON = \
 	__init__.py \
-	calendarwidget.py \
 	charting.py \
 	chartwidget.py \
 	datebutton.py \
+	datepicker.py \
 	genericlistview.py \
 	statusbar.py \
 	timeline.py \

Added: trunk/src/gui/widgets/datepicker.py
==============================================================================
--- (empty file)
+++ trunk/src/gui/widgets/datepicker.py	Mon Nov 17 00:35:48 2008
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+import gobject
+import datetime
+
+from lib import i18n
+
+class DatePicker(gtk.VBox):
+
+    currentDate = None
+
+    #     #define a custom signal
+    __gsignals__ = dict(
+        date_changed=(
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE, 
+            (gobject.TYPE_PYOBJECT,)
+        )
+    )
+
+    def __init__(self, date=None):
+        gtk.VBox.__init__(self, False, 4)
+
+        if not date:
+            date = datetime.datetime.today()
+        self.currentDate = date
+
+        # Create a new calendar
+        self.calendar = gtk.Calendar()
+        self.calendar.connect("day-selected-double-click", self.on_day_selected)
+        self.calendar.select_month(date.month, date.year)
+        self.calendar.select_day(date.day)
+
+        # Label to display the date selected
+        #TRANSLATORS: This is the date that is selected from the calendar. Try to keep it small.
+        self.entry = gtk.Label(self.currentDate.strftime(_('%m/%d/%Y').encode('ASCII')))
+
+        # Expander for the calendar
+        self.expander = gtk.Expander()
+        self.expander.set_expanded(False)
+        self.expander.set_label_widget(self.entry)
+
+        vbox = gtk.VBox(False, 4)
+        vbox.pack_start(self.calendar, expand=True, padding=1)
+
+        self.expander.add(vbox)
+
+        self.pack_start(self.expander)
+
+    def emit_date_changed_signal(self):
+        # Hide the calendar
+        self.expander.set_expanded(False)
+
+        self.emit("date_changed", self.currentDate)
+
+    def on_day_selected(self, calendar):
+        (year, month, day) = self.calendar.get_date()
+        self.currentDate = datetime.datetime(year, month+1, day)
+        #TRANSLATORS: This is the date that is selected from the calendar. Try to keep it small.
+        self.entry.set_label(self.currentDate.strftime(_('%m/%d/%Y').encode('ASCII')))
+
+
+        self.emit_date_changed_signal()
+
+class BasicWindow(object):
+
+    # close the window and quit
+    def delete_event(self, widget, event, data=None):
+        gtk.main_quit()
+        return False
+
+    def __init__(self):
+        # Create a new window
+        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+
+        self.window.set_title("Basic Window")
+
+        #self.window.set_size_request(500, 200)
+
+        self.window.connect("delete_event", self.delete_event)
+
+        hbox = gtk.HBox()
+
+        datepicker = DatePicker(datetime.datetime(1974, 6, 8))
+        hbox.pack_start(datepicker)
+        self.window.add(hbox)
+        self.window.show_all()
+
+def main():
+    gtk.main()
+
+if __name__ == "__main__":
+    example = BasicWindow()
+    main()



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