refactor(ui): apply new MVC guidelines to search panels (#1461)

* feat(ui): replace add tag modal with autocomplete search/create bar

* refactor: code cleanup and fixes

* refactor: RADICAL mvc refactor...

* feat: add setting to open edit window when creating tags

* refactor(ui): refactor preview panel into new MVC pattern

* refactor: remove controller suffix from preview_panel.py

* Revert "refactor: remove controller suffix from preview_panel.py"

This reverts commit c8ba9b15c2.

* feat(ui): add autocomplete search for field templates

* fix(ui): fix issues with tag and field widget appearances

* refactor(ui): use Qt's .layout() method instead of _layout references

* feat(ui): add underline indicator for search bar items

* refactor: remove view parameters

* refactor(ui): refactor PanelModal and PanelWidget into MVC Modal, ModalView, and ModalContent classes

* refactor(ui): refactor SearchPanel classes to use newer MVC pattern

* fix: remove deprecated methods

* chore: fixes after rebase
This commit is contained in:
Travis Abendshien
2026-07-27 12:43:11 -07:00
committed by GitHub
parent ff43c4a4bd
commit 6177befebb
16 changed files with 269 additions and 391 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: (c) TagStudio Contributors
# SPDX-License-Identifier: GPL-3.0-only
# pyright: reportPrivateUsage = false
from collections.abc import Callable
@@ -22,7 +23,7 @@ def test_build_tag_panel_add_sub_tag_callback(
panel: BuildTagPanel = BuildTagPanel(library, child)
qtbot.addWidget(panel)
panel._add_parent_tag_callback(parent.id) # pyright: ignore[reportPrivateUsage]
panel._add_parent_tag_callback(parent.id)
assert len(panel.parent_ids) == 1
@@ -40,7 +41,7 @@ def test_build_tag_panel_remove_subtag_callback(
panel: BuildTagPanel = BuildTagPanel(library, child)
qtbot.addWidget(panel)
panel._remove_parent_tag_callback(parent.id) # pyright: ignore[reportPrivateUsage]
panel._remove_parent_tag_callback(parent.id)
assert len(panel.parent_ids) == 0
@@ -58,7 +59,7 @@ def test_build_tag_panel_add_alias_callback(
panel: BuildTagPanel = BuildTagPanel(library, tag)
qtbot.addWidget(panel)
panel._create_alias_callback() # pyright: ignore[reportPrivateUsage]
panel._create_alias_callback()
assert panel.aliases_table.rowCount() == 1
+4 -6
View File
@@ -8,13 +8,12 @@ from pytestqt.qtbot import QtBot
from tagstudio.core.library.alchemy.library import Library
from tagstudio.qt.controllers.tag_search_panel_controller import TagSearchPanel
from tagstudio.qt.mixed.tag_widget import TagWidget
from tagstudio.qt.ts_qt import QtDriver
from tagstudio.qt.views.tag_search_panel_view import TagSearchPanelView
from tagstudio.qt.views.search_panel_view import SearchPanelView
def test_update_tags(qtbot: QtBot, library: Library):
# Given
panel = TagSearchPanel(library, view=TagSearchPanelView(is_tag_chooser=True))
panel = TagSearchPanel(library, view=SearchPanelView("", is_chooser=True))
qtbot.addWidget(panel)
@@ -22,10 +21,9 @@ def test_update_tags(qtbot: QtBot, library: Library):
panel.update_items()
def test_tag_widget_actions_replaced_correctly(qtbot: QtBot, qt_driver: QtDriver, library: Library):
panel = TagSearchPanel(library, view=TagSearchPanelView(is_tag_chooser=True))
def test_tag_widget_actions_replaced_correctly(qtbot: QtBot, library: Library):
panel = TagSearchPanel(library, view=SearchPanelView(""))
qtbot.addWidget(panel)
panel.set_driver(qt_driver)
# Set the widget
tags = library.tags