[anaconda][rhel7-branch/master][PATCH] Allow to search specialized and network devices after pressing Enter (#1058364)

Martin Kolman mkolman at redhat.com
Wed Sep 10 14:57:03 UTC 2014


Done by emitting the 'clicked' signal from the find button as that appears to be the easiest
way to get the information that a search should be done to the filtering machinery.

Resolves: rhbz#1058364
Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 pyanaconda/ui/gui/spokes/filter.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/pyanaconda/ui/gui/spokes/filter.py b/pyanaconda/ui/gui/spokes/filter.py
index cdd0e6d..4c87f12 100644
--- a/pyanaconda/ui/gui/spokes/filter.py
+++ b/pyanaconda/ui/gui/spokes/filter.py
@@ -157,6 +157,11 @@ class FilterPage(object):
 
         return disk.name
 
+    def _on_entry_activated(self, _entry, find_button):
+        # User pressed enter on a search related entry box, trigger search by emitting
+        # the "clicked" signal from the corresponding find button
+        find_button.emit("clicked")
+
 class SearchPage(FilterPage):
     def __init__(self, storage, builder):
         FilterPage.__init__(self, storage, builder)
@@ -171,6 +176,11 @@ class SearchPage(FilterPage):
 
         self._combo = self.builder.get_object("searchTypeCombo")
 
+        find_button = self.builder.get_object("searchFindButton")
+        self._lunEntry.connect("activate", self._on_entry_activated, find_button)
+        self._wwidEntry.connect("activate", self._on_entry_activated, find_button)
+        self._targetEntry.connect("activate", self._on_entry_activated, find_button)
+
     def setup(self, store, selectedNames, disks):
         self._combo.set_active(0)
         self._combo.emit("changed")
@@ -244,6 +254,9 @@ class MultipathPage(FilterPage):
 
         self._combo = self.builder.get_object("multipathTypeCombo")
 
+        find_button = self.builder.get_object("multipathFindButton")
+        self._wwidEntry.connect("activate", self._on_entry_activated, find_button)
+
     def ismember(self, device):
         return isinstance(device, MultipathDevice)
 
@@ -312,6 +325,9 @@ class OtherPage(FilterPage):
 
         self._combo = self.builder.get_object("otherTypeCombo")
 
+        find_button = self.builder.get_object("otherFindButton")
+        self._idEntry.connect("activate", self._on_entry_activated, find_button)
+
     def ismember(self, device):
         return isinstance(device, iScsiDiskDevice) or isinstance(device, FcoeDiskDevice)
 
@@ -413,6 +429,11 @@ class ZPage(FilterPage):
 
         self._isS390 = arch.isS390()
 
+        find_button = self.builder.get_object("zFindButton")
+        self._ccwEntry.connect("activate", self._on_entry_activated, find_button)
+        self._wwpnEntry.connect("activate", self._on_entry_activated, find_button)
+        self._lunEntry.connect("activate", self._on_entry_activated, find_button)
+
     def clear(self):
         self._lunEntry.set_text("")
         self._ccwEntry.set_text("")
-- 
1.9.3



More information about the anaconda-patches mailing list