/usr/share/pyshared/ScreenResolution/ui.py is in screen-resolution-extra 0.14ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # -*- coding: utf-8 -*-
# ui.py
#
# Copyright 2008 Alberto Milone <albertomilone@alice.it>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
import gettext
class AbstractUI:
'''Abstract user interface.
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 '__'.
'''
# KDE compatible conversion
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.')
self.string_title = self._('Monitor Resolution Settings')
|