[PATCH] Open help when F1 is pressed
Martin Kolman
mkolman at redhat.com
Thu Aug 14 15:33:21 UTC 2014
Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
pyanaconda/ui/gui/__init__.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 7188aa6..1e5fee2 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -286,6 +286,10 @@ class MainWindow(Gtk.Window):
# maxmizes/unmaximizes the window.
self.connect("window-state-event", self._on_window_state_event)
+ # Connect to the key press event so that we can open help for the
+ # current screen when the user presses F1
+ self.connect("key-release-event", self._on_key_released)
+
# Start the window as full screen
self.fullscreen()
@@ -331,6 +335,15 @@ class MainWindow(Gtk.Window):
return True
+ def _on_key_released(self, window, event):
+ """Show help for the current screen when the F1 key is pressed"""
+ if event.keyval != Gdk.KEY_F1:
+ return
+
+ # the help button has been clicked, start the yelp viewer with
+ # content for the current screen
+ ihelp.start_yelp(ihelp.get_help_path(window.current_action.helpFile))
+
@property
def current_action(self):
return self._current_action
--
1.9.3
More information about the anaconda-patches
mailing list