[PATCH] Open help when F1 is pressed

Martin Kolman mkolman at redhat.com
Fri Aug 15 16:27:36 UTC 2014



----- Original Message -----
> From: "David Shea" <dshea at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Thursday, August 14, 2014 10:21:09 PM
> Subject: Re: [PATCH] Open help when F1 is pressed
> 
> On 08/14/2014 11:33 AM, Martin Kolman wrote:
> > 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
> 
> current_action corresponds to GUI._currentAction, so it's the current
> active hub, not the current spoke. There is no property currently for
> the current active hub or spoke, so you may want to add one that gets
> set in _setVisibleChild.
OK

> You can also use the accelerator group that
> gets manipulated in _setVisibleChild to just connect F1 to the help
> button signal and not have to duplicate that signal handler code.
Yeah, thats indeed sounds like a nice solution! Also it has the added
benefit that unlike the previous solution Python code is not called
every time a key is pressed. :)

> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 


More information about the anaconda-patches mailing list