diff options
author | B Stack <bgstack15@gmail.com> | 2020-03-16 08:23:20 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-03-16 08:23:20 -0400 |
commit | c2f71564c61ef6deaed356d37741d5733d5ffae5 (patch) | |
tree | c734d52cc08f5f1911ddd2838547de81128ab66b | |
parent | Background (diff) | |
download | mime_types_editor-c2f71564c61ef6deaed356d37741d5733d5ffae5.tar.gz mime_types_editor-c2f71564c61ef6deaed356d37741d5733d5ffae5.tar.bz2 mime_types_editor-c2f71564c61ef6deaed356d37741d5733d5ffae5.zip |
WIP: add search widget
but it is not connected to the listview yet
-rw-r--r-- | src/cat_mode/mime_editor_cat_mode.py | 7 | ||||
-rw-r--r-- | src/cat_mode/ui_cat_mode.glade | 33 | ||||
-rw-r--r-- | src/common/mime_view.py | 5 |
3 files changed, 39 insertions, 6 deletions
diff --git a/src/cat_mode/mime_editor_cat_mode.py b/src/cat_mode/mime_editor_cat_mode.py index fcd1ed8..7b216d7 100644 --- a/src/cat_mode/mime_editor_cat_mode.py +++ b/src/cat_mode/mime_editor_cat_mode.py @@ -51,6 +51,8 @@ class CategoriesView(gtk_common.CategoriesWidget): #register callback tree_selection = self.categories_view.get_selection() tree_selection.connect("changed", self.on_selection_changes) + self.searchbox = builder.get_object("searchbox") + self.searchbox.connect("search-changed", self.on_searchbox_changed) def _fill_list_store(self): categories = sorted((_(name), cat ,id_) @@ -77,6 +79,10 @@ class CategoriesView(gtk_common.CategoriesWidget): self.on_category_changed(cat_ids) + def on_searchbox_changed(self, search_widget): + print("INSIDE on_searchbox_changed, value ", '"' + search_widget.get_text() + '"' ) + print(self) + #self.mime_view.filter_category(category_id[0]) class AddAppDialog: def __init__(self, builder, parent_window, on_add_dialog_apply): @@ -118,6 +124,7 @@ class AddAppDialog: return False #!!! def on_custom_entry_changed(self, *args): + print("INSIDE on_custom_entry_changed") text = self.custom_entry.get_text() if text != self.cline_text: self.cline_text = text diff --git a/src/cat_mode/ui_cat_mode.glade b/src/cat_mode/ui_cat_mode.glade index 10d1bf9..67c537d 100644 --- a/src/cat_mode/ui_cat_mode.glade +++ b/src/cat_mode/ui_cat_mode.glade @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.2 --> <interface> <requires lib="gtk+" version="3.12"/> <object class="GtkDialog" id="add_app_dialog"> @@ -8,6 +8,9 @@ <property name="modal">True</property> <property name="destroy_with_parent">True</property> <property name="type_hint">normal</property> + <child type="titlebar"> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="add_app_dialog_vbox"> <property name="can_focus">False</property> @@ -181,6 +184,9 @@ <property name="default_height">400</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> + <child type="titlebar"> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="mimetype_set_dialog_box"> <property name="can_focus">False</property> @@ -330,7 +336,18 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <placeholder/> + <object class="GtkSearchEntry" id="searchbox"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="primary_icon_name">edit-find-symbolic</property> + <property name="primary_icon_activatable">False</property> + <property name="primary_icon_sensitive">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkBox" id="view_box"> @@ -363,6 +380,9 @@ </packing> </child> <child> + <placeholder/> + </child> + <child> <object class="GtkScrolledWindow" id="mimetypes_view_scrolledwindow"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -374,6 +394,7 @@ <property name="can_focus">True</property> <property name="is_focus">True</property> <property name="vadjustment">mimetypes_view_adj</property> + <property name="search_column">1</property> <property name="hover_selection">True</property> <property name="rubber_banding">True</property> <property name="enable_grid_lines">horizontal</property> @@ -389,7 +410,7 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </object> @@ -409,8 +430,8 @@ <property name="label" translatable="yes">Show only associated types</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">False</property> <property name="focus_on_click">False</property> + <property name="receives_default">False</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> @@ -431,9 +452,9 @@ <property name="label">gtk-edit</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="focus_on_click">False</property> <property name="receives_default">True</property> <property name="use_stock">True</property> - <property name="focus_on_click">False</property> </object> <packing> <property name="expand">False</property> @@ -447,9 +468,9 @@ <property name="label">gtk-revert-to-saved</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="focus_on_click">False</property> <property name="receives_default">True</property> <property name="use_stock">True</property> - <property name="focus_on_click">False</property> </object> <packing> <property name="expand">False</property> diff --git a/src/common/mime_view.py b/src/common/mime_view.py index 6a1eb7c..6470ebd 100644 --- a/src/common/mime_view.py +++ b/src/common/mime_view.py @@ -60,6 +60,7 @@ class MimeView: def _init_filters(self): self.ordered_data_filters = [] #order may be matter self.data_filters = {} # save reference by name + self.search_filters = {} #add category filter category_filter = data_filter.CategoryFilter(self.MIME_CATEGORY, @@ -71,6 +72,10 @@ class MimeView: self.ordered_data_filters.append(data_filter) self.data_filters[filter_name] = data_filter + def _set_search_filter(self, filter_name, data_filter): + self.data_filters[filter_name].set_params(**kwargs) + self.filter_model.refilter() + def _init_model(self): """liststore -> filter -> sort -> view""" self.list_store = Gtk.ListStore(*self.LIST_STORE_COLUMN_TYPES) |