FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 02-03-2010, 06:36 PM
Chris Lumens
 
Default Fix a variety of filtering UI problems caused by switching models around.

(1) The filtered model is no longer the top-level so anywhere we want to call
refilter, we need to dig down and get the child, which happens to be the
filtered model.

(2) Similarly, we can only call get_text on the child of a ComboBoxEntry because
that's the entry part.

(3) Populate all search drop-downs when the containing hbox is realized, not
some complicated setup where each individual item is selected.
---
iw/filter_gui.py | 42 +++++++++++++++++++++++++++++-------------
1 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/iw/filter_gui.py b/iw/filter_gui.py
index 3dda8f6..c259802 100644
--- a/iw/filter_gui.py
+++ b/iw/filter_gui.py
@@ -183,10 +183,12 @@ class MPathCallbacks(FilteredCallbacks):
self.interconnectEntry = self.xml.get_widget("mpathInterconnectEntry")
self.IDEntry = self.xml.get_widget("mpathIDEntry")

- self.vendorEntry.connect("changed", lambda entry: self.model.refilter())
- self.vendorEntry.connect("realize", self._populateUI)
- self.interconnectEntry.connect("changed", lambda entry: self.model.refilter())
- self.IDEntry.connect("changed", lambda entry: self.model.refilter())
+ self.mpathFilterHBox = self.xml.get_widget("mpathFilterHBox")
+ self.mpathFilterHBox.connect("realize", self._populateUI)
+
+ self.vendorEntry.connect("changed", lambda entry: self.model.get_model().refilter())
+ self.interconnectEntry.connect("changed", lambda entry: self.model.get_model().refilter())
+ self.IDEntry.connect("changed", lambda entry: self.model.get_model().refilter())

def addToUI(self, tuple):
if not tuple[VENDOR_COL] in self._vendors:
@@ -213,18 +215,30 @@ class MPathCallbacks(FilteredCallbacks):
return True

def _populateUI(self, widget):
+ cell = gtk.CellRendererText()
+
self._vendors.sort()
self.vendorEntry.set_model(gtk.ListStore(gobject.T YPE_STRING))
+ self.vendorEntry.pack_start(cell)
+ self.vendorEntry.add_attribute(cell, 'text', 0)
+
for v in self._vendors:
self.vendorEntry.append_text(v)

+ self.vendorEntry.show_all()
+
self._interconnects.sort()
self.interconnectEntry.set_model(gtk.ListStore(gob ject.TYPE_STRING))
+ self.interconnectEntry.pack_start(cell)
+ self.interconnectEntry.add_attribute(cell, 'text', 0)
+
for i in self._interconnects:
self.interconnectEntry.append_text(i)

+ self.interconnectEntry.show_all()
+
def _visible_by_vendor(self, model, iter, view):
- entered = self.vendorEntry.get_text()
+ entered = self.vendorEntry.get_child().get_text()
return model.get_value(iter, VENDOR_COL).find(entered) != -1

def _visible_by_interconnect(self, model, iter, view):
@@ -251,10 +265,12 @@ class OtherCallbacks(MPathCallbacks):
self.interconnectEntry = self.xml.get_widget("otherInterconnectEntry")
self.IDEntry = self.xml.get_widget("otherIDEntry")

- self.vendorEntry.connect("changed", lambda entry: self.model.refilter())
- self.vendorEntry.connect("realize", self._populateUI)
- self.interconnectEntry.connect("changed", lambda entry: self.model.refilter())
- self.IDEntry.connect("changed", lambda entry: self.model.refilter())
+ self.otherFilterHBox = self.xml.get_widget("otherFilterHBox")
+ self.otherFilterHBox.connect("realize", self._populateUI)
+
+ self.vendorEntry.connect("changed", lambda entry: self.model.get_model().refilter())
+ self.interconnectEntry.connect("changed", lambda entry: self.model.get_model().refilter())
+ self.IDEntry.connect("changed", lambda entry: self.model.get_model().refilter())

def isMember(self, info):
return info and isOther(info)
@@ -277,10 +293,10 @@ class SearchCallbacks(FilteredCallbacks):

# When these entries are changed, we need to redo the filtering.
# If we don't do filter-as-you-type, we'd need a Search/Clear button.
- self.portEntry.connect("changed", lambda entry: self.model.refilter())
- self.targetEntry.connect("changed", lambda entry: self.model.refilter())
- self.LUNEntry.connect("changed", lambda entry: self.model.refilter())
- self.IDEntry.connect("changed", lambda entry: self.model.refilter())
+ self.portEntry.connect("changed", lambda entry: self.model.get_model().refilter())
+ self.targetEntry.connect("changed", lambda entry: self.model.get_model().refilter())
+ self.LUNEntry.connect("changed", lambda entry: self.model.get_model().refilter())
+ self.IDEntry.connect("changed", lambda entry: self.model.get_model().refilter())

def isMember(self, info):
return True
--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 06:13 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org