This encapsulates the entire program logic and all strings, but does not
implement any concrete user interface.
'''
def __init__(self):
'''
Initialize system.
'''
self.gettext_domain = 'screen-resolution-extra'
gettext.textdomain(self.gettext_domain)
self.init_strings()
def _(self, str, convert_keybindings = False):
"""Keyboard accelerator aware gettext() wrapper.
This optionally converts keyboard accelerators to the appropriate
format for the frontend.
All strings in the source code should use the '_' prefix for key
accelerators (like in GTK). For inserting a real '_', use '__'.
"""
result = unicode(gettext.gettext(str), 'UTF-8')
if convert_keybindings:
result = self.convert_keybindings(result)
return result
def init_strings(self):
'''Initialize all static strings which are used in UI implementations.'''
self.string_permission_text = self._('Monitor Resolution Settings has detected that the virtual resolution must be set in your configuration file in order to apply your settings.\n\nWould you like Screen Resolution to set the virtual resolution for you? (Recommended)')
self.string_dbus_cant_connect = self._('Could not connect to Monitor Resolution Settings DBUS service.')
self.string_operation_complete = self._('Please log out and log back in again. You will then be able to use Monitor Resolution Settings to setup your monitors')
self.string_cant_apply_settings = self._("Monitor Resolution Settings can't apply your settings.")