def __init__(self, as_list: list[SorterAndFilterer]) -> None:
self._list = as_list
+ self.filter_inputs: FilterInputs = {}
def __eq__(self, other) -> bool:
return self._list == other._list
entry.remove_css_class('temp')
text: str = entry.get_buffer().get_text()
if '' != text.rstrip():
- self.filter_inputs[sorter.name] = text
- elif sorter.name in self.filter_inputs:
- del self.filter_inputs[sorter.name]
+ self.order.filter_inputs[sorter.name] = text
+ elif sorter.name in self.order.filter_inputs:
+ del self.order.filter_inputs[sorter.name]
self._filter_inputs_changed = True
sorter: SorterAndFilterer = list_item.props.item
sorter.setup_on_bind(list_item.props.child, on_filter_activate,
- self.filter_inputs.get(sorter.name, ''),
+ self.order.filter_inputs.get(sorter.name, ''),
self._gallery_items_attrs[sorter.name])
def select_sort_order(_a, _b, _c) -> None:
self.order.sync_from(self._tmp_order)
self._tmp_order = None
self._gallery_request_update(build_grid=True)
+ if self._filter_inputs_changed:
+ self._gallery_request_update(build_grid=True)
self._gallery_update_settings(
per_row=self._btn_per_row.get_value_as_int(),
by_1st=self._btn_by_1st.get_active(),
show_dirs=self._btn_show_dirs.get_active(),
- filter_inputs=self.filter_inputs.copy(),
recurse_dirs=self._btn_recurse.get_active())
self._gallery_request_update(select=True)
self._set_recurse_changed = False
self._gallery_request_update(load=True)
self._btn_apply.set_sensitive(True)
- self.filter_inputs: FilterInputs = {}
self._filter_inputs_changed = False
self._set_recurse_changed = False
self._last_selected: Optional[Gtk.Widget] = None
self._on_selection_change = on_selection_change
self._bookmarks_db, self._cache_db = bookmarks_db, cache_db
self._sort_order = sort_order
- self._filter_inputs: FilterInputs = {}
self._img_dir_path = ''
self._shall_load = False
show_dirs: Optional[bool] = None,
recurse_dirs: Optional[bool] = None,
img_dir_path: Optional[str] = None,
- filter_inputs: Optional[FilterInputs] = None
) -> None:
"""Set Gallery setup fields, request appropriate updates."""
for val, attr_name in [(per_row, '_per_row'),
(by_1st, '_by_1st'),
(show_dirs, '_show_dirs'),
(recurse_dirs, '_recurse_dirs'),
- (img_dir_path, '_img_dir_path'),
- (filter_inputs, '_filter_inputs')]:
+ (img_dir_path, '_img_dir_path')]:
if val is not None and getattr(self, attr_name) != val:
setattr(self, attr_name, val)
if attr_name in {'_recurse_dirs', '_img_dir_path'}:
return False
return True
- if attr_name not in self._filter_inputs:
+ if attr_name not in self._sort_order.filter_inputs:
return True
if val is None:
return False
- pattern = self._filter_inputs[attr_name]
+ pattern = self._sort_order.filter_inputs[attr_name]
if attr_name in number_attributes:
if not passes_number_filter(attr_name, pattern, val):
return False
# only now we're ready for actually running the gallery
GLib.idle_add(lambda: self.gallery.update_settings(
- img_dir_path=self.app.img_dir_absolute,
- filter_inputs=self.conf.filter_inputs.copy()))
+ img_dir_path=self.app.img_dir_absolute))
def on_focus_change(self) -> None:
"""Handle reactions on focus changes in .gallery and .conf."""