Improved bar search dropdown.

This commit is contained in:
itdominator 2021-12-12 00:27:48 -06:00
parent dd9d9572e8
commit ae60d51481
1 changed files with 11 additions and 10 deletions

View File

@ -153,7 +153,6 @@ class TabMixin(WidgetMixin):
dir = f"{view.get_current_directory()}/"
path = widget.get_text()
self.path_menu.popdown()
if isinstance(focused_obj, Gtk.Entry):
button_box = self.path_menu.get_children()[0].get_children()[0].get_children()[0]
query = widget.get_text().replace(dir, "")
@ -162,20 +161,22 @@ class TabMixin(WidgetMixin):
self.clear_children(button_box)
show_path_menu = False
for file in files:
if query.lower() in file.lower() and os.path.isdir(f"{dir}{file}"):
show_path_menu = True
if os.path.isdir(f"{dir}{file}"):
if query.lower() in file.lower():
button = Gtk.Button(label=file)
button.show()
button.connect("clicked", self.set_path_entry)
button_box.add(button)
show_path_menu = True
if show_path_menu:
if not show_path_menu:
self.path_menu.popdown()
else:
self.path_menu.popup()
widget.grab_focus_without_selecting()
widget.set_position(-1)
if path == dir:
if path.endswith(".") or path == dir:
return
traversed = view.set_path(path)