Launcher: Add search box (#4863)

* Add fuzzy search box to Launcher.

* move func bind to the kv and prefer substring matching (#79)

* move the func bind to the kv

* prefer substr matching

* Remove fuzzy results, rely on substring only.

* Use early return instead of else.

* Add type hint to filter_clients_by_type.

* Activate search on keyboard input.

* Clear search box when filtering by type.

* Update Launcher.py

Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>

---------

Co-authored-by: Aaron Wagener <mmmcheese158@gmail.com>
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
This commit is contained in:
massimilianodelliubaldini
2025-04-19 17:27:03 -04:00
committed by GitHub
parent efe2b7c539
commit f857933748
2 changed files with 53 additions and 10 deletions

View File

@@ -80,7 +80,7 @@ MDFloatLayout:
id: all
style: "text"
type: (Type.CLIENT, Type.TOOL, Type.ADJUSTER, Type.MISC)
on_release: app.filter_clients(self)
on_release: app.filter_clients_by_type(self)
MDButtonIcon:
icon: "asterisk"
@@ -90,7 +90,7 @@ MDFloatLayout:
id: client
style: "text"
type: (Type.CLIENT, )
on_release: app.filter_clients(self)
on_release: app.filter_clients_by_type(self)
MDButtonIcon:
icon: "controller"
@@ -100,7 +100,7 @@ MDFloatLayout:
id: Tool
style: "text"
type: (Type.TOOL, )
on_release: app.filter_clients(self)
on_release: app.filter_clients_by_type(self)
MDButtonIcon:
icon: "desktop-classic"
@@ -110,7 +110,7 @@ MDFloatLayout:
id: adjuster
style: "text"
type: (Type.ADJUSTER, )
on_release: app.filter_clients(self)
on_release: app.filter_clients_by_type(self)
MDButtonIcon:
icon: "wrench"
@@ -120,7 +120,7 @@ MDFloatLayout:
id: misc
style: "text"
type: (Type.MISC, )
on_release: app.filter_clients(self)
on_release: app.filter_clients_by_type(self)
MDButtonIcon:
icon: "dots-horizontal-circle-outline"
@@ -131,7 +131,7 @@ MDFloatLayout:
id: favorites
style: "text"
type: ("favorites", )
on_release: app.filter_clients(self)
on_release: app.filter_clients_by_type(self)
MDButtonIcon:
icon: "star"
@@ -141,5 +141,21 @@ MDFloatLayout:
MDNavigationDrawerDivider:
ScrollBox:
id: button_layout
MDGridLayout:
id: main_layout
cols: 1
spacing: "10dp"
MDTextField:
id: search_box
mode: "outlined"
set_text: app.filter_clients_by_name
MDTextFieldLeadingIcon:
icon: "magnify"
MDTextFieldHintText:
text: "Search"
ScrollBox:
id: button_layout