[PATCH] Allow a couple more keyboard shortcuts on the custom part spoke.

Vratislav Podzimek vpodzime at redhat.com
Fri May 30 06:47:33 UTC 2014


On Thu, 2014-05-29 at 16:31 -0400, Chris Lumens wrote:
> (1) '-' should do the same thing as delete.
> (2) '+' should bring up the add dialog.
> ---
>  pyanaconda/ui/gui/spokes/custom.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> index 328cf61..d04eda9 100644
> --- a/pyanaconda/ui/gui/spokes/custom.py
> +++ b/pyanaconda/ui/gui/spokes/custom.py
> @@ -1422,17 +1422,20 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
>      ###
>  
>      def on_key_pressed(self, window, event, *args):
> -        # Handle any keyboard events.  Right now this is just delete for
> -        # removing an existing mountpoint, but it could include more later.
>          if not event or event and event.type != Gdk.EventType.KEY_RELEASE:
>              return
>  
> -        if event.keyval == Gdk.KEY_Delete:
> +        if event.keyval in [Gdk.KEY_Delete, Gdk.KEY_minus]:
>              # But we only want delete to work if you have focused a MountpointSelector,
>              # and not just any random widget.  For those, it's likely the user wants
>              # to delete a character.
>              if isinstance(window.get_focus(), MountpointSelector):
>                  self._removeButton.emit("clicked")
> +        elif event.keyval == Gdk.KEY_plus:
> +            # And we only want '+' to work if you don't have a text entry focused, since
> +            # the user might be entering some free-form text that can include a plus.
> +            if not isinstance(window.get_focus(), Gtk.Entry):
> +                self._addButton.emit("clicked")
>  
>      def _do_check(self):
>          self.clear_errors()
Neat, ACK!

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list