Skip to content

Commit 39cc16a

Browse files
committed
fix: when a tag is removed or edited the preivew panel will update to reflect the changes
1 parent b8fbf9d commit 39cc16a

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

tagstudio/src/qt/modals/tag_database.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from src.core.constants import RESERVED_TAG_IDS
1616
from src.core.library import Library, Tag
1717
from src.core.library.alchemy.enums import FilterState
18-
from src.core.library.alchemy.library import get_default_tags
1918
from src.qt.modals.build_tag import BuildTagPanel
2019
from src.qt.widgets.panel import PanelModal, PanelWidget
2120
from src.qt.widgets.tag import TagWidget
@@ -117,14 +116,14 @@ def update_tags(self, query: str | None = None):
117116
self.search_field.setFocus()
118117

119118
def remove_tag(self, tag: Tag):
120-
if tag.id in get_default_tags():
119+
if tag.id in RESERVED_TAG_IDS:
121120
return
122121

123122
self.lib.remove_tag(tag)
124123
self.update_tags()
125124

126125
def edit_tag(self, tag: Tag):
127-
if tag.id in get_default_tags():
126+
if tag.id in RESERVED_TAG_IDS:
128127
return
129128

130129
build_tag_panel = BuildTagPanel(self.lib, tag=tag)

tagstudio/src/qt/ts_qt.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,11 @@ def clear_select_action_callback(self):
652652

653653
def show_tag_database(self):
654654
self.modal = PanelModal(
655-
TagDatabasePanel(self.lib), "Library Tags", "Library Tags", has_save=False
655+
done_callback=lambda: self.preview_panel.update_widgets(),
656+
widget=TagDatabasePanel(self.lib),
657+
title="Library Tags",
658+
window_title="Library Tags",
659+
has_save=False,
656660
)
657661
self.modal.show()
658662

tagstudio/src/qt/widgets/panel.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ def __init__(
8888
self.root_layout.setStretch(1, 2)
8989
self.root_layout.addWidget(self.button_container)
9090

91+
def closeEvent(self, event): # noqa: N802
92+
self.done_button.click()
93+
event.accept()
94+
9195

9296
class PanelWidget(QWidget):
9397
"""Used for widgets that go in a modal panel, ex. for editing or searching."""

0 commit comments

Comments
 (0)