[master 2/2] Improve focus behavior in the advanced user dialog
dashea
installerbot-noreply at redhat.com
Fri Jun 19 15:25:32 UTC 2015
From: David Shea <dshea at redhat.com>
When the UID or GID checkboxes are toggled via a keyboard accellerator,
automatically focus the UID or GID input.
---
pyanaconda/ui/gui/spokes/advanced_user.glade | 2 ++
pyanaconda/ui/gui/spokes/user.py | 22 +++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/advanced_user.glade b/pyanaconda/ui/gui/spokes/advanced_user.glade
index f4d62cc..93470aa 100644
--- a/pyanaconda/ui/gui/spokes/advanced_user.glade
+++ b/pyanaconda/ui/gui/spokes/advanced_user.glade
@@ -161,6 +161,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
+ <signal name="mnemonic-activate" handler="on_uid_mnemonic_activate" swapped="no"/>
<signal name="toggled" handler="_apply_checkboxes" swapped="no"/>
</object>
<packing>
@@ -177,6 +178,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
+ <signal name="mnemonic-activate" handler="on_gid_mnemonic_activate" swapped="no"/>
<signal name="toggled" handler="_apply_checkboxes" swapped="no"/>
</object>
<packing>
diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index 7a41966..bd88b78 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -200,6 +200,27 @@ def run(self):
self.window.hide()
return rc
+ def on_uid_mnemonic_activate(self, widget, group_cycling, user_data=None):
+ # If this is the only widget with the mnemonic (group_cycling is False),
+ # and the checkbox is not currently toggled, toggle the checkbox and
+ # then set the focus to the UID spinner
+ if not group_cycling and not widget.get_active():
+ widget.set_active(True)
+ self._spinUid.grab_focus()
+ return True
+
+ # Otherwise just use the default signal handler
+ return False
+
+ def on_gid_mnemonic_activate(self, widget, group_cycling, user_data=None):
+ # Same as above, but for GID
+ if not group_cycling and not widget.get_active():
+ widget.set_active(True)
+ self._spinGid.grab_focus()
+ return True
+
+ return False
+
class UserSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler):
builderObjects = ["userCreationWindow"]
@@ -642,4 +663,3 @@ def on_back_clicked(self, button):
if GUISpokeInputCheckHandler.on_back_clicked(self, button):
NormalSpoke.on_back_clicked(self, button)
-
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/407529ab9a902389f2e175371e5e81858c294c53
More information about the anaconda-patches
mailing list