[billreminder commit] r611 - in trunk: . src/gui src/gui/widgets

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 27, 2008, 10:37:38 AM7/27/08
to billremi...@googlegroups.com
Author: og.maciel
Date: Sun Jul 27 07:37:22 2008
New Revision: 611

Modified:
trunk/ChangeLog
trunk/src/gui/Changelog
trunk/src/gui/adddialog.py
trunk/src/gui/maindialog.py
trunk/src/gui/prefdialog.py
trunk/src/gui/widgets/Changelog
trunk/src/gui/widgets/datebutton.py
trunk/src/gui/widgets/timewidget.py

Log:
Mnemonics and HIG work.

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Sun Jul 27 07:37:22 2008
@@ -45,6 +45,8 @@
* German by Sebastian

Graphical Interface:
+ * Mnemonic labels/widgets and HIG work done to dialogs.
+ Thanks Wilson Pinto Junior <wilson...@gmail.com>
* Ask user for confirmation before editing an existing category.
* Added pycairo as a dependency instead of python-Image. Color-coded
categories now have a border around the colored tile.

Modified: trunk/src/gui/Changelog
==============================================================================
--- trunk/src/gui/Changelog (original)
+++ trunk/src/gui/Changelog Sun Jul 27 07:37:22 2008
@@ -1,3 +1,8 @@
+2008-07-27 Og Maciel <ogma...@gnome.org>
+
+ * adddialog.py, prefdialog.py, maindialog.py: Mnemonic
labels/widgets and HIG work.
+ Thanks Wilson Pinto Junior <wilson...@gmail.com>
+
2008-07-18 Og Maciel <ogma...@gnome.org>

* aboutdialog.py: Make sure you can visit the project web site
when clicking on link.

Modified: trunk/src/gui/adddialog.py
==============================================================================
--- trunk/src/gui/adddialog.py (original)
+++ trunk/src/gui/adddialog.py Sun Jul 27 07:37:22 2008
@@ -27,11 +27,14 @@
"""
def __init__(self, title=None, parent=None, record=None, selectedDate=None):
gtk.Dialog.__init__(self, title=title, parent=parent,
- flags=gtk.DIALOG_MODAL,
+ flags=gtk.DIALOG_MODAL|gtk.DIALOG_NO_SEPARATOR,
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT))
+
self.set_icon_from_file(common.APP_ICON)
-
+ self.set_border_width(6)
+ self.set_resizable(False)
+
if parent:
self.set_transient_for(parent)
self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
@@ -82,19 +85,23 @@
self.allowed_digts += [str(i) for i in range(10)]

def _initialize_dialog_widgets(self):
- self.vbox.set_spacing(8)
- self.topcontainer = gtk.HBox(homogeneous=False, spacing=0)
- self.calbox = gtk.VBox(homogeneous=False, spacing=0)
- self.fieldbox = gtk.VBox(homogeneous=False, spacing=0)
+ 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("<b>%s</b> " % _("Due Date:"))
+ 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("<b>%s</b> " % _("Repeat:"))
+ self.repeatlabel.set_markup_with_mnemonic(_("<b>_Repeat:</b>"))
self.repeatlabel.set_alignment(0.00, 0.50)
adj = gtk.Adjustment(00.0, 1.0, 23.0, 1.0)
self.repeatSpinner = gtk.SpinButton(adj, 0, 0)
@@ -103,61 +110,63 @@
self.repeatSpinner.set_numeric(True)
self.repeatSpinner.set_update_policy(gtk.UPDATE_IF_VALID)
self.repeatSpinner.set_snap_to_ticks(True)
+
## Repeating bills
self.frequency = gtk.combo_box_new_text()
+ self.repeatlabel.set_mnemonic_widget(self.frequency)
self.frequency.connect('changed', self._on_frequency_changed)
#self.frequency.set_row_separator_func(self._determine_separator)
self._populate_frequency()
- hbox = gtk.HBox(homogeneous=False, spacing=0)
- hbox.pack_start(self.repeatlabel, expand=True, fill=True, padding=0)
+ 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.repeatSpinner, expand=True, fill=True, padding=0)
## Pack it all up
self.calbox.pack_start(self.callabel,
- expand=True, fill=True, padding=5)
+ expand=False, fill=True)
self.calbox.pack_start(self.calendar,
- expand=True, fill=True, padding=5)
+ expand=True, fill=True)
self.calbox.pack_start(hbox,
- expand=True, fill=True, padding=5)
+ expand=True, fill=True)

# Fields
## Table of 5 x 2
self.table = gtk.Table(rows=5, columns=2, homogeneous=False)
### Spacing to make things look better
- self.table.set_col_spacing(0, 6)
- self.table.set_row_spacing(0, 6)
- self.table.set_row_spacing(1, 6)
- self.table.set_row_spacing(2, 6)
- self.table.set_row_spacing(3, 6)
+ self.table.set_col_spacings(12)
+ self.table.set_row_spacings(6)

## Labels
self.payeelabel = gtk.Label()
- self.payeelabel.set_markup("<b>%s</b> " % _("Payee:"))
+ self.payeelabel.set_markup_with_mnemonic(_("<b>_Payee:</b>"))
self.payeelabel.set_alignment(0.00, 0.50)
self.amountlabel = gtk.Label()
- self.amountlabel.set_markup("<b>%s</b> (%s) " % (_("Amount:"), locale.localeconv()['currency_symbol']))
+ self.amountlabel.set_markup_with_mnemonic(_("<b>_Amount:</b>"))
self.amountlabel.set_alignment(0.00, 0.50)
self.categorylabel = gtk.Label()
- self.categorylabel.set_markup("<b>%s</b> " % _("Category:"))
+ self.categorylabel.set_markup_with_mnemonic(_("<b>_Category:</b>"))
self.categorylabel.set_alignment(0.00, 0.50)
self.noteslabel = gtk.Label()
- self.noteslabel.set_markup("<b>%s</b> " % _("Notes:"))
- self.noteslabel.set_alignment(0.00, 0.50)
+ self.noteslabel.set_markup_with_mnemonic(_("<b>_Notes:</b>"))
+ self.noteslabel.set_alignment(0.00, 0.00)
self.alarmlabel = gtk.Label()
- self.alarmlabel.set_markup("<b>%s</b> " % _("Alarm:"))
+ self.alarmlabel.set_markup_with_mnemonic(_("<b>_Alarm:</b>"))
self.alarmlabel.set_alignment(0.00, 0.50)
## Fields
### Payee
self.payee = gtk.ComboBoxEntry()
+ self.payeelabel.set_mnemonic_widget(self.payee)
self.payeecompletion = gtk.EntryCompletion()
self.payee.child.set_completion(self.payeecompletion)
self._populate_payee() # Populate combobox with payee from db
### Amount
self.amount = gtk.Entry()
+ self.amountlabel.set_mnemonic_widget(self.amount)
self.amount.set_alignment(1.00)
### Category
- self.categorydock = gtk.HBox(homogeneous=False, spacing=0)
+ self.categorydock = gtk.HBox(homogeneous=False, spacing=4)
self.category = gtk.ComboBox()
+ self.categorylabel.set_mnemonic_widget(self.category)
px = gtk.CellRendererPixbuf()
txt = gtk.CellRendererText()
self.category.pack_start(px, False)
@@ -182,12 +191,14 @@
self.notesdock.set_shadow_type(gtk.SHADOW_OUT)
self.notesdock.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.notes = gtk.TextView()
+ self.noteslabel.set_mnemonic_widget(self.notes)
self.notes.set_wrap_mode(gtk.WRAP_WORD)
self.notesdock.add_with_viewport(self.notes)
### Buffer object for Notes field
self.txtbuffer = self.notes.get_buffer()
### Alarm
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)
@@ -195,29 +206,28 @@
self.calendar.select_month(self.selectedDate.month - 1, self.selectedDate.year)
self.calendar.mark_day(self.selectedDate.day)

-
## 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, 3, 4, gtk.FILL, gtk.FILL)
- self.table.attach(self.alarmlabel, 0, 1, 4, 5, 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, 3, 4, gtk.FILL, gtk.FILL)
- self.table.attach(self.alarmbutton, 1, 2, 4, 5, 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)

## Pack table
self.fieldbox.pack_start(self.table, expand=True, fill=True, padding=0)

# Everything
self.topcontainer.pack_start(self.calbox,
- expand=False, fill=False, padding=10)
+ expand=False, fill=False)
self.topcontainer.pack_start(self.fieldbox,
- expand=False, fill=False, padding=10)
+ expand=False, fill=False)
self.vbox.pack_start(self.topcontainer,
- expand=False, fill=True, padding=10)
+ expand=False, fill=True)

# Show all widgets
self.show_all()

Modified: trunk/src/gui/maindialog.py
==============================================================================
--- trunk/src/gui/maindialog.py (original)
+++ trunk/src/gui/maindialog.py Sun Jul 27 07:37:22 2008
@@ -100,10 +100,11 @@
# Menubar
self._populate_menubar()

- self.listbox = gtk.VBox(homogeneous=False, spacing=1)
+ self.listbox = gtk.VBox(homogeneous=False, spacing=6)
self.listlabel = gtk.Label()
- self.listlabel.set_markup("<b>%s</b>" % _("Bills:"))
- self.listlabel.set_alignment(0.02, 0.50)
+ self.listlabel.set_markup_with_mnemonic(_("<b>_Bills:</b>"))
+ self.listlabel.set_mnemonic_widget(self.list)
+ self.listlabel.set_alignment(0.00, 0.50)
# ScrolledWindow
self.scrolledwindow = gtk.ScrolledWindow()
self.scrolledwindow.set_shadow_type(gtk.SHADOW_IN)
@@ -122,9 +123,10 @@
# Calendar
self.calbox = gtk.VBox(homogeneous=False, spacing=1)
self.callabel = gtk.Label()
- self.callabel.set_markup("<b>%s</b> " % _("Due Date:"))
- self.callabel.set_alignment(0.02, 0.50)
+ 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)
# Format the dueDate field
self.calendar.connect("month_changed", self._on_calendar_month_changed)
self.calendar.connect("day_selected_double_click", self._on_calendar_double_click)
@@ -338,7 +340,7 @@
self.gconf_client.set_int(GCONF_GUI_PATH
+ "show_paid_bills", saved_view)

actiongroup.add_toggle_actions([
- ('ShowToolbar', None, _("Show Toolbar"), None, _("Show the
toolbar"), self._on_show_toolbar)
+ ('ShowToolbar', None, _("_Show Toolbar"), None, _("Show
the toolbar"), self._on_show_toolbar)
])

actiongroup.add_radio_actions([

Modified: trunk/src/gui/prefdialog.py
==============================================================================
--- trunk/src/gui/prefdialog.py (original)
+++ trunk/src/gui/prefdialog.py Sun Jul 27 07:37:22 2008
@@ -25,14 +25,16 @@
def __init__(self, parent=None):
title = _("Preferences")
gtk.Dialog.__init__(self, title=title, parent=parent,
- flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+ flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT |gtk.DIALOG_NO_SEPARATOR,
buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT))
+
self.set_position(gtk.WIN_POS_CENTER)
+ self.set_border_width(6)
+ self.set_resizable(False)
self.set_icon_from_file(common.APP_ICON)

self.props.skip_taskbar_hint = True
- self.set_border_width(5)
-
+
self.gconf_client = gconf.client_get_default()

self._initialize_dialog_widgets()
@@ -41,64 +43,71 @@


def _initialize_dialog_widgets(self):
- self.topcontainer = gtk.VBox(homogeneous=False, spacing=10)
+ self.topcontainer = gtk.VBox(homogeneous=False, spacing=18)
+ self.topcontainer.set_border_width(6)

# Alert Group
- alertFrame = gtk.Frame(label="<b>%s</b>" % _("Alarms"))
- alertFrame.props.label_widget.set_use_markup(True)
- alertFrame.set_shadow_type(gtk.SHADOW_NONE)
+ alertFrame = gtk.VBox(homogeneous=False, spacing=6)
alertAlignment = gtk.Alignment()
- alertAlignment.set_padding(10, 0, 12, 0)
- alertFrame.add(alertAlignment)
+ alertAlignment.set_padding(0, 0, 12, 0)
+ title = gtk.Label()
+ title.set_markup(_("<b>Alarms</b>"))
+ title.set_alignment(0.00, 0.50)
+ alertFrame.pack_start(title)
+ alertFrame.pack_start(alertAlignment)

alertContainer = gtk.VBox(homogeneous=False, spacing=6)
- self.alertCheckbox = gtk.CheckButton("%s" % _('Alert before
due date:'))
+ self.alertCheckbox = gtk.CheckButton(_('_Alert before due
date:'), use_underline=True)
self.alertSpinButton = gtk.SpinButton()
self.alertSpinButton.set_range(0, 360)
self.alertSpinButton.spin(gtk.SPIN_STEP_FORWARD)
self.alertSpinButton.set_increments(1, 7)
alertDays = gtk.Label("%s" % _('day(s).'))
self.notificationTime = TimeWidget()
- self.notificationTime.set_shadow_type(gtk.SHADOW_NONE)
- alertPreferredTime = gtk.Label("%s" % _('Preferred time:'))
- alertPreferredTime.set_alignment(0.00, 0.90)
+ alertPreferredTime = gtk.Label()
+ alertPreferredTime.set_markup_with_mnemonic(_('_Preferred time:'))
+ alertPreferredTime.set_mnemonic_widget(self.notificationTime.hourSpinner)
+ alertPreferredTime.set_alignment(0.00, 0.50)
alertDefinition = gtk.Label(_('Get alerted when individual
bills are due.'))
alertDefinition.set_alignment(0.00, 0.90)

# Add label defining what an alarm means.
- alertContainer.pack_start(alertDefinition, expand=False,
fill=True, padding=2)
+ alertContainer.pack_start(alertDefinition, expand=False,
fill=True, padding=0)

# Container for alert checkbox and spin button for day selection.
- hbox = gtk.HBox(homogeneous=False, spacing=0)
+ hbox = gtk.HBox(homogeneous=False, spacing=4)
hbox.pack_start(self.alertCheckbox, expand=False, fill=True, padding=0)
- hbox.pack_start(self.alertSpinButton, expand=False,
fill=False, padding=2)
+ hbox.pack_start(self.alertSpinButton, expand=False,
fill=False, padding=0)
hbox.pack_start(alertDays, expand=False, fill=False, padding=0)
alertContainer.pack_start(hbox, expand=False, fill=True, padding=0)

# Container for preferred time for alerts.
- hbox = gtk.VBox(homogeneous=False, spacing=0)
- hbox.pack_start(alertPreferredTime, expand=True, fill=False, padding=0)
- hbox.pack_start(self.notificationTime, expand=False,
fill=True, padding=0)
+ hbox = gtk.HBox(homogeneous=False, spacing=12)
+ hbox.pack_start(alertPreferredTime, expand=False, fill=True, padding=0)
+ hbox.pack_start(self.notificationTime, expand=True, fill=True, padding=0)
alertContainer.pack_start(hbox, expand=False, fill=True, padding=0)

alertAlignment.add(alertContainer)

# Notification Group
- notifyFrame = gtk.Frame(label="<b>%s</b>" % _("Notifications"))
- notifyFrame.props.label_widget.set_use_markup(True)
- notifyFrame.set_shadow_type(gtk.SHADOW_NONE)
+ notifyFrame = gtk.VBox(homogeneous=False, spacing=6)
+ title = gtk.Label()
+ title.set_markup(_("<b>Notifications</b>"))
+ title.set_alignment(0.00, 0.50)
notifyAlignment = gtk.Alignment()
- notifyAlignment.set_padding(10, 0, 12, 0)
- notifyFrame.add(notifyAlignment)
+ notifyAlignment.set_padding(0, 0, 12, 0)
+ notifyFrame.pack_start(title)
+ notifyFrame.pack_start(notifyAlignment)
notificationDefinition = gtk.Label(_('Define when to be
notified of upcoming bills.'))
notificationDefinition.set_alignment(0.00, 0.90)

notificationsContainer = gtk.VBox(homogeneous=False, spacing=6)

# Add label defining what a definition means.
- notificationsContainer.pack_start(notificationDefinition,
expand=False, fill=False, padding=2)
+ notificationsContainer.pack_start(notificationDefinition,
expand=False, fill=False, padding=0)

- self.notifyCheckbox = gtk.CheckButton("%s" % _('Notify before
due date:'))
+ self.notifyCheckbox = gtk.CheckButton(_('_Notify before due date:'),
+ use_underline=True)
self.notifySpinButton = gtk.SpinButton()
self.notifySpinButton.set_range(0, 360)
self.notifySpinButton.spin(gtk.SPIN_STEP_FORWARD)
@@ -106,9 +115,9 @@
notifyDays = gtk.Label("%s" % _('day(s).'))

# Container for notification checkbox and spin button for day selection.
- hbox = gtk.HBox(homogeneous=False, spacing=0)
+ hbox = gtk.HBox(homogeneous=False, spacing=4)
hbox.pack_start(self.notifyCheckbox, expand=False, fill=True, padding=0)
- hbox.pack_start(self.notifySpinButton, expand=False,
fill=False, padding=2)
+ hbox.pack_start(self.notifySpinButton, expand=False,
fill=False, padding=0)
hbox.pack_start(notifyDays, expand=False, fill=False, padding=0)

notificationsContainer.pack_start(hbox, expand=False,
fill=True, padding=0)
@@ -116,19 +125,21 @@
notifyAlignment.add(notificationsContainer)

# Alert Type Group
- alertTypeFrame = gtk.Frame(label="<b>%s</b>" % _("Alert Type"))
- alertTypeFrame.props.label_widget.set_use_markup(True)
- alertTypeFrame.set_shadow_type(gtk.SHADOW_NONE)
+ alertTypeFrame = gtk.VBox(homogeneous=False, spacing=6)
+ title = gtk.Label()
+ title.set_markup(_("<b>Alert Type</b>"))
+ title.set_alignment(0.00, 0.50)
alertTypeAlignment = gtk.Alignment()
- alertTypeAlignment.set_padding(10, 0, 12, 0)
- alertTypeFrame.add(alertTypeAlignment)
+ alertTypeAlignment.set_padding(0, 0, 12, 0)
+ alertTypeFrame.pack_start(title)
+ alertTypeFrame.pack_start(alertTypeAlignment)

vbox = gtk.VBox(homogeneous=False, spacing=6)

hbox = gtk.HBox(homogeneous=False, spacing=12)
- self.alertBubble = gtk.RadioButton(label=_("_Notification Bubble"))
+ self.alertBubble = gtk.RadioButton(label=_("Notification _Bubble"))
self.alertDialog = gtk.RadioButton(group=self.alertBubble,
- label=_("Al_ert Dialog"))
+ label=_("Alert _Dialog"))

hbox.pack_start(self.alertBubble, expand=False, fill=False, padding=0)
hbox.pack_start(self.alertDialog, expand=False, fill=False, padding=0)
@@ -148,20 +159,21 @@
daemonImage = gtk.Image()
daemonImage.set_from_stock('gtk-execute', 2)
self.daemonButton = gtk.Button(label=_("_Start BillReminder Notifier"))
+ self.daemonButton.set_relief(gtk.RELIEF_NONE)
self.daemonButton.set_image(daemonImage)

- daemonContainer.pack_start(self.daemonLabel, expand=False,
fill=False, padding=0)
- daemonContainer.pack_start(self.daemonButton, expand=False,
fill=False, padding=5)
+ daemonContainer.pack_start(self.daemonLabel, expand=False,
fill=True, padding=0)
+ daemonContainer.pack_start(self.daemonButton, expand=False,
fill=True, padding=0)

# Everything
- self.topcontainer.pack_start(alertFrame, expand=False,
fill=False, padding=0)
- self.topcontainer.pack_start(notifyFrame, expand=False,
fill=False, padding=0)
- self.topcontainer.pack_start(alertTypeFrame, expand=False,
fill=False, padding=0)
+ self.topcontainer.pack_start(alertFrame, expand=False,
fill=True, padding=0)
+ self.topcontainer.pack_start(notifyFrame, expand=False,
fill=True, padding=0)
+ self.topcontainer.pack_start(alertTypeFrame, expand=False,
fill=True, padding=0)

if not utils.verify_dbus_service(common.DBUS_INTERFACE):
- self.topcontainer.pack_start(daemonContainer,
expand=False, fill=False, padding=0)
+ self.topcontainer.pack_start(daemonContainer,
expand=False, fill=True, padding=0)

- self.vbox.pack_start(self.topcontainer, expand=False,
fill=True, padding=10)
+ self.vbox.pack_start(self.topcontainer, expand=False, fill=True)

self.show_all()


Modified: trunk/src/gui/widgets/Changelog
==============================================================================
--- trunk/src/gui/widgets/Changelog (original)
+++ trunk/src/gui/widgets/Changelog Sun Jul 27 07:37:22 2008
@@ -1,3 +1,9 @@
+2008-07-27 Og Maciel <ogma...@gnome.org>
+
+ * datebutton.py, timewidget.py: Mnemonic labels/widgets and HIG work.
+ Thanks Wilson Pinto Junior <wilson...@gmail.com>
+
+
2008-05-11 Og Maciel <ogma...@gnome.org>

* statusbar.py: Added tooltip to notes.

Modified: trunk/src/gui/widgets/datebutton.py
==============================================================================
--- trunk/src/gui/widgets/datebutton.py (original)
+++ trunk/src/gui/widgets/datebutton.py Sun Jul 27 07:37:22 2008
@@ -39,15 +39,19 @@
def show_calendar(self, *arg):
self.dialog = gtk.Dialog(title=_("Select Date and Time"),
parent=self.parent_window,
- flags=gtk.DIALOG_MODAL,
- buttons=(str(_("None")), gtk.RESPONSE_REJECT,
+ flags=gtk.DIALOG_MODAL |
gtk.DIALOG_DESTROY_WITH_PARENT |gtk.DIALOG_NO_SEPARATOR,
+ buttons=(str(_("_None")), gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_OK))
-
+
+ self.dialog.set_border_width(6)
+ self.dialog.set_resizable(False)
+ self.dialog.vbox.set_spacing(6)
+
self._initialize_dialog_widgets()
self._populate_fields()

response = self.dialog.run()
- print response
+
if response == gtk.RESPONSE_REJECT:
self.set_date(None)
elif response == gtk.RESPONSE_OK:
@@ -65,32 +69,37 @@
def _initialize_dialog_widgets(self):
dialog = gtk.Dialog(title=_("Select date and time"),
parent=self.parent_window,
- flags=gtk.DIALOG_MODAL,
- buttons=(str(_("None")), gtk.RESPONSE_REJECT,
+ flags=gtk.DIALOG_MODAL |gtk.DIALOG_DESTROY_WITH_PARENT |gtk.DIALOG_NO_SEPARATOR,
+ buttons=(str(_("_None")), gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_OK))
-
+
+ dialog.set_border_width(6)
+ dialog.set_resizable(False)
+
if self.parent_window:
dialog.set_transient_for(self.parent_window)
dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT)

self.calendarlabel = gtk.Label()
- self.calendarlabel.set_markup("<b>%s </b>" % _("Date:"))
+ self.calendarlabel.set_markup_with_mnemonic("<b>_Date:</b>")
self.calendarlabel.set_alignment(0.00, 0.50)

- self.timelabel = gtk.Label()
- self.timelabel.set_markup("<b>%s </b>" % _("Time:"))
- self.timelabel.set_alignment(0.00, 0.50)
-
- self.vbox = gtk.VBox(False, 0)
+ self.vbox = gtk.VBox(False, 6)
+ self.vbox.set_border_width(6)
self.calendar = gtk.Calendar()
-
+ self.calendarlabel.set_mnemonic_widget(self.calendar)
# If we do have an existing alarm time, pass it to the widget
- self.time = TimeWidget(self.date and
time.mktime(self.date.timetuple()) or None, _("Time:"))
-
+ self.timehbox = gtk.HBox(False, 4)
+ title = gtk.Label()
+ title.set_markup_with_mnemonic(_("<b>_Time:</b>"))
+ self.timehbox.pack_start(title, expand=False)
+ self.time = TimeWidget(self.date and
time.mktime(self.date.timetuple()) or None)
+ title.set_mnemonic_widget(self.time.hourSpinner)
+ self.timehbox.pack_start(self.time)
self.vbox.pack_start(self.calendarlabel, False, True, 0)
self.vbox.pack_start(self.calendar, False, True, 0)
- self.vbox.pack_start(self.time, False, True, 0)
- self.dialog.vbox.pack_start(self.vbox, expand=False,
fill=True, padding=10)
+ self.vbox.pack_start(self.timehbox, False, True, 0)
+ self.dialog.vbox.pack_start(self.vbox, expand=False, fill=True)

self.dialog.show_all()


Modified: trunk/src/gui/widgets/timewidget.py
==============================================================================
--- trunk/src/gui/widgets/timewidget.py (original)
+++ trunk/src/gui/widgets/timewidget.py Sun Jul 27 07:37:22 2008
@@ -7,11 +7,10 @@
import datetime
from lib import i18n

-class TimeWidget(gtk.Frame):
- def __init__(self, notificationTime=None, label=None):
+class TimeWidget(gtk.HBox):
+ def __init__(self, notificationTime=None):

- gtk.Frame.__init__ (self, label=label)
- self.set_shadow_type(gtk.SHADOW_IN)
+ gtk.HBox.__init__(self, False, 4)

# Create internal widgets
self.__initialize_widgets()
@@ -20,27 +19,28 @@

def __initialize_widgets(self):
# Hour and minutes spinners
- hbox = gtk.HBox(False, 0)
-
+ """#More Compact
vbox = gtk.VBox(False, 0)
hbox.pack_start(vbox, True, True, 5)
-
label = gtk.Label(_("Hour :"))
label.set_alignment(0, 0.5)
- self.hourSpinner = self.__set_spinner(00.0, 00.0, 23.0, 1.0)
vbox.pack_start(label, False, True, 0)
vbox.pack_start(self.hourSpinner, False, True, 0)
-
vbox = gtk.VBox(False, 0)
hbox.pack_start(vbox, True, True, 5)
-
label = gtk.Label(_("Minute :"))
label.set_alignment(0, 0.5)
+ """
+ self.hourSpinner = self.__set_spinner(00.0, 00.0, 23.0, 1.0)
+ self.pack_start(self.hourSpinner, True, True, 0)
+ self.pack_start(gtk.Label(":"), False, True, 0)
self.minuteSpinner = self.__set_spinner(0.0, 0.0, 59.0, 1.0)
+ self.pack_start(self.minuteSpinner, True, True, 0)
+ self.pack_start(gtk.Label(_("(hh/mm)")), False, True, 0)
+ """"
vbox.pack_start(label, False, True, 0)
vbox.pack_start(self.minuteSpinner, False, True, 0)
-
- self.add(hbox)
+ """

def __set_spinner(self, initial, low, high, increment=1.0):
adj = gtk.Adjustment(initial, low, high, increment)

Reply all
Reply to author
Forward
0 new messages