Fixed search issues

This commit is contained in:
itdominator 2021-12-10 19:06:07 -06:00
parent 49ebfc6293
commit f67f42b14b
2 changed files with 20 additions and 11 deletions

View File

@ -40,18 +40,19 @@ class KeyboardSignalsMixin:
self.altDown = False self.altDown = False
if self.ctrlDown and self.shiftDown and keyname == "t":
self.trash_files()
if re.fullmatch(valid_fname_pat, keyname): if re.fullmatch(valid_fname_pat, keyname):
if not self.ctrlDown and not self.shiftDown and not self.altDown: if not self.ctrlDown and not self.shiftDown and not self.altDown:
if not self.is_searching: focused_obj = self.window.get_focus()
if not self.is_searching and isinstance(focused_obj, Gtk.IconView):
self.is_searching = True self.is_searching = True
wid, tid, self.search_view, self.search_iconview, store = self.get_current_state() wid, tid, self.search_view, self.search_iconview, store = self.get_current_state()
self.popup_search_files(wid, keyname) self.popup_search_files(wid, keyname)
return return
if self.ctrlDown and self.shiftDown and keyname == "t":
self.trash_files()
if self.ctrlDown and keyname == "q": if self.ctrlDown and keyname == "q":
self.tear_down() self.tear_down()
if (self.ctrlDown and keyname == "slash") or keyname == "home": if (self.ctrlDown and keyname == "slash") or keyname == "home":

View File

@ -38,14 +38,22 @@ class WidgetMixin:
@threaded @threaded
def create_icon(self, i, view, store, dir, file): def create_icon(self, i, view, store, dir, file):
icon = view.create_icon(dir, file) icon = view.create_icon(dir, file)
fpath = dir + "/" + file fpath = f"{dir}/{file}"
GLib.idle_add(self.update_store, (i, store, icon, view, fpath,)) GLib.idle_add(self.update_store, (i, store, icon, view, fpath,))
# NOTE: Might need to keep an eye on this throwing invalid iters when too # NOTE: Might need to keep an eye on this throwing invalid iters when too
# many updates are happening to a folder. Example: /tmp # many updates are happening to a folder. Example: /tmp
def update_store(self, item): def update_store(self, item):
i, store, icon, view, fpath = item i, store, icon, view, fpath = item
itr = None
try:
itr = store.get_iter(i) itr = store.get_iter(i)
except Exception as e:
print(":Invalid Itr detected: (Potential race condition...)")
print(f"Index Requested: {i}")
print(f"Store Size: {len(store)}")
return
if not icon: if not icon:
icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0]) icon = self.get_system_thumbnail(fpath, view.SYS_ICON_WH[0])