[PATCH] Open help when the F1 key is pressed

Martin Kolman mkolman at redhat.com
Fri Aug 15 16:49:50 UTC 2014


Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 pyanaconda/ui/gui/__init__.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 56bd0f8..d27a064 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -279,7 +279,7 @@ class MainWindow(Gtk.Window):
         self._stack = Gtk.Stack()
         self._stack_contents = set()
 
-        # Create an accel group for the F12 accelerators added after window transitions
+        # Create an accel group for the F1 and F12 accelerators added after window transitions
         self._accel_group = Gtk.AccelGroup()
         self.add_accel_group(self._accel_group)
 
@@ -337,10 +337,11 @@ class MainWindow(Gtk.Window):
         return self._current_action
 
     def _setVisibleChild(self, child):
-        # Remove the F12 accelerator from the old window
+        # Remove the F1 and F12 accelerators from the old window
         old_screen = self._stack.get_visible_child()
         if old_screen:
             old_screen.remove_accelerator(self._accel_group, Gdk.KEY_F12, 0)
+            old_screen.remove_accelerator(self._accel_group, Gdk.KEY_F1, 0)
 
         # Check if the widget is already on the stack
         if child not in self._stack_contents:
@@ -357,6 +358,10 @@ class MainWindow(Gtk.Window):
             child.window.add_accelerator("button-clicked", self._accel_group,
                     Gdk.KEY_F12, 0, 0)
 
+        # Pressing F1 shows help for the currently visible screen
+        child.window.add_accelerator("help-button-clicked", self._accel_group,
+                                     Gdk.KEY_F1, 0, 0)
+
         self._stack.set_visible_child(child.window)
 
         if child.focusWidgetName:
-- 
1.9.3



More information about the anaconda-patches mailing list