[PATCH 4/4] Pressing Delete on custom part should remove the selected mountpoint.

Chris Lumens clumens at redhat.com
Mon May 13 19:22:22 UTC 2013


---
 pyanaconda/ui/gui/spokes/custom.glade |  2 ++
 pyanaconda/ui/gui/spokes/custom.py    | 12 +++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade
index bc92834..8bf1a74 100644
--- a/pyanaconda/ui/gui/spokes/custom.glade
+++ b/pyanaconda/ui/gui/spokes/custom.glade
@@ -710,9 +710,11 @@ use.  Try something else?</property>
   <object class="AnacondaSpokeWindow" id="customStorageWindow">
     <property name="startup_id">filler</property>
     <property name="can_focus">False</property>
+    <property name="events">GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
     <property name="startup_id">filler</property>
     <property name="window_name" translatable="yes">MANUAL PARTITIONING</property>
     <signal name="info-bar-clicked" handler="on_info_bar_clicked" swapped="no"/>
+    <signal name="key-release-event" handler="on_key_pressed" swapped="no"/>
     <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index a8ac173..ef0ca54 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -75,7 +75,8 @@ from pyanaconda.ui.gui.spokes.lib.summary import ActionSummaryDialog
 from pyanaconda.ui.gui.utils import setViewportBackground, gtk_action_wait, enlightbox, fancy_set_sensitive
 from pyanaconda.ui.gui.categories.storage import StorageCategory
 
-from gi.repository import Gtk
+# pylint: disable-msg=E0611
+from gi.repository import Gdk, Gtk
 
 import logging
 log = logging.getLogger("anaconda")
@@ -1809,6 +1810,15 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
     ### SIGNAL HANDLERS
     ###
 
+    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:
+            self._removeButton.emit("clicked")
+
     def on_back_clicked(self, button):
         # First, save anything from the currently displayed mountpoint.
         self._save_right_side(self._current_selector)
-- 
1.8.1.2



More information about the anaconda-patches mailing list