oliver_g avatar oliver_g committed 26b885c

enable type-ahead search in displayed values

Comments (0)

Files changed (2)


         self.xml.get_widget("main_window").set_title("Hachoir - %s" % filename)
+        self.table.set_search_equal_func(resultSearchCb)
     def quit(self):
             if field.is_field_set:
                 self.fill_tree(field, newparent, treeStore)
+def resultSearchCb (model, column, key, it):
+    """Callback function for searching in treeview"""
+    plainText = model.get_value(it, column)
+    # if search text contains only lower-case characters, do case-insensitive matching:
+    if key.islower():
+        plainText = plainText.lower()
+    # if the line contains the search text, it matches:
+    if plainText.find(key) >= 0:
+        return False
+    # line doesn't match:
+    return True
+#import cProfile
+# import profile
 def main():
     if(len(sys.argv)!=2 ):
         print "usage: %s file" %sys.argv[0]


               <property name="headers_visible">True</property>
               <property name="rules_hint">False</property>
               <property name="reorderable">False</property>
-              <property name="enable_search">False</property>
+              <property name="enable_search">True</property>
               <property name="fixed_height_mode">False</property>
               <property name="hover_selection">False</property>
               <property name="hover_expand">False</property>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.