Support gtk-3.* themes (LP: #1709864)
Sean Davis
6 years ago
522 | 522 |
return ''
|
523 | 523 |
|
524 | 524 |
# [greeter] theme-name
|
525 | |
GtkThemesPattern = (sys.prefix, 'share', 'themes', '*', 'gtk-3.0', 'gtk.css')
|
|
525 |
# LP: #1709864, Support gtk-3.* themes
|
|
526 |
GtkThemesPattern = (sys.prefix, 'share', 'themes', '*', 'gtk-3.*', 'gtk.css')
|
526 | 527 |
|
527 | 528 |
def on_entry_setup_greeter_theme_name(self, entry, pattern=GtkThemesPattern):
|
528 | 529 |
values = entry.widgets['values']
|
|
530 |
themes = []
|
529 | 531 |
idx = pattern.index('*') - len(pattern)
|
530 | 532 |
for path in sorted(iglob(os.path.join(*pattern))):
|
531 | |
values.append_text(path.split(os.path.sep)[idx])
|
|
533 |
theme = path.split(os.path.sep)[idx]
|
|
534 |
if theme not in themes:
|
|
535 |
themes.append(theme)
|
|
536 |
|
|
537 |
themes = sorted(themes, key=lambda theme: theme.lower())
|
|
538 |
|
|
539 |
for theme in themes:
|
|
540 |
values.append_text(theme)
|
532 | 541 |
|
533 | 542 |
def on_entry_changed_greeter_theme_name(self, entry, pattern=GtkThemesPattern):
|
534 | 543 |
value = entry.value
|
170 | 170 |
def check_path_accessibility(path, file=True, executable=False):
|
171 | 171 |
"""Return None if file is readable by greeter and error message otherwise"""
|
172 | 172 |
|
|
173 |
# LP: #1709864, Support gtk-3.* themes
|
|
174 |
if "gtk-3.*" in path:
|
|
175 |
for x in range(0, 40):
|
|
176 |
if os.path.exists(path.replace("gtk-3.*", "gtk-3.%i" % x)):
|
|
177 |
path = path.replace("gtk-3.*", "gtk-3.%i" % x)
|
|
178 |
return check_path_accessibility(path, file, executable)
|
|
179 |
|
173 | 180 |
if not os.path.exists(path):
|
174 | 181 |
return _('File not found: {path}').format(path=path)
|
175 | 182 |
|