self.set_background('background.png')
layout = wimpworks.HildonMainScreenLayout(offset = 0.8, container = self)
- layout.add_button(_('Retrieve'), _("Get contacts' missing info"))
- layout.add_button(_('Refresh'), _("Update contacts' info"))
+ layout.add_button('Retrieve', _("Get contacts' missing info"))
+ layout.add_button('Refresh', _("Update contacts' info"))
- self.add_menu_action(_("Accounts"))
+ self.add_menu_action("Accounts")
self.menu.show_all()
# ~~~~~~~~~~~~~~~~~~~~~~ Released under the Artistic Licence.
# http://www.bleb.org/
+import gettext
import gtk, gobject
import re
import thread
def add_menu_action(self, title, window = None):
'''Add a menu action to the given (or main) window. Once add_menu_action()
has been called with all the properties, 'self.menu.show_all()' should be
- called.'''
+ called.
+
+ @param title The label of the action, and used to compute the callback
+ method. This should be the UN-i18n version: gettext is used
+ on the value.'''
if not window:
window = self.main_window
raise Exception("Menu needs to be created, and no Hildon present")
button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
- button.set_label(title)
+ button.set_label(_(title))
button.connect("clicked", self.callback, title)
self.menu.append(button)
the button, a method of the name 'do_title' will be invoked on the
main class.
- @param title Value of the button, and used to derive the callback method.
+ @param title Value of the button, and used to derive the callback method. This
+ should be the UN-i18n version: gettext is used on the value.
@param subtitle An optional subtitle containing more information.'''
if _have_hildon:
button = hildon.Button(gtk.HILDON_SIZE_THUMB_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL,
title = title, value = subtitle)
else:
- button = gtk.Button(label = title)
+ button = gtk.Button(label = _(title))
button.set_property('width-request', 250)
button.connect('clicked', self._container.callback, title)