Codebase list lightdm-gtk-greeter-settings / 59fb8a6
New option: "a11y-states" Andrew P. 9 years ago
4 changed file(s) with 127 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
13941394 </object>
13951395 <packing>
13961396 <property name="left_attach">0</property>
1397 <property name="top_attach">1</property>
1398 </packing>
1399 </child>
1400 <child>
1401 <object class="GtkLabel" id="label6">
1402 <property name="visible">True</property>
1403 <property name="can_focus">False</property>
1404 <property name="halign">start</property>
1405 <property name="label" translatable="yes">&lt;i&gt;You can choose accessibility features &lt;a href=""&gt;enabled at start&lt;/a&gt;&lt;/i&gt;</property>
1406 <property name="use_markup">True</property>
1407 </object>
1408 <packing>
1409 <property name="left_attach">0</property>
14101397 <property name="top_attach">2</property>
1411 <property name="width">2</property>
14121398 </packing>
14131399 </child>
14141400 <child>
14311417 </object>
14321418 <packing>
14331419 <property name="left_attach">1</property>
1434 <property name="top_attach">1</property>
1420 <property name="top_attach">2</property>
14351421 </packing>
14361422 </child>
14371423 <child>
14561442 <property name="left_attach">1</property>
14571443 <property name="top_attach">0</property>
14581444 </packing>
1445 </child>
1446 <child>
1447 <object class="GtkComboBoxText" id="greeter_a11y-states_keyboard">
1448 <property name="visible">True</property>
1449 <property name="can_focus">False</property>
1450 <property name="halign">start</property>
1451 <items>
1452 <item id="-" translatable="yes" context="option|greeter|a11y-states">Disabled at start</item>
1453 <item id="+" translatable="yes" context="option|greeter|a11y-states">Enabled at start</item>
1454 <item id="~" translatable="yes" context="option|greeter|a11y-states">Save state between launches</item>
1455 </items>
1456 </object>
1457 <packing>
1458 <property name="left_attach">1</property>
1459 <property name="top_attach">1</property>
1460 </packing>
1461 </child>
1462 <child>
1463 <object class="GtkLabel" id="greeter_a11y-theme">
1464 <property name="visible">True</property>
1465 <property name="can_focus">False</property>
1466 <property name="halign">start</property>
1467 <property name="label" translatable="yes" context="option|greeter|a11y-theme">Contrast theme</property>
1468 </object>
1469 <packing>
1470 <property name="left_attach">0</property>
1471 <property name="top_attach">4</property>
1472 </packing>
1473 </child>
1474 <child>
1475 <object class="GtkLabel" id="greeter_a11y-font_label">
1476 <property name="visible">True</property>
1477 <property name="can_focus">False</property>
1478 <property name="halign">start</property>
1479 <property name="label" translatable="yes" context="option|greeter|a11y-font">Large font</property>
1480 </object>
1481 <packing>
1482 <property name="left_attach">0</property>
1483 <property name="top_attach">5</property>
1484 </packing>
1485 </child>
1486 <child>
1487 <object class="GtkComboBoxText" id="greeter_a11y-states_reader">
1488 <property name="visible">True</property>
1489 <property name="can_focus">False</property>
1490 <property name="halign">start</property>
1491 <items>
1492 <item id="-" translatable="yes" context="option|greeter|a11y-states">Disabled at start</item>
1493 <item id="+" translatable="yes" context="option|greeter|a11y-states">Enabled at start</item>
1494 <item id="~" translatable="yes" context="option|greeter|a11y-states">Save state between launches</item>
1495 </items>
1496 </object>
1497 <packing>
1498 <property name="left_attach">1</property>
1499 <property name="top_attach">3</property>
1500 </packing>
1501 </child>
1502 <child>
1503 <object class="GtkComboBoxText" id="greeter_a11y-states_contrast">
1504 <property name="visible">True</property>
1505 <property name="can_focus">False</property>
1506 <property name="halign">start</property>
1507 <items>
1508 <item id="-" translatable="yes" context="option|greeter|a11y-states">Disabled at start</item>
1509 <item id="+" translatable="yes" context="option|greeter|a11y-states">Enabled at start</item>
1510 <item id="~" translatable="yes" context="option|greeter|a11y-states">Save state between launches</item>
1511 </items>
1512 </object>
1513 <packing>
1514 <property name="left_attach">1</property>
1515 <property name="top_attach">4</property>
1516 </packing>
1517 </child>
1518 <child>
1519 <object class="GtkComboBoxText" id="greeter_a11y-states_font">
1520 <property name="visible">True</property>
1521 <property name="can_focus">False</property>
1522 <property name="halign">start</property>
1523 <items>
1524 <item id="-" translatable="yes" context="option|greeter|a11y-states">Disabled at start</item>
1525 <item id="+" translatable="yes" context="option|greeter|a11y-states">Enabled at start</item>
1526 <item id="~" translatable="yes" context="option|greeter|a11y-states">Save state between launches</item>
1527 </items>
1528 </object>
1529 <packing>
1530 <property name="left_attach">1</property>
1531 <property name="top_attach">5</property>
1532 </packing>
1533 </child>
1534 <child>
1535 <placeholder/>
1536 </child>
1537 <child>
1538 <placeholder/>
14591539 </child>
14601540 </object>
14611541 <packing>
9595 # Misc
9696 'screensaver-timeout': (OptionEntry.AdjustmentEntry, 60),
9797 'keyboard': (OptionEntry.StringPathEntry, None),
98 'reader': (OptionEntry.StringPathEntry, None)
98 'reader': (OptionEntry.StringPathEntry, None),
99 'a11y-states': (OptionEntry.AccessibilityStatesEntry, None)
99100 }),
100101 MonitorsGroup(self._widgets)
101102 )
3232 __all__ = ['BaseEntry', 'BooleanEntry', 'InvertedBooleanEntry',
3333 'StringEntry', 'StringPathEntry', 'ClockFormatEntry',
3434 'BackgroundEntry', 'IconEntry', 'IndicatorsEntry',
35 'AdjustmentEntry', 'ChoiceEntry']
35 'AdjustmentEntry', 'ChoiceEntry', 'AccessibilityStatesEntry']
3636
3737
3838 class BuilderWrapper:
593593 self._move_selection(move_up=False)
594594
595595
596 class AccessibilityStatesEntry(BaseEntry):
597
598 OPTIONS = {'keyboard', 'reader', 'contrast', 'font'}
599
600 def __init__(self, widgets):
601 super().__init__(widgets)
602
603 self._states = {name: widgets[name] for name in self.OPTIONS}
604
605 for w in self._states.values():
606 w.connect('changed', self._emit_changed)
607
608 def _get_value(self):
609 states = {name: widget.props.active_id for (name, widget) in self._states.items()}
610 return ';'.join(state + name
611 for (name, state) in states.items() if state not in {None, '-'})
612
613 def _set_value(self, value):
614 if value:
615 states = dict((v[1:], v[0]) if v[0] in ('-', '+', '~') else (v, '-')
616 for v in value.split(';') if v)
617 else:
618 states = {}
619 for name in self.OPTIONS:
620 self._states[name].props.active_id = states.get(name, '-')
621
144144 self._screen_overlay.connect('screen-changed', self._on_gdk_screen_changed)
145145
146146 def _get_value(self):
147 return self._x.value + ' ' + self._y.value
147 x = self._x.value
148 y = self._y.value
149 return x + ' ' + y if x != y else x
148150
149151 def _set_value(self, value):
150152 if value: