diff options
author | Mike Fulbright <msf@redhat.com> | 2002-06-19 19:00:41 +0000 |
---|---|---|
committer | Mike Fulbright <msf@redhat.com> | 2002-06-19 19:00:41 +0000 |
commit | 16b28a7722e7ae1062bd47e4155d265a9a240eab (patch) | |
tree | 686ce3a635638c5cb6c57a88cb0fb2c21b75c8e6 /iw/package_gui.py | |
parent | cb04909cab57046cd917584e541c5f0896512eba (diff) | |
download | anaconda-16b28a7722e7ae1062bd47e4155d265a9a240eab.tar.gz anaconda-16b28a7722e7ae1062bd47e4155d265a9a240eab.tar.xz anaconda-16b28a7722e7ae1062bd47e4155d265a9a240eab.zip |
make spacebar toggle current selection, bug #66451
Diffstat (limited to 'iw/package_gui.py')
-rw-r--r-- | iw/package_gui.py | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/iw/package_gui.py b/iw/package_gui.py index b0ba91d98..67aa41594 100644 --- a/iw/package_gui.py +++ b/iw/package_gui.py @@ -163,6 +163,10 @@ class IndividualPackageSelectionWindow (InstallWindow): self.updateSize() + # if they hit space bar stop that event from happening + self.ignoreKeypress = (package, val) + + def select_package(self, selection): (model, iter) = selection.get_selected() if iter: @@ -271,7 +275,38 @@ class IndividualPackageSelectionWindow (InstallWindow): self.sort_id = widget.get_sort_column_id() self.sort_order = widget.get_sort_order() - + def keypressCB(self, widget, val): + if val.keyval == gtk.keysyms.space: + selection = self.packageList.get_selection() + (model, iter) = selection.get_selected() + if iter: + self.select_package(selection) + package = self.packageList.store.get_value(iter, 1) + val = self.packageList.store.get_value(iter, 0) + + # see if we just got this because of focus being on + # checkbox toggle and they hit space bar + if self.ignoreKeypress: + if (package, val) == self.ignoreKeypress: + self.ignoreKeypress = None + return gtk.TRUE + else: + # didnt match for some reason, lets plow ahead + self.ignoreKeypress = None + + self.packageList.store.set_value(iter, 0, not val) + + if not val: + self.pkgs[package].select() + else: + self.pkgs[package].unselect() + + self.updateSize() + return gtk.TRUE + + return gtk.FALSE + + # IndividualPackageSelectionWindow tag="sel-indiv" def getScreen (self, comps, hdList): self.comps = comps @@ -356,6 +391,9 @@ class IndividualPackageSelectionWindow (InstallWindow): selection = self.packageList.get_selection() selection.connect("changed", self.select_package) + self.packageList.connect("key-release-event", self.keypressCB) + self.ignoreKeypress = None + self.packageListSW = gtk.ScrolledWindow () self.packageListSW.set_border_width (5) self.packageListSW.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) |