[RHEL 7.2/PATCH] Keyboard Scroll Fails in Viewports (rhbz#1189899)

Robert Marshall rmarshall at redhat.com
Tue Jun 2 20:39:32 UTC 2015


From: David Shea <dshea at redhat.com>

Robert Marshall's cherry pick of David Shea's original commit-id:

35324b3fd891400c0405c50a18798080910627ed

This patch corrects an issue where users tried to navigate through
the storage or software selections with a keyboard and the window
failed to scroll when the selection was not in the current viewport.

It does not include changes to filter.py and filter.glade per
consultation with David Shea.

Resolves: rhbz#1189899
---
 pyanaconda/ui/gui/spokes/custom.py     |  8 ++++++++
 pyanaconda/ui/gui/spokes/software.py   |  6 ++++++
 pyanaconda/ui/gui/spokes/source.glade  |  6 +++---
 pyanaconda/ui/gui/spokes/source.py     |  5 +++++
 pyanaconda/ui/gui/spokes/storage.glade |  6 +++---
 pyanaconda/ui/gui/spokes/storage.py    | 11 +++++++++++
 6 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 5319c7c..ec6c8ac 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -201,6 +201,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         self._partitionsViewport = self.builder.get_object("partitionsViewport")
         self._partitionsNotebook = self.builder.get_object("partitionsNotebook")
 
+        # Connect partitionsNotebook focus events to scrolling in the parent viewport
+        partitionsNotebookViewport = self.builder.get_object("partitionsNotebookViewport")
+        self._partitionsNotebook.set_focus_vadjustment(partitionsNotebookViewport.get_vadjustment())
+
         self._whenCreateLabel = self.builder.get_object("whenCreateLabel")
 
         self._availableSpaceLabel = self.builder.get_object("availableSpaceLabel")
@@ -265,6 +269,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         # this list will include things like PVs and RAID members.
         self._fsCombo.remove_all()
 
+        # Connect viewport scrolling with accordion focus events
+        self._accordion.set_focus_hadjustment(self._partitionsViewport.get_hadjustment())
+        self._accordion.set_focus_vadjustment(self._partitionsViewport.get_vadjustment())
+
         threadMgr.add(AnacondaThread(name=THREAD_CUSTOM_STORAGE_INIT, target=self._initialize))
 
     def _initialize(self):
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 97516e3..7c704c6 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -72,6 +72,12 @@ class SoftwareSelectionSpoke(NormalSpoke):
         self._environmentListBox = self.builder.get_object("environmentListBox")
         self._addonListBox = self.builder.get_object("addonListBox")
 
+        # Connect viewport scrolling with listbox focus events
+        environmentViewport = self.builder.get_object("environmentViewport")
+        addonViewport = self.builder.get_object("addonViewport")
+        self._environmentListBox.set_focus_vadjustment(environmentViewport.get_vadjustment())
+        self._addonListBox.set_focus_vadjustment(addonViewport.get_vadjustment())
+
         # Used to store how the user has interacted with add-ons for the default add-on
         # selection logic. The dictionary keys are group IDs, and the values are selection
         # state constants. See refreshAddons for how the values are used.
diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade
index a3969ea..bd7e154 100644
--- a/pyanaconda/ui/gui/spokes/source.glade
+++ b/pyanaconda/ui/gui/spokes/source.glade
@@ -508,18 +508,18 @@
                 <property name="vexpand">True</property>
                 <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                  <object class="GtkScrolledWindow" id="mainScrolledWindow">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hscrollbar_policy">never</property>
                     <child>
-                      <object class="GtkViewport" id="viewport1">
+                      <object class="GtkViewport" id="mainViewport">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="margin_right">24</property>
                         <property name="shadow_type">none</property>
                         <child>
-                          <object class="GtkBox" id="box4">
+                          <object class="GtkBox" id="mainBox">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="orientation">vertical</property>
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 67e968c..015a404 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -122,6 +122,11 @@ class ProxyDialog(GUIObject, GUIDialogInputCheckHandler):
         self._proxyValidate = self.add_check(self._proxyURLEntry, self._checkProxyURL)
         self._proxyValidate.update_check_status()
 
+        # Connect scroll events on the viewport with focus events on the box
+        mainViewport = self.builder.get_object("mainViewport")
+        mainBox = self.builder.get_object("mainBox")
+        mainBox.set_focus_vadjustment(mainViewport.get_vadjustment())
+
     def _checkProxyURL(self, inputcheck):
         proxy_string = self.get_input(inputcheck.input_obj)
 
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 6074750..4beddc2 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -484,18 +484,18 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                  <object class="GtkScrolledWindow" id="storageScrolledWindow">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="vexpand">True</property>
                     <property name="hscrollbar_policy">never</property>
                     <child>
-                      <object class="GtkViewport" id="viewport1">
+                      <object class="GtkViewport" id="storageViewport">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="shadow_type">none</property>
                         <child>
-                          <object class="GtkBox" id="box3">
+                          <object class="GtkBox" id="storageMainBox">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="orientation">vertical</property>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index bbd993c..e902cfe 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -513,6 +513,17 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         self.local_disks_box = self.builder.get_object("local_disks_box")
         self.specialized_disks_box = self.builder.get_object("specialized_disks_box")
 
+        # Connect the viewport adjustments to the child widgets
+        # See also https://bugzilla.gnome.org/show_bug.cgi?id=744721
+        localViewport = self.builder.get_object("localViewport")
+        specializedViewport = self.builder.get_object("specializedViewport")
+        self.local_disks_box.set_focus_hadjustment(localViewport.get_hadjustment())
+        self.specialized_disks_box.set_focus_hadjustment(specializedViewport.get_hadjustment())
+
+        mainViewport = self.builder.get_object("storageViewport")
+        mainBox = self.builder.get_object("storageMainBox")
+        mainBox.set_focus_vadjustment(mainViewport.get_vadjustment())
+
         threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE_WATCHER,
                       target=self._initialize))
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list