Improved bar search dropdown.
This commit is contained in:
parent
dd9d9572e8
commit
ae60d51481
|
@ -153,7 +153,6 @@ class TabMixin(WidgetMixin):
|
||||||
dir = f"{view.get_current_directory()}/"
|
dir = f"{view.get_current_directory()}/"
|
||||||
path = widget.get_text()
|
path = widget.get_text()
|
||||||
|
|
||||||
self.path_menu.popdown()
|
|
||||||
if isinstance(focused_obj, Gtk.Entry):
|
if isinstance(focused_obj, Gtk.Entry):
|
||||||
button_box = self.path_menu.get_children()[0].get_children()[0].get_children()[0]
|
button_box = self.path_menu.get_children()[0].get_children()[0].get_children()[0]
|
||||||
query = widget.get_text().replace(dir, "")
|
query = widget.get_text().replace(dir, "")
|
||||||
|
@ -162,20 +161,22 @@ class TabMixin(WidgetMixin):
|
||||||
self.clear_children(button_box)
|
self.clear_children(button_box)
|
||||||
show_path_menu = False
|
show_path_menu = False
|
||||||
for file in files:
|
for file in files:
|
||||||
if query.lower() in file.lower() and os.path.isdir(f"{dir}{file}"):
|
if os.path.isdir(f"{dir}{file}"):
|
||||||
show_path_menu = True
|
if query.lower() in file.lower():
|
||||||
button = Gtk.Button(label=file)
|
button = Gtk.Button(label=file)
|
||||||
button.show()
|
button.show()
|
||||||
button.connect("clicked", self.set_path_entry)
|
button.connect("clicked", self.set_path_entry)
|
||||||
button_box.add(button)
|
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()
|
self.path_menu.popup()
|
||||||
widget.grab_focus_without_selecting()
|
widget.grab_focus_without_selecting()
|
||||||
widget.set_position(-1)
|
widget.set_position(-1)
|
||||||
|
|
||||||
|
if path.endswith(".") or path == dir:
|
||||||
if path == dir:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
traversed = view.set_path(path)
|
traversed = view.set_path(path)
|
||||||
|
|
Loading…
Reference in New Issue