Package list lightdm-gtk-greeter-settings / d95dec9
PEP8 Sean Davis 7 years ago
7 changed file(s) with 361 addition(s) and 252 deletion(s). Raw diff Collapse all Expand all
66 gi.require_version('Gtk', '3.0')
77
88
9 project_dir = os.path.abspath(os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
10 if (os.path.exists(os.path.join(project_dir, 'lightdm_gtk_greeter_settings')) and project_dir not in sys.path):
9 project_dir = os.path.abspath(
10 os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
11 if (os.path.exists(os.path.join(project_dir, 'lightdm_gtk_greeter_settings'))
12 and project_dir not in sys.path):
1113 sys.path.insert(0, project_dir)
1214
1315
1616 __all__ = ['GtkGreeterSettingsWindow']
1717
1818
19 BindingValue = namedtuple('BindingValue', ('option', 'default', 'changed_handler'))
19 BindingValue = namedtuple(
20 'BindingValue', ('option', 'default', 'changed_handler'))
2021 InitialValue = namedtuple('InitialValue', ('value', 'state'))
2122
2223 GREETER_SECTION = 'greeter'
2324
2425 OPTIONS_BINDINGS = \
25 {
26 'greeter':
2726 {
28 # key: class, base widgets name, default value
29
30 # Theme
31 'theme-name': (OptionEntry.StringEntry, 'gtk_theme', None),
32 'icon-theme-name': (OptionEntry.StringEntry, 'icons_theme', None),
33 'font-name': (OptionEntry.FontEntry, 'font', 'Sans 10'),
34 'xft-antialias': (OptionEntry.BooleanEntry, 'antialias', False),
35 'xft-dpi': (OptionEntry.StringEntry, 'dpi', None),
36 'xft-rgba': (OptionEntry.ChoiceEntry, 'rgba', None),
37 'xft-hintstyle': (OptionEntry.ChoiceEntry, 'hintstyle', None),
38 'background': (OptionEntry.BackgroundEntry, 'background', '#000000'),
39 'default-user-image': (OptionEntry.IconEntry, 'userimage', '#avatar-default'),
40 # Panel
41 'show-clock': (OptionEntry.BooleanEntry, 'show_clock', False),
42 'clock-format': (OptionEntry.ClockFormatEntry, 'clock_format', '%a, %H:%M'),
43 'indicators': (OptionEntry.IndicatorsEntry, 'indicators', None),
44 # Position
45 'position': (OptionEntry.PositionEntry, 'position', '50%,center'),
46 # Misc
47 'screensaver-timeout': (OptionEntry.AdjustmentEntry, 'timeout', 60),
48 'keyboard': (OptionEntry.StringEntry, 'keyboard', None),
27 'greeter':
28 {
29 # key: class, base widgets name, default value
30
31 # Theme
32 'theme-name': (OptionEntry.StringEntry, 'gtk_theme', None),
33 'icon-theme-name': (OptionEntry.StringEntry, 'icons_theme', None),
34 'font-name': (OptionEntry.FontEntry, 'font', 'Sans 10'),
35 'xft-antialias': (OptionEntry.BooleanEntry, 'antialias', False),
36 'xft-dpi': (OptionEntry.StringEntry, 'dpi', None),
37 'xft-rgba': (OptionEntry.ChoiceEntry, 'rgba', None),
38 'xft-hintstyle': (OptionEntry.ChoiceEntry, 'hintstyle', None),
39 'background': (OptionEntry.BackgroundEntry, 'background',
40 '#000000'),
41 'default-user-image': (OptionEntry.IconEntry, 'userimage',
42 '#avatar-default'),
43 # Panel
44 'show-clock': (OptionEntry.BooleanEntry, 'show_clock', False),
45 'clock-format': (OptionEntry.ClockFormatEntry, 'clock_format',
46 '%a, %H:%M'),
47 'indicators': (OptionEntry.IndicatorsEntry, 'indicators', None),
48 # Position
49 'position': (OptionEntry.PositionEntry, 'position', '50%,center'),
50 # Misc
51 'screensaver-timeout': (OptionEntry.AdjustmentEntry, 'timeout',
52 60),
53 'keyboard': (OptionEntry.StringEntry, 'keyboard', None),
54 }
4955 }
50 }
5156
5257
5358 class BuilderWrapper:
59
5460 def __init__(self, builder, base):
5561 self._builder = builder
5662 self._base = base
6571
6672 BUILDER_WIDGETS = ('apply_button', 'no_access_infobar',
6773 'gtk_theme_values', 'icons_theme_values',
68 'timeout_view', 'timeout_adjustment', 'timeout_end_label')
74 'timeout_view', 'timeout_adjustment',
75 'timeout_end_label')
6976
7077 def __new__(cls):
7178 builder = Gtk.Builder()
7986 return window
8087
8188 def _init_window(self):
82 self._bindings = {section: {key: self._new_binding(*args) for key, args in keys.items()}
83 for section, keys in OPTIONS_BINDINGS.items()}
89 self._bindings = {section: {key: self._new_binding(*args)
90 for key, args in list(keys.items())}
91 for section, keys in list(OPTIONS_BINDINGS.items())}
8492 self._initial_values = {}
8593 self._changed_values = None
8694
8997 self._no_access_infobar.props.visible = not self._allow_edit
9098 self._apply_button.props.visible = self._allow_edit
9199 if not self._allow_edit:
92 helpers.show_message(text=_('No permissions to save configuration'),
93 secondary_text=_(
94 'It seems that you don\'t have permissions to write to file:\n\
95 {path}\n\nTry to run this program using "sudo" or "pkexec"').format(path=self._config_path),
96 message_type=Gtk.MessageType.WARNING)
100 helpers.show_message(
101 text=_('No permissions to save configuration'),
102 secondary_text=_(
103 'It seems that you don\'t have permissions to write to '
104 'file:\n{path}\n\nTry to run this program using "sudo" '
105 'or "pkexec"').format(path=self._config_path),
106 message_type=Gtk.MessageType.WARNING)
97107
98108 self._configure_special_entries()
99109 self._config = configparser.RawConfigParser(strict=False)
101111
102112 def _configure_special_entries(self):
103113 # theme-name
104 for theme in sorted(iglob(os.path.join(sys.prefix, 'share', 'themes', '*', 'gtk-3.0'))):
114 for theme in sorted(iglob(os.path.join(sys.prefix, 'share', 'themes',
115 '*', 'gtk-3.0'))):
105116 self._gtk_theme_values.append_text(theme.split(os.path.sep)[-2])
106117 # icon-theme-name
107 for theme in sorted(iglob(os.path.join(sys.prefix, 'share', 'icons', '*', 'index.theme'))):
118 for theme in sorted(iglob(os.path.join(sys.prefix, 'share', 'icons',
119 '*', 'index.theme'))):
108120 self._icons_theme_values.append_text(theme.split(os.path.sep)[-2])
109121 # screensaver-timeout
110122 timeout = self._bindings['greeter']['screensaver-timeout'].option
111123 timeout.get.connect(self.on_timeout_option_get)
112124 timeout.set.connect(self.on_timeout_option_set)
113 for mark in chain(range(10, 61, 10),
114 range(69, int(self._timeout_adjustment.props.upper), 10)):
125 for mark in chain(list(range(10, 61, 10)),
126 list(range(69,
127 int(self._timeout_adjustment.props.upper),
128 10))):
115129 self._timeout_view.add_mark(mark, Gtk.PositionType.BOTTOM, None)
116130 total = int(self._timeout_adjustment.props.upper - 60) + 1
117 self._timeout_end_label.props.label = C_('option|timeout', '{count} min')\
118 .format(count=total)
131 self._timeout_end_label.props.label = C_('option|timeout',
132 '{count} min')\
133 .format(count=total)
119134
120135 def _has_access_to_write(self, path):
121136 if os.path.exists(path) and os.access(self._config_path, os.W_OK):
131146 self._config.clear()
132147 try:
133148 if not self._config.read(self._config_path):
134 helpers.show_message(text=_('Failed to read configuration file: {path}')
135 .format(path=self._config_path),
149 helpers.show_message(text=_('Failed to read configuration '
150 'file: {path}')
151 .format(path=self._config_path),
136152 message_type=Gtk.MessageType.ERROR)
137 except (configparser.DuplicateSectionError, configparser.MissingSectionHeaderError):
153 except (configparser.DuplicateSectionError,
154 configparser.MissingSectionHeaderError):
138155 pass
139156
140157 if not self._config.has_option(GREETER_SECTION, 'indicators'):
147164 self._config.set(GREETER_SECTION, 'indicators', value)
148165 self._config.remove_option(GREETER_SECTION, 'show-indicators')
149166
150 for section, keys in self._bindings.items():
151 for key, binding in keys.items():
167 for section, keys in list(self._bindings.items()):
168 for key, binding in list(keys.items()):
152169 with binding.option.handler_block(binding.changed_handler):
153170 try:
154171 binding.option.value = self._config.get(section, key)
155172 binding.option.enabled = True
156 except (configparser.NoOptionError, configparser.NoSectionError):
173 except (configparser.NoOptionError,
174 configparser.NoSectionError):
157175 binding.option.value = binding.default
158176 binding.option.enabled = False
159 self._initial_values[binding.option] = InitialValue(binding.option.value,
160 binding.option.enabled)
177 self._initial_values[binding.option] = InitialValue(
178 binding.option.value,
179 binding.option.enabled)
161180 self._changed_values = set()
162181 self._apply_button.props.sensitive = False
163182
164183 def _write(self):
165 for section, keys in self._bindings.items():
184 for section, keys in list(self._bindings.items()):
166185 if not self._config.has_section(section):
167186 self._config.add_section(section)
168 for key, binding in keys.items():
187 for key, binding in list(keys.items()):
169188 if binding.option.enabled:
170189 self._config.set(section, key, binding.option.value)
171190 else:
172191 self._config.remove_option(section, key)
173 self._initial_values[binding.option] = InitialValue(binding.option.value,
174 binding.option.enabled)
192 self._initial_values[binding.option] = InitialValue(
193 binding.option.value,
194 binding.option.enabled)
175195 self._changed_values = set()
176196 self._apply_button.props.sensitive = False
177197 try:
182202
183203 def on_option_changed(self, option):
184204 if option.enabled != self._initial_values[option].state or \
185 (option.enabled and option.value != self._initial_values[option].value):
205 (option.enabled
206 and option.value != self._initial_values[option].value):
186207 self._changed_values.add(option)
187208 else:
188209 self._changed_values.discard(option)
189 self._apply_button.props.sensitive = self._allow_edit and self._changed_values
210 self._apply_button.props.sensitive = self._allow_edit and \
211 self._changed_values
190212
191213 def on_timeout_option_get(self, option=None, value=None):
192214 value = int(float(value))
1717 IconsFilterArgs = namedtuple('IconsFilterArgs', ('standard', 'context'))
1818
1919 BUILDER_WIDGETS = ('name', 'preview', 'standard_toggle', 'spinner',
20 'contexts_view', 'contexts_selection', 'contexts_model', 'contexts_filter',
21 'icons_view', 'icons_selection',
20 'contexts_view', 'contexts_selection', 'contexts_model',
21 'contexts_filter', 'icons_view', 'icons_selection',
2222 'icons_model', 'icons_sorted', 'icons_filter')
2323
2424 def __new__(cls):
4545 self._icon_to_select = None
4646 self._icons_filter_args = None
4747
48 self._contexts_view.set_row_separator_func(self._contexts_row_separator_callback, None)
49 self._contexts_filter.set_visible_func(self._contexts_filter_visible_callback)
50
51 self._icons_filter.set_visible_func(self._icons_filter_visible_callback)
48 self._contexts_view.set_row_separator_func(
49 self._contexts_row_separator_callback, None)
50 self._contexts_filter.set_visible_func(
51 self._contexts_filter_visible_callback)
52
53 self._icons_filter.set_visible_func(
54 self._icons_filter_visible_callback)
5255 self._icons_sorted.set_sort_column_id(0, Gtk.SortType.ASCENDING)
5356
5457 self._reload()
6265 translated_title = title and C_('icon-dialog', title)
6366 self._contexts_model.append(self.ContextsModelRow(name=name,
6467 standard=True,
65 title=translated_title))
68 title=
69 translated_title)
70 )
6671
6772 for name in theme.list_contexts():
6873 if name not in standard_contexts:
6974 self._contexts_model.append(self.ContextsModelRow(name=name,
70 standard=False,
75 standard=
76 False,
7177 title=name))
7278
7379 self._icons_model.clear()
8995
9096 def _update_contexts_filter(self):
9197 selected_iter = self._contexts_selection.get_selected()[1]
92 selected_path = self._contexts_filter.get_path(selected_iter) if selected_iter else None
98 selected_path = self._contexts_filter.get_path(
99 selected_iter) if selected_iter else None
93100 self._contexts_filter.refilter()
94 if selected_path and self._contexts_selection.path_is_selected(selected_path):
101 if selected_path and \
102 self._contexts_selection.path_is_selected(selected_path):
95103 self._update_icons_filter()
96104
97105 def _update_icons_filter(self):
98106 model, rowiter = self._contexts_selection.get_selected()
99107 if rowiter:
100 self._icons_filter_args = self.IconsFilterArgs(self._standard_toggle.props.active,
101 model[rowiter][self._CONTEXT_NAME])
108 self._icons_filter_args = self.IconsFilterArgs(
109 self._standard_toggle.props.active,
110 model[rowiter][self._CONTEXT_NAME])
102111 else:
103112 self._icons_filter_args = None
104113 self._icons_view.props.model = None
112121
113122 def _contexts_row_separator_callback(self, model, rowiter, data):
114123 return not model[rowiter][self._CONTEXT_NAME] and \
115 not model[rowiter][self._CONTEXT_TITLE]
124 not model[rowiter][self._CONTEXT_TITLE]
116125
117126 def _icons_filter_visible_callback(self, model, rowiter, data):
118127 if not self._icons_filter_args:
119128 return False
120 if self._icons_filter_args.standard and not model[rowiter][self._ICON_STANDARD]:
129 if self._icons_filter_args.standard and \
130 not model[rowiter][self._ICON_STANDARD]:
121131 return False
122132 if not self._icons_filter_args.context:
123133 return True
124 return model[rowiter][self._ICON_CONTEXT] == self._icons_filter_args.context
134 return model[rowiter][self._ICON_CONTEXT] == \
135 self._icons_filter_args.context
125136
126137 def run(self):
127138 return super().run()
134145 self._icon_to_select = name
135146 return
136147
137 if not self._icons_filter_args or self._icons_filter_args.context is not None:
148 if not self._icons_filter_args or \
149 self._icons_filter_args.context is not None:
138150 if name not in STANDARD_ICON_NAMES:
139151 self._standard_toggle.props.active = False
140152 self._contexts_selection.select_path(0)
166178 self._preview.props.icon_name = name
167179
168180
169 # http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
181 #http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
170182
171183 STANDARD_CONTEXTS =\
172 (
173 (None, NC_('icon-dialog', 'All contexts')),
174 (None, ''), # separator
175 ('Actions', NC_('icon-dialog', 'Actions')),
176 ('Applications', NC_('icon-dialog', 'Applications')),
177 ('Categories', NC_('icon-dialog', 'Categories')),
178 ('Devices', NC_('icon-dialog', 'Devices')),
179 ('Emblems', NC_('icon-dialog', 'Emblems')),
180 ('Emotes', NC_('icon-dialog', 'Emoticons')),
181 ('International', NC_('icon-dialog', 'International')),
182 ('MimeTypes', NC_('icon-dialog', 'MIME Types')),
183 ('Places', NC_('icon-dialog', 'Places')),
184 ('Status', NC_('icon-dialog', 'Status'))
185 )
184 (
185 (None, NC_('icon-dialog', 'All contexts')),
186 (None, ''), # separator
187 ('Actions', NC_('icon-dialog', 'Actions')),
188 ('Applications', NC_('icon-dialog', 'Applications')),
189 ('Categories', NC_('icon-dialog', 'Categories')),
190 ('Devices', NC_('icon-dialog', 'Devices')),
191 ('Emblems', NC_('icon-dialog', 'Emblems')),
192 ('Emotes', NC_('icon-dialog', 'Emoticons')),
193 ('International', NC_('icon-dialog', 'International')),
194 ('MimeTypes', NC_('icon-dialog', 'MIME Types')),
195 ('Places', NC_('icon-dialog', 'Places')),
196 ('Status', NC_('icon-dialog', 'Status'))
197 )
186198
187199 STANDARD_ICON_NAMES = \
188 {
189 # Actions
190 'address-book-new', 'application-exit', 'appointment-new', 'call-start', 'call-stop', 'contact-new',
191 'document-new', 'document-open', 'document-open-recent', 'document-page-setup', 'document-print',
192 'document-print-preview', 'document-properties', 'document-revert', 'document-save',
193 'document-save-as', 'document-send', 'edit-clear', 'edit-copy', 'edit-cut', 'edit-delete',
194 'edit-find', 'edit-find-replace', 'edit-paste', 'edit-redo', 'edit-select-all', 'edit-undo',
195 'folder-new', 'format-indent-less', 'format-indent-more', 'format-justify-center',
196 'format-justify-fill', 'format-justify-left', 'format-justify-right', 'format-text-direction-ltr',
197 'format-text-direction-rtl', 'format-text-bold', 'format-text-italic', 'format-text-underline',
198 'format-text-strikethrough', 'go-bottom', 'go-down', 'go-first', 'go-home', 'go-jump', 'go-last',
199 'go-next', 'go-previous', 'go-top', 'go-up', 'help-about', 'help-contents', 'help-faq',
200 'insert-image', 'insert-link', 'insert-object', 'insert-text', 'list-add', 'list-remove',
201 'mail-forward', 'mail-mark-important', 'mail-mark-junk', 'mail-mark-notjunk', 'mail-mark-read',
202 'mail-mark-unread', 'mail-message-new', 'mail-reply-all', 'mail-reply-sender', 'mail-send',
203 'mail-send-receive', 'media-eject', 'media-playback-pause', 'media-playback-start',
204 'media-playback-stop', 'media-record', 'media-seek-backward', 'media-seek-forward',
205 'media-skip-backward', 'media-skip-forward', 'object-flip-horizontal', 'object-flip-vertical',
206 'object-rotate-left', 'object-rotate-right', 'process-stop', 'system-lock-screen',
207 'system-log-out', 'system-run', 'system-search', 'system-reboot', 'system-shutdown',
208 'tools-check-spelling', 'view-fullscreen', 'view-refresh', 'view-restore', 'view-sort-ascending',
209 'view-sort-descending', 'window-close', 'window-new', 'zoom-fit-best', 'zoom-in', 'zoom-original',
210 'zoom-out',
211 # StandardApplicationIcons
212 'accessories-calculator', 'accessories-character-map', 'accessories-dictionary',
213 'accessories-text-editor', 'help-browser', 'multimedia-volume-control',
214 'preferences-desktop-accessibility', 'preferences-desktop-font', 'preferences-desktop-keyboard',
215 'preferences-desktop-locale', 'preferences-desktop-multimedia', 'preferences-desktop-screensaver',
216 'preferences-desktop-theme', 'preferences-desktop-wallpaper', 'system-file-manager',
217 'system-software-install', 'system-software-update', 'utilities-system-monitor',
218 'utilities-terminal',
219 # StandardCategoryIcons
220 'applications-accessories', 'applications-development', 'applications-engineering',
221 'applications-games', 'applications-graphics', 'applications-internet', 'applications-multimedia',
222 'applications-office', 'applications-other', 'applications-science', 'applications-system',
223 'applications-utilities', 'preferences-desktop', 'preferences-desktop-peripherals',
224 'preferences-desktop-personal', 'preferences-other', 'preferences-system',
225 'preferences-system-network', 'system-help',
226 # StandardDeviceIcons
227 'audio-card', 'audio-input-microphone', 'battery', 'camera-photo', 'camera-video', 'camera-web',
228 'computer', 'drive-harddisk', 'drive-optical', 'drive-removable-media', 'input-gaming',
229 'input-keyboard', 'input-mouse', 'input-tablet', 'media-flash', 'media-floppy', 'media-optical',
230 'media-tape', 'modem', 'multimedia-player', 'network-wired', 'network-wireless', 'pda', 'phone',
231 'printer', 'scanner', 'video-display',
232 # StandardEmblemIcons
233 'emblem-default', 'emblem-documents', 'emblem-downloads', 'emblem-favorite', 'emblem-important',
234 'emblem-mail', 'emblem-photos', 'emblem-readonly', 'emblem-shared', 'emblem-symbolic-link',
235 'emblem-synchronized', 'emblem-system', 'emblem-unreadable',
236 # StandardEmotionIcons
237 'face-angel', 'face-angry', 'face-cool', 'face-crying', 'face-devilish', 'face-embarrassed',
238 'face-kiss', 'face-laugh', 'face-monkey', 'face-plain', 'face-raspberry', 'face-sad',
239 'face-sick', 'face-smile', 'face-smile-big', 'face-smirk', 'face-surprise', 'face-tired',
240 'face-uncertain', 'face-wink', 'face-worried',
241 # StandardInternationalIcons
242 'flag-aa',
243 # StandardMIMETypeIcons
244 'application-x-executable', 'audio-x-generic', 'font-x-generic', 'image-x-generic',
245 'package-x-generic', 'text-html', 'text-x-generic', 'text-x-generic-template', 'text-x-script',
246 'video-x-generic', 'x-office-address-book', 'x-office-calendar', 'x-office-document',
247 'x-office-presentation', 'x-office-spreadsheet',
248 # StandardPlaceIcons
249 'folder', 'folder-remote', 'network-server', 'network-workgroup', 'start-here', 'user-bookmarks',
250 'user-desktop', 'user-home', 'user-trash',
251 # StandardStatusIcons
252 'appointment-missed', 'appointment-soon', 'audio-volume-high', 'audio-volume-low',
253 'audio-volume-medium', 'audio-volume-muted', 'battery-caution', 'battery-low', 'dialog-error',
254 'dialog-information', 'dialog-password', 'dialog-question', 'dialog-warning', 'folder-drag-accept',
255 'folder-open', 'folder-visiting', 'image-loading', 'image-missing', 'mail-attachment',
256 'mail-unread', 'mail-read', 'mail-replied', 'mail-signed', 'mail-signed-verified',
257 'media-playlist-repeat', 'media-playlist-shuffle', 'network-error', 'network-idle',
258 'network-offline', 'network-receive', 'network-transmit', 'network-transmit-receive',
259 'printer-error', 'printer-printing', 'security-high', 'security-medium', 'security-low',
260 'software-update-available', 'software-update-urgent', 'sync-error', 'sync-synchronizing',
261 'task-due', 'task-past-due', 'user-available', 'user-away', 'user-idle', 'user-offline',
262 'user-trash-full', 'weather-clear', 'weather-clear-night', 'weather-few-clouds',
263 'weather-few-clouds-night', 'weather-fog', 'weather-overcast', 'weather-severe-alert',
264 'weather-showers', 'weather-showers-scattered', 'weather-snow', 'weather-storm'
265 }
200 {
201 # Actions
202 'address-book-new', 'application-exit', 'appointment-new',
203 'call-start', 'call-stop', 'contact-new', 'document-new',
204 'document-open', 'document-open-recent', 'document-page-setup',
205 'document-print', 'document-print-preview', 'document-properties',
206 'document-revert', 'document-save', 'document-save-as',
207 'document-send', 'edit-clear', 'edit-copy', 'edit-cut', 'edit-delete',
208 'edit-find', 'edit-find-replace', 'edit-paste', 'edit-redo',
209 'edit-select-all', 'edit-undo', 'folder-new', 'format-indent-less',
210 'format-indent-more', 'format-justify-center', 'format-justify-fill',
211 'format-justify-left', 'format-justify-right',
212 'format-text-direction-ltr', 'format-text-direction-rtl',
213 'format-text-bold', 'format-text-italic', 'format-text-underline',
214 'format-text-strikethrough', 'go-bottom', 'go-down', 'go-first',
215 'go-home', 'go-jump', 'go-last', 'go-next', 'go-previous', 'go-top',
216 'go-up', 'help-about', 'help-contents', 'help-faq', 'insert-image',
217 'insert-link', 'insert-object', 'insert-text', 'list-add',
218 'list-remove', 'mail-forward', 'mail-mark-important', 'mail-mark-junk',
219 'mail-mark-notjunk', 'mail-mark-read', 'mail-mark-unread',
220 'mail-message-new', 'mail-reply-all', 'mail-reply-sender', 'mail-send',
221 'mail-send-receive', 'media-eject', 'media-playback-pause',
222 'media-playback-start', 'media-playback-stop', 'media-record',
223 'media-seek-backward', 'media-seek-forward', 'media-skip-backward',
224 'media-skip-forward', 'object-flip-horizontal', 'object-flip-vertical',
225 'object-rotate-left', 'object-rotate-right', 'process-stop',
226 'system-lock-screen', 'system-log-out', 'system-run', 'system-search',
227 'system-reboot', 'system-shutdown', 'tools-check-spelling',
228 'view-fullscreen', 'view-refresh', 'view-restore',
229 'view-sort-ascending', 'view-sort-descending', 'window-close',
230 'window-new', 'zoom-fit-best', 'zoom-in', 'zoom-original', 'zoom-out',
231 # StandardApplicationIcons
232 'accessories-calculator', 'accessories-character-map',
233 'accessories-dictionary', 'accessories-text-editor', 'help-browser',
234 'multimedia-volume-control', 'preferences-desktop-accessibility',
235 'preferences-desktop-font', 'preferences-desktop-keyboard',
236 'preferences-desktop-locale', 'preferences-desktop-multimedia',
237 'preferences-desktop-screensaver', 'preferences-desktop-theme',
238 'preferences-desktop-wallpaper', 'system-file-manager',
239 'system-software-install', 'system-software-update',
240 'utilities-system-monitor', 'utilities-terminal',
241 # StandardCategoryIcons
242 'applications-accessories', 'applications-development',
243 'applications-engineering', 'applications-games',
244 'applications-graphics', 'applications-internet',
245 'applications-multimedia', 'applications-office', 'applications-other',
246 'applications-science', 'applications-system',
247 'applications-utilities', 'preferences-desktop',
248 'preferences-desktop-peripherals', 'preferences-desktop-personal',
249 'preferences-other', 'preferences-system',
250 'preferences-system-network', 'system-help',
251 # StandardDeviceIcons
252 'audio-card', 'audio-input-microphone', 'battery', 'camera-photo',
253 'camera-video', 'camera-web', 'computer', 'drive-harddisk',
254 'drive-optical', 'drive-removable-media', 'input-gaming',
255 'input-keyboard', 'input-mouse', 'input-tablet', 'media-flash',
256 'media-floppy', 'media-optical', 'media-tape', 'modem',
257 'multimedia-player', 'network-wired', 'network-wireless', 'pda',
258 'phone', 'printer', 'scanner', 'video-display',
259 # StandardEmblemIcons
260 'emblem-default', 'emblem-documents', 'emblem-downloads',
261 'emblem-favorite', 'emblem-important', 'emblem-mail', 'emblem-photos',
262 'emblem-readonly', 'emblem-shared', 'emblem-symbolic-link',
263 'emblem-synchronized', 'emblem-system', 'emblem-unreadable',
264 # StandardEmotionIcons
265 'face-angel', 'face-angry', 'face-cool', 'face-crying',
266 'face-devilish', 'face-embarrassed', 'face-kiss', 'face-laugh',
267 'face-monkey', 'face-plain', 'face-raspberry', 'face-sad', 'face-sick',
268 'face-smile', 'face-smile-big', 'face-smirk', 'face-surprise',
269 'face-tired', 'face-uncertain', 'face-wink', 'face-worried',
270 # StandardInternationalIcons
271 'flag-aa',
272 # StandardMIMETypeIcons
273 'application-x-executable', 'audio-x-generic', 'font-x-generic',
274 'image-x-generic', 'package-x-generic', 'text-html', 'text-x-generic',
275 'text-x-generic-template', 'text-x-script', 'video-x-generic',
276 'x-office-address-book', 'x-office-calendar', 'x-office-document',
277 'x-office-presentation', 'x-office-spreadsheet',
278 # StandardPlaceIcons
279 'folder', 'folder-remote', 'network-server', 'network-workgroup',
280 'start-here', 'user-bookmarks', 'user-desktop', 'user-home',
281 'user-trash',
282 # StandardStatusIcons
283 'appointment-missed', 'appointment-soon', 'audio-volume-high',
284 'audio-volume-low', 'audio-volume-medium', 'audio-volume-muted',
285 'battery-caution', 'battery-low', 'dialog-error', 'dialog-information',
286 'dialog-password', 'dialog-question', 'dialog-warning',
287 'folder-drag-accept', 'folder-open', 'folder-visiting',
288 'image-loading', 'image-missing', 'mail-attachment', 'mail-unread',
289 'mail-read', 'mail-replied', 'mail-signed', 'mail-signed-verified',
290 'media-playlist-repeat', 'media-playlist-shuffle', 'network-error',
291 'network-idle', 'network-offline', 'network-receive',
292 'network-transmit', 'network-transmit-receive', 'printer-error',
293 'printer-printing', 'security-high', 'security-medium', 'security-low',
294 'software-update-available', 'software-update-urgent', 'sync-error',
295 'sync-synchronizing', 'task-due', 'task-past-due', 'user-available',
296 'user-away', 'user-idle', 'user-offline', 'user-trash-full',
297 'weather-clear', 'weather-clear-night', 'weather-few-clouds',
298 'weather-few-clouds-night', 'weather-fog', 'weather-overcast',
299 'weather-severe-alert', 'weather-showers', 'weather-showers-scattered',
300 'weather-snow', 'weather-storm'
301 }
3434 self._add_callback = add_callback
3535 self._add_button.props.visible = add_callback is not None
3636
37 for path in sorted(iglob(os.path.join(sys.prefix, 'share', 'unity', 'indicators', '*'))):
37 for path in sorted(iglob(os.path.join(sys.prefix, 'share', 'unity',
38 'indicators', '*'))):
3839 name = os.path.basename(path)
3940 parts = name.rsplit('.', maxsplit=1)
4041 if len(parts) == 2 and parts[0] == 'com.canonical.indicator':
4142 name = parts[1]
4243 self._short_model.append((name,))
4344
44 for path in sorted(iglob(os.path.join(sys.prefix, 'lib', 'indicators3', '7', '*.so'))):
45 for path in sorted(iglob(os.path.join(sys.prefix, 'lib', 'indicators3',
46 '7', '*.so'))):
4547 self._short_model.append((os.path.basename(path),))
4648
4749 def _get_current_value(self):
77 from gi.repository import Gtk, Gdk, GObject
88
99 from lightdm_gtk_greeter_settings.helpers import C_
10 from lightdm_gtk_greeter_settings.IndicatorChooserDialog import IndicatorChooserDialog
10 from lightdm_gtk_greeter_settings.IndicatorChooserDialog import \
11 IndicatorChooserDialog
1112 from lightdm_gtk_greeter_settings.IconChooserDialog import IconChooserDialog
1213
1314
5556 pass
5657
5758 @GObject.Signal(flags=GObject.SIGNAL_RUN_CLEANUP)
58 def get(self, value: str) -> str: #@IgnorePep8
59 def get(self, value: str) -> str: # @IgnorePep8
5960 pass
6061
6162 @GObject.Signal(flags=GObject.SIGNAL_RUN_CLEANUP)
62 def set(self, value: str) -> str: #@IgnorePep8
63 def set(self, value: str) -> str: # @IgnorePep8
6364 pass
6465
6566 def __repr__(self):
6768 value = self._get_value()
6869 except NotImplemented:
6970 value = '<Undefined>'
70 return '%s(%s:%s)' % (self.__class__.__name__, int(self.enabled), value)
71 return '%s(%s:%s)' % (self.__class__.__name__, int(self.enabled),
72 value)
7173
7274 def _get_value(self):
7375 raise NotImplementedError(self.__class__)
8789
8890
8991 class BooleanEntry(BaseEntry):
92
9093 def __init__(self, widgets):
9194 super().__init__(widgets)
9295 self._value = widgets['value']
9699 return 'true' if self._value.props.active else 'false'
97100
98101 def _set_value(self, value):
99 self._value.props.active = value and value.lower() not in ('false', 'no', '0')
102 self._value.props.active = value and value.lower() not in (
103 'false', 'no', '0')
100104
101105 def _set_enabled(self, value):
102106 self._value.props.sensitive = value
198202 self._color_choice.props.active = color is not None
199203 self._image_choice.props.active = color is None
200204
201 if color is not None:
205 if color is not None:
202206 self._color_value.props.color = color
203207 self._image_value.unselect_all()
204208 else:
255259 self._menu.connect('hide', self._on_menu_hide)
256260 self._icon_item.connect('activate', self._on_select_icon)
257261 self._path_item.connect('activate', self._on_select_path)
258 self._path_dialog.connect('update-preview', self._on_update_path_preview)
262 self._path_dialog.connect(
263 'update-preview', self._on_update_path_preview)
259264
260265 def _get_value(self):
261266 return self._value
280285
281286 def _update_menu_items(self, icon=None, path=None):
282287 if icon:
283 self._icon_item.get_child().set_markup(C_('option-entry|icon', '<b>Icon: {icon}</b>')
284 .format(icon=icon))
285 else:
286 self._icon_item.get_child().set_markup(C_('option-entry|icon', 'Select icon name...'))
288 self._icon_item.get_child().set_markup(C_('option-entry|icon',
289 '<b>Icon: {icon}</b>')
290 .format(icon=icon))
291 else:
292 self._icon_item.get_child().set_markup(
293 C_('option-entry|icon', 'Select icon name...'))
287294
288295 if path:
289 self._path_item.get_child().set_markup(C_('option-entry|icon', '<b>File: {path}</b>')
290 .format(path=os.path.basename(path)))
291 else:
292 self._path_item.get_child().set_markup(C_('option-entry|icon', 'Select file...'))
296 self._path_item.get_child()\
297 .set_markup(C_('option-entry|icon',
298 '<b>File: {path}</b>')
299 .format(path=os.path.basename(path)))
300 else:
301 self._path_item.get_child().set_markup(
302 C_('option-entry|icon', 'Select file...'))
293303
294304 def _get_menu_position(self, menu, widget):
295305 allocation = widget.get_allocation()
333343 class IndicatorsEntry(BaseEntry):
334344 NAMES_DELIMITER = ';'
335345 # It is the only place where model columns order defined
336 ModelRow = namedtuple('ModelRow', ('enabled', 'name', 'builtin', 'external'))
346 ModelRow = namedtuple(
347 'ModelRow', ('enabled', 'name', 'builtin', 'external'))
337348
338349 def __init__(self, widgets):
339350 super().__init__(widgets)
355366 self._model = widgets['model']
356367
357368 self._initial_items = OrderedDict((item.name, item)
358 for item in map(self.ModelRow._make, self._model))
369 for item in map(self.ModelRow._make,
370 self._model))
359371 self._indicators_dialog = None
360372
361373 self._treeview.connect('key-press-event', self._on_key_press)
376388 self._emit_changed()
377389
378390 def _get_value(self):
379 return self.NAMES_DELIMITER.join(item.name for item in map(self.ModelRow._make, self._model)
380 if (item.builtin and item.enabled) or item.external)
391 return self.NAMES_DELIMITER.join(item.name for item in
392 map(self.ModelRow._make, self._model)
393 if (item.builtin and item.enabled)
394 or item.external)
381395
382396 def _set_value(self, value, update_model=True):
383397 if update_model:
386400 if value:
387401 for name in value.split(self.NAMES_DELIMITER):
388402 try:
389 self._model.append(last_options.pop(name)._replace(enabled=True))
403 self._model.append(
404 last_options.pop(name)._replace(enabled=True))
390405 except KeyError:
391 self._model.append(self.ModelRow(name=name, external=True,
392 builtin=False, enabled=False))
393
394 for item in last_options.values():
406 self._model.append(
407 self.ModelRow(name=name, external=True,
408 builtin=False, enabled=False))
409
410 for item in list(last_options.values()):
395411 self._model.append(item)
396412
397413 self._selection.select_path(0)
425441 if any(row[self._model_name] == name for row in self._model):
426442 return C_('option-entry|indicators',
427443 'Indicator "{indicator}" is already in the list')\
428 .format(indicator=name)
444 .format(indicator=name)
429445 return True
430446
431447 def _add_indicator(self, name):
432448 if name:
433 rowiter = self._model.append(self.ModelRow(name=name, external=True,
434 builtin=False, enabled=False))
449 rowiter = self._model.append(
450 self.ModelRow(name=name, external=True,
451 builtin=False, enabled=False))
435452 self._selection.select_iter(rowiter)
436453 self._treeview.grab_focus()
437454
441458 elif Gdk.keyval_name(event.keyval) == 'F2':
442459 model, rowiter = self._selection.get_selected()
443460 if rowiter and model[rowiter][self._model_external]:
444 self._treeview.set_cursor(model.get_path(rowiter), self._name_column, True)
461 self._treeview.set_cursor(
462 model.get_path(rowiter), self._name_column, True)
445463 else:
446464 return False
447465 return True
448466
449467 def _on_state_toggled(self, renderer, path):
450 self._model[path][self._model_enabled] = not self._model[path][self._model_enabled]
468 self._model[path][self._model_enabled] = not self._model[
469 path][self._model_enabled]
451470
452471 def _on_name_edited(self, renderer, path, name):
453472 check = self._check_indicator(name)
457476 def _on_selection_changed(self, selection):
458477 model, rowiter = selection.get_selected()
459478 has_selection = rowiter is not None
460 self._remove.props.sensitive = has_selection and model[rowiter][self._model_external]
461 self._down.props.sensitive = has_selection and model.iter_next(rowiter) is not None
462 self._up.props.sensitive = has_selection and model.iter_previous(rowiter) is not None
479 self._remove.props.sensitive = has_selection and model[
480 rowiter][self._model_external]
481 self._down.props.sensitive = has_selection and model.iter_next(
482 rowiter) is not None
483 self._up.props.sensitive = has_selection and model.iter_previous(
484 rowiter) is not None
463485 if has_selection:
464486 self._treeview.scroll_to_cell(model.get_path(rowiter))
465487
466488 def _on_add(self, *args):
467489 if not self._indicators_dialog:
468 self._indicators_dialog = IndicatorChooserDialog(check_callback=self._check_indicator,
469 add_callback=self._add_indicator)
470 self._indicators_dialog.props.transient_for = self._treeview.get_toplevel()
490 self._indicators_dialog = IndicatorChooserDialog(
491 check_callback=self._check_indicator,
492 add_callback=self._add_indicator)
493 self._indicators_dialog.props.transient_for = \
494 self._treeview.get_toplevel()
471495 name = self._indicators_dialog.get_indicator()
472496 if name:
473497 self._add_indicator(name)
485509 class PositionEntry(BaseEntry):
486510
487511 class Dimension:
512
488513 def __init__(self, name, widgets, anchors, on_changed):
489514 self.__dict__.update(('_%s' % w, widgets['%s_%s' % (name, w)])
490 for w in ('value', 'percents', 'mirror', 'adjustment'))
515 for w in ('value', 'percents', 'mirror',
516 'adjustment'))
491517 self._name = name
492518 self._on_changed = on_changed
493519 self._anchor = ''
494520
495521 self._percents.connect('toggled', self._on_percents_toggled)
496522 self._mirror.connect('toggled', self._on_mirror_toggled)
497 self._on_value_changed_id = self._adjustment.connect('value-changed',
498 self._on_value_changed)
499
500 for (x, y), widget in anchors.items():
523 self._on_value_changed_id = self._adjustment.connect(
524 'value-changed',
525 self._on_value_changed)
526
527 for (x, y), widget in list(anchors.items()):
501528 widget.connect('toggled', self._on_anchor_toggled, self,
502529 x if self._name == 'x' else y)
503530
531558 self._anchor = anchor
532559
533560 self._percents.props.active = percents
534 self._adjustment.props.upper = 100 if self._percents.props.active else 10000
561 self._adjustment.props.upper = 100 if self._percents.props.active \
562 else 10000
535563 self._mirror.props.active = negative
536564 with self._adjustment.handler_block(self._on_value_changed_id):
537565 self._adjustment.props.value = -p if negative else p
571599 self._on_changed(self)
572600
573601 def _on_percents_toggled(self, toggle):
574 self._adjustment.props.upper = 100 if toggle.props.active else 10000
602 self._adjustment.props.upper = 100 if toggle.props.active \
603 else 10000
575604 self._on_changed(self)
576605
577606 def _on_mirror_toggled(self, toggle):
578607 self._on_changed(self)
579608
580609 def _on_anchor_toggled(self, toggle, dimension, anchor):
581 if dimension == self and toggle.props.active and anchor != self._anchor:
610 if dimension == self and toggle.props.active \
611 and anchor != self._anchor:
582612 self._anchor = anchor
583613 self._on_changed(self)
584614
592622 self._screen_size = (0, 0)
593623
594624 self._anchors = {(x, y): widgets['base_%s_%s' % (x, y)]
595 for x, y in product(('start', 'center', 'end'), repeat=2)}
596
597 self._on_resize_id = self._screen.connect('size-allocate', self._on_resize)
625 for x, y in product(('start', 'center', 'end'),
626 repeat=2)}
627
628 self._on_resize_id = self._screen.connect(
629 'size-allocate', self._on_resize)
598630 self._screen.connect('draw', self._on_draw_screen_border)
599631 self._screen.connect('screen-changed', self._on_gdkscreen_changed)
600 self._on_gdkscreen_monitors_changed_id = self._screen.get_screen().connect(
601 'monitors-changed',
602 self._on_gdkscreen_monitors_changed)
603
604 self._x = PositionEntry.Dimension('x', widgets, self._anchors, self._on_dimension_changed)
605 self._y = PositionEntry.Dimension('y', widgets, self._anchors, self._on_dimension_changed)
632 self._on_gdkscreen_monitors_changed_id = \
633 self._screen.get_screen().connect('monitors-changed',
634 self.
635 _on_gdkscreen_monitors_changed)
636
637 self._x = PositionEntry.Dimension(
638 'x', widgets, self._anchors, self._on_dimension_changed)
639 self._y = PositionEntry.Dimension(
640 'y', widgets, self._anchors, self._on_dimension_changed)
606641
607642 def _get_value(self):
608643 return self._x.value + ' ' + self._y.value
622657 window_size = window_allocation.width, window_allocation.height
623658 scale = self._screen_size[0] / geometry.width
624659
625 x = self._screen_pos[0] + self._x.get_scaled_position(self._screen_size, window_size, scale)
626 y = self._screen_pos[1] + self._y.get_scaled_position(self._screen_size, window_size, scale)
660 x = self._screen_pos[0] + \
661 self._x.get_scaled_position(self._screen_size, window_size, scale)
662 y = self._screen_pos[1] + \
663 self._y.get_scaled_position(self._screen_size, window_size, scale)
627664
628665 self._screen.move(self._window, x, y)
629666 self._screen.check_resize()
644681
645682 with self._screen.handler_block(self._on_resize_id):
646683 scale = width / geometry.width
647 self._window.set_size_request(PositionEntry.REAL_WINDOW_SIZE[0] * scale,
648 PositionEntry.REAL_WINDOW_SIZE[1] * scale)
684 self._window.set_size_request(
685 PositionEntry.REAL_WINDOW_SIZE[0] * scale,
686 PositionEntry.REAL_WINDOW_SIZE[1] * scale)
649687 self._update_layout()
650688
651689 def _on_draw_screen_border(self, widget, cr):
674712 if prev_screen:
675713 prev_screen.disconnect(self._on_gdkscreen_monitors_changed_id)
676714 self._on_gdkscreen_monitors_changed_id = widget.get_screen().connect(
677 'monitors-changed',
678 self._on_gdkscreen_monitors_changed)
715 'monitors-changed',
716 self._on_gdkscreen_monitors_changed)
679717
680718 def _on_gdkscreen_monitors_changed(self, screen):
681719 self._screen.queue_resize()
77 msgstr ""
88 "Project-Id-Version: PACKAGE VERSION\n"
99 "Report-Msgid-Bugs-To: \n"
10 "POT-Creation-Date: 2014-03-02 16:43+0300\n"
10 "POT-Creation-Date: 2014-03-15 23:18-0400\n"
1111 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313 "Language-Team: LANGUAGE <LL@li.org>\n"
359359 msgid "Absolute path to indicator library file (*.so)"
360360 msgstr ""
361361
362 #: ../lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py:93
362 #: ../lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py:102
363363 msgid "No permissions to save configuration"
364364 msgstr ""
365365
366 #: ../lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py:95
366 #: ../lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py:104
367 #, python-brace-format
367368 msgid ""
368369 "It seems that you don't have permissions to write to file:\n"
369370 "{path}\n"
371372 "Try to run this program using \"sudo\" or \"pkexec\""
372373 msgstr ""
373374
374 #: ../lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py:116
375 #: ../lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py:133
376 #, python-brace-format
375377 msgctxt "option|timeout"
376378 msgid "{count} min"
377379 msgstr ""
378380
379 #: ../lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py:132
381 #: ../lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py:150
382 #, python-brace-format
380383 msgid "Failed to read configuration file: {path}"
381384 msgstr ""
382385
383 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:170
386 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:186
384387 msgctxt "icon-dialog"
385388 msgid "All contexts"
386389 msgstr ""
387390
388391 #. separator
389 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:172
392 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:188
390393 msgctxt "icon-dialog"
391394 msgid "Actions"
392395 msgstr ""
393396
394 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:173
397 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:189
395398 msgctxt "icon-dialog"
396399 msgid "Applications"
397400 msgstr ""
398401
399 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:174
402 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:190
400403 msgctxt "icon-dialog"
401404 msgid "Categories"
402405 msgstr ""
403406
404 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:175
407 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:191
405408 msgctxt "icon-dialog"
406409 msgid "Devices"
407410 msgstr ""
408411
409 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:176
412 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:192
410413 msgctxt "icon-dialog"
411414 msgid "Emblems"
412415 msgstr ""
413416
414 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:177
417 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:193
415418 msgctxt "icon-dialog"
416419 msgid "Emoticons"
417420 msgstr ""
418421
419 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:178
422 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:194
420423 msgctxt "icon-dialog"
421424 msgid "International"
422425 msgstr ""
423426
424 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:179
427 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:195
425428 msgctxt "icon-dialog"
426429 msgid "MIME Types"
427430 msgstr ""
428431
429 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:180
432 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:196
430433 msgctxt "icon-dialog"
431434 msgid "Places"
432435 msgstr ""
433436
434 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:181
437 #: ../lightdm_gtk_greeter_settings/IconChooserDialog.py:197
435438 msgctxt "icon-dialog"
436439 msgid "Status"
437440 msgstr ""
438441
439 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:284
442 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:290
443 #, python-brace-format
440444 msgctxt "option-entry|icon"
441445 msgid "<b>Icon: {icon}</b>"
442446 msgstr ""
443447
444 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:287
448 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:294
445449 msgctxt "option-entry|icon"
446450 msgid "Select icon name..."
447451 msgstr ""
448452
449 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:290
453 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:299
454 #, python-brace-format
450455 msgctxt "option-entry|icon"
451456 msgid "<b>File: {path}</b>"
452457 msgstr ""
453458
454 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:293
459 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:303
455460 msgctxt "option-entry|icon"
456461 msgid "Select file..."
457462 msgstr ""
458463
459 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:427
464 #: ../lightdm_gtk_greeter_settings/OptionEntry.py:444
465 #, python-brace-format
460466 msgctxt "option-entry|indicators"
461467 msgid "Indicator \"{indicator}\" is already in the list"
462468 msgstr ""
11
22 import os
33 import sys
4 import configparser
54
65 try:
76 import DistUtilsExtra.auto
87 except ImportError:
9 print('To build lightdm-gtk-greeter-settings you need https://launchpad.net/python-distutils-extra')
8 print(
9 'To build lightdm-gtk-greeter-settings you need '
10 'https://launchpad.net/python-distutils-extra')
1011 sys.exit(1)
11 assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
12 assert DistUtilsExtra.auto.__version__ >= '2.18', \
13 'needs DistUtilsExtra.auto >= 2.18'
14
1215
1316 def write_config(libdir, values):
14 filename = os.path.join(libdir, 'lightdm_gtk_greeter_settings/installation_config.py')
17 filename = os.path.join(
18 libdir, 'lightdm_gtk_greeter_settings/installation_config.py')
1519 try:
1620 f = open(filename, 'w')
1721 f.write('__all__ = [%s]\n' % ', '.join('"%s"' % k for k in values))
2327
2428
2529 class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
30
2631 def run(self):
2732 DistUtilsExtra.auto.install_auto.run(self)
2833
3540 write_config(self.install_lib, values)
3641
3742
38 DistUtilsExtra.auto.setup \
39 (
43 DistUtilsExtra.auto.setup(
4044 name='lightdm-gtk-greeter-settings',
4145 version='0.3',
4246 license='GPL-3',
4751 url='https://launchpad.net/lightdm-gtk-greeter-settings',
4852 cmdclass={'install': InstallAndUpdateDataDirectory},
4953 )
50