[PATCH] Fix focus grabbing on both the password and hostname screens.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since we have the Next button grab focus immediately before drawing then
screens, we'd been relying on a complicated system of GTK signals to do
the job but that only ever worked part of the time.  Instead, add a focus()
method to InstallWindow that screens can override and will set the focus
to the correct widget.
---
 gui.py            |    2 ++
 iw/account_gui.py |    9 ++-------
 iw/iw_gui.py      |    3 +++
 iw/network_gui.py |    5 +++--
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/gui.py b/gui.py
index 0a4ca3b..c83ff8c 100755
--- a/gui.py
+++ b/gui.py
@@ -1291,6 +1291,8 @@ class InstallControlWindow:
         self.installFrame.add(new_screen)
         self.installFrame.show_all()
 
+        self.currentWindow.focus()
+
         self.handle = gobject.idle_add(self.handleRenderCallback)
 
         if self.reloadRcQueued:
diff --git a/iw/account_gui.py b/iw/account_gui.py
index c18d6b6..4ff9c95 100644
--- a/iw/account_gui.py
+++ b/iw/account_gui.py
@@ -63,13 +63,8 @@ class AccountWindow (InstallWindow):
             self.pw.set_text(self.rootPassword['password'])
             self.confirm.set_text(self.rootPassword['password'])
 
-        # make sure pw has the focus when we enter the screen
-        vbox = self.xml.get_widget("account_box")
-        self.pw.connect("activate", lambda widget,
-                        vbox=vbox: vbox.emit("focus", gtk.DIR_TAB_FORWARD))
-        self.pw.connect("map-event", self.setFocus)
-
         # pressing Enter in confirm == clicking Next
+        vbox = self.xml.get_widget("account_box")
         self.confirm.connect("activate", lambda widget,
                              vbox=vbox: self.ics.setGrabNext(1))
 
@@ -78,7 +73,7 @@ class AccountWindow (InstallWindow):
 
         return self.align
 
-    def setFocus(self, area, data):
+    def focus(self):
         self.pw.grab_focus()
 
     def passwordError(self):
diff --git a/iw/iw_gui.py b/iw/iw_gui.py
index 6cdeaa9..997a239 100644
--- a/iw/iw_gui.py
+++ b/iw/iw_gui.py
@@ -48,3 +48,6 @@ class InstallWindow:
 
     def fixUp (self):
         pass
+
+    def focus(self):
+        pass
diff --git a/iw/network_gui.py b/iw/network_gui.py
index ce2c879..2ba1295 100644
--- a/iw/network_gui.py
+++ b/iw/network_gui.py
@@ -42,16 +42,17 @@ class NetworkWindow(InstallWindow):
         self.icon = self.xml.get_widget("icon")
         self.hostnameEntry = self.xml.get_widget("hostnameEntry")
         self.hostnameEntry.set_text(self.hostname)
+
+        # pressing Enter in confirm == clicking Next
         self.hostnameEntry.connect("activate",
                                    lambda w: self.ics.setGrabNext(1))
-        self.hostnameEntry.connect("map-event", self.setFocus)
 
         # load the icon
         gui.readImageFromFile("network.png", image=self.icon)
 
         return self.align
 
-    def setFocus(self, area, data):
+    def focus(self):
         self.hostnameEntry.grab_focus()
 
     def hostnameError(self):
-- 
1.6.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux