Fix preset selection and update Textual dependencies
- Avoid selecting a preset by default when opening the filter modal - Handle preset loading and deletion using string selections - Update Textual and Rich lockfile versions
This commit is contained in:
parent
6d4a4ccc19
commit
9f8e9c3415
2 changed files with 30 additions and 25 deletions
|
|
@ -180,15 +180,7 @@ class FilterModal(ModalScreen[Optional[FilterOptions]]):
|
|||
with Container(classes="filter-section"):
|
||||
with Horizontal(classes="preset-row"):
|
||||
yield Label("Preset:", classes="filter-input-label")
|
||||
yield Select(
|
||||
[
|
||||
(name, name)
|
||||
for name in self.entry_filter.get_preset_names()
|
||||
],
|
||||
value=self.current_options.preset_name or Select.BLANK,
|
||||
id="preset-select",
|
||||
classes="preset-select",
|
||||
)
|
||||
yield self._create_preset_select()
|
||||
yield Button("Load", id="load-preset", variant="primary")
|
||||
yield Button("Save", id="save-preset")
|
||||
yield Button("Delete", id="delete-preset", variant="error")
|
||||
|
|
@ -307,6 +299,22 @@ class FilterModal(ModalScreen[Optional[FilterOptions]]):
|
|||
yield Button("Reset", id="reset")
|
||||
yield Button("Cancel", id="cancel")
|
||||
|
||||
def _create_preset_select(self) -> Select:
|
||||
"""Create the preset picker without selecting a preset by default."""
|
||||
preset_options = [(name, name) for name in self.entry_filter.get_preset_names()]
|
||||
if self.current_options.preset_name:
|
||||
return Select(
|
||||
preset_options,
|
||||
value=self.current_options.preset_name,
|
||||
id="preset-select",
|
||||
classes="preset-select",
|
||||
)
|
||||
return Select(
|
||||
preset_options,
|
||||
id="preset-select",
|
||||
classes="preset-select",
|
||||
)
|
||||
|
||||
def on_mount(self) -> None:
|
||||
"""Initialize the modal with current options."""
|
||||
self._update_ui_from_options()
|
||||
|
|
@ -558,8 +566,8 @@ class FilterModal(ModalScreen[Optional[FilterOptions]]):
|
|||
def on_load_preset_pressed(self) -> None:
|
||||
"""Handle load preset button press."""
|
||||
preset_select = self.query_one("#preset-select", Select)
|
||||
if preset_select.value != Select.BLANK:
|
||||
preset_options = self.entry_filter.load_preset(str(preset_select.value))
|
||||
if isinstance(preset_select.value, str):
|
||||
preset_options = self.entry_filter.load_preset(preset_select.value)
|
||||
if preset_options:
|
||||
self.current_options = preset_options
|
||||
self._update_ui_from_options()
|
||||
|
|
@ -585,11 +593,10 @@ class FilterModal(ModalScreen[Optional[FilterOptions]]):
|
|||
def on_delete_preset_pressed(self) -> None:
|
||||
"""Handle delete preset button press."""
|
||||
preset_select = self.query_one("#preset-select", Select)
|
||||
if preset_select.value != Select.BLANK:
|
||||
preset_name = str(preset_select.value)
|
||||
if self.entry_filter.delete_preset(preset_name):
|
||||
if isinstance(preset_select.value, str):
|
||||
if self.entry_filter.delete_preset(preset_select.value):
|
||||
# Update preset select options
|
||||
preset_select.set_options(
|
||||
[(name, name) for name in self.entry_filter.get_preset_names()]
|
||||
)
|
||||
preset_select.value = Select.BLANK
|
||||
preset_select.clear()
|
||||
|
|
|
|||
18
uv.lock
generated
18
uv.lock
generated
|
|
@ -75,9 +75,6 @@ wheels = [
|
|||
linkify = [
|
||||
{ name = "linkify-it-py" },
|
||||
]
|
||||
plugins = [
|
||||
{ name = "mdit-py-plugins" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mdit-py-plugins"
|
||||
|
|
@ -166,15 +163,15 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "rich"
|
||||
version = "14.1.0"
|
||||
version = "15.0.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "markdown-it-py" },
|
||||
{ name = "pygments" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fe/75/af448d8e52bf1d8fa6a9d089ca6c07ff4453d86c65c145d0a300bb073b9b/rich-14.1.0.tar.gz", hash = "sha256:e497a48b844b0320d45007cdebfeaeed8db2a4f4bcf49f15e455cfc4af11eaa8", size = 224441, upload-time = "2025-07-25T07:32:58.125Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680, upload-time = "2026-04-12T08:24:00.75Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e3/30/3c4d035596d3cf444529e0b2953ad0466f6049528a879d27534700580395/rich-14.1.0-py3-none-any.whl", hash = "sha256:536f5f1785986d6dbdea3c75205c473f970777b4a0d6c6dd1b696aa05a3fa04f", size = 243368, upload-time = "2025-07-25T07:32:56.73Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -204,18 +201,19 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "textual"
|
||||
version = "5.0.1"
|
||||
version = "8.2.8"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "markdown-it-py", extra = ["linkify", "plugins"] },
|
||||
{ name = "markdown-it-py", extra = ["linkify"] },
|
||||
{ name = "mdit-py-plugins" },
|
||||
{ name = "platformdirs" },
|
||||
{ name = "pygments" },
|
||||
{ name = "rich" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ca/45/44120c661037e64b80518871a800a0bd18c13aab4b68711b774f3b9d58b1/textual-5.0.1.tar.gz", hash = "sha256:c6e20489ee585ec3fa43b011aa575f52e4fafad550e040bff9f53a464897feb6", size = 1611533, upload-time = "2025-07-25T19:50:59.72Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/00/21/39a76b01bd5eea82a04baaca7580e105d8c59450df03998345bb2cfb307b/textual-8.2.8.tar.gz", hash = "sha256:3f106a9fbc73e39dd266c9712432087de78a6d644084c7c241d6a25c3169115b", size = 1860502, upload-time = "2026-06-30T06:51:24.495Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/cf/94/976d89db23efed9f3114403faf3f767ec707bfca469a93d0fb715cd352fa/textual-5.0.1-py3-none-any.whl", hash = "sha256:816eab21d22a702b3858ee23615abccaf157c05d386e82968000084c3c2c26aa", size = 699674, upload-time = "2025-07-25T19:50:57.686Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fb/be/35261223d9416a0751cdff1c7b4a6f881387218a12d439fe22fefebc8c04/textual-8.2.8-py3-none-any.whl", hash = "sha256:267375fd402dc8d981457212efa71f0e3365fd17bba144ba9bb3ed7563cb374a", size = 731418, upload-time = "2026-06-30T06:51:26.364Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue