diff --git a/data/GtkGreeterSettingsWindow.ui b/data/GtkGreeterSettingsWindow.ui index 7f6e0b7..824f3ad 100644 --- a/data/GtkGreeterSettingsWindow.ui +++ b/data/GtkGreeterSettingsWindow.ui @@ -221,7 +221,6 @@ False True True - True True @@ -665,6 +664,7 @@ True + False @@ -948,6 +948,7 @@ 1 True + False @@ -1235,6 +1236,7 @@ 2 True + False @@ -1267,54 +1269,6 @@ - - True - False - start - True - Onscreen keyboard - - - - - - 0 - 0 - - - - - True - False - 24 - True - - onboard - - - - True - - - - - 0 - 1 - 2 - - - - - True - False - end - - - 1 - 0 - - - True False @@ -1366,6 +1320,124 @@ 0 3 + 2 + + + + + True + False + start + Accessibility + + + + + + 0 + 0 + 2 + + + + + True + False + 24 + 8 + 8 + + + Keyboard + True + True + False + 0 + True + + + 0 + 0 + + + + + Reader + True + True + False + 0 + True + + + 0 + 1 + + + + + True + False + start + <i>You can choose accessibility features <a href="">enabled at start</a></i> + True + + + 0 + 2 + 2 + + + + + True + False + True + True + + Select path to reader... + - + orca + + + + True + Command to launch screen reader + + + + + 1 + 1 + + + + + True + False + True + True + + Select path to keyboard... + - + onboard + + + + True + Command to launch on-screen keyboard + + + + + 1 + 0 + + + + + 0 + 1 2 @@ -1384,6 +1456,7 @@ 3 True + False diff --git a/lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py b/lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py index 77e0b2d..4530fb8 100644 --- a/lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py +++ b/lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py @@ -93,7 +93,8 @@ 'position': (PositionEntry.PositionEntry, '50%,center'), # Misc 'screensaver-timeout': (OptionEntry.AdjustmentEntry, 60), - 'keyboard': (OptionEntry.StringEntry, None) + 'keyboard': (OptionEntry.StringPathEntry, None), + 'reader': (OptionEntry.StringPathEntry, None) }), MonitorsGroup(self._widgets) ) diff --git a/lightdm_gtk_greeter_settings/OptionEntry.py b/lightdm_gtk_greeter_settings/OptionEntry.py index 9262f35..e022a5a 100644 --- a/lightdm_gtk_greeter_settings/OptionEntry.py +++ b/lightdm_gtk_greeter_settings/OptionEntry.py @@ -17,6 +17,7 @@ from builtins import isinstance from collections import OrderedDict +from locale import gettext as _ import os import time @@ -29,7 +30,7 @@ from lightdm_gtk_greeter_settings.helpers import string2bool, bool2string -__all__ = ['BaseEntry', 'BooleanEntry', 'StringEntry', 'ClockFormatEntry', +__all__ = ['BaseEntry', 'BooleanEntry', 'StringEntry', 'StringPathEntry', 'ClockFormatEntry', 'BackgroundEntry', 'IconEntry', 'IndicatorsEntry', 'AdjustmentEntry', 'ChoiceEntry'] @@ -152,6 +153,54 @@ def _set_enabled(self, value): self._value.props.sensitive = value + + +class StringPathEntry(BaseEntry): + + def __init__(self, widgets): + super().__init__(widgets) + + self._file_dialog = None + + self._combo = widgets['combo'] + self._entry = widgets['entry'] + + self._entry.connect('changed', self._emit_changed) + self._combo.connect('format-entry-text', self._on_combobox_format) + + self._combo.set_row_separator_func(self._row_separator_callback, None) + + def _get_value(self): + return self._entry.props.text + + def _set_value(self, value): + self._entry.props.text = value or '' + + def _set_enabled(self, value): + self._combo.props.sensitive = value + + def _row_separator_callback(self, model, rowiter, data): + return model[rowiter][0] == '-' + + def _on_combobox_format(self, combobox, path): + value = '' + item_id = combobox.get_active_id() + if item_id == 'select-path': + if not self._file_dialog: + self._file_dialog = Gtk.FileChooserDialog( + parent=self._combo.get_toplevel(), + buttons=(_('_OK'), Gtk.ResponseType.OK, + _('_Cancel'), Gtk.ResponseType.CANCEL), + title=C_('option|StringPathEntry', 'Select path')) + if self._file_dialog.run() == Gtk.ResponseType.OK: + value = self._file_dialog.get_filename() + else: + value = combobox.get_active_text() + self._file_dialog.hide() + elif item_id == 'value': + value = combobox.props.model[path][0] + combobox.set_active(-1) + return value class AdjustmentEntry(BaseEntry):