Skip to content

Commit 38b0e5d

Browse files
committed
fix: removed display names, as they didn't display properly and should be added in a different PR
1 parent 979c6f3 commit 38b0e5d

File tree

4 files changed

+9
-29
lines changed

4 files changed

+9
-29
lines changed

tagstudio/src/core/library/alchemy/models.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Tag(Base):
5050

5151
aliases: Mapped[set[TagAlias]] = relationship(back_populates="tag")
5252

53-
parent_tags: Mapped[list["Tag"]] = relationship(
53+
parent_tags: Mapped[set["Tag"]] = relationship(
5454
secondary=TagSubtag.__tablename__,
5555
primaryjoin="Tag.id == TagSubtag.parent_id",
5656
secondaryjoin="Tag.id == TagSubtag.child_id",
@@ -76,39 +76,20 @@ def alias_strings(self) -> list[str]:
7676
def alias_ids(self) -> list[int]:
7777
return [tag.id for tag in self.aliases]
7878

79-
@property
80-
def display_name(self) -> str:
81-
if len(self.parent_tags) == 0:
82-
return ""
83-
84-
parent_tag = list(self.parent_tags)[0]
85-
86-
if parent_tag is None:
87-
return ""
88-
89-
display_name = ""
90-
91-
if parent_tag.shorthand.strip() == "" or parent_tag.shorthand is None:
92-
display_name = " (" + parent_tag.name + ")"
93-
else:
94-
display_name = " (" + parent_tag.shorthand + ")"
95-
96-
return self.name + display_name
97-
9879
def __init__(
9980
self,
10081
id: int | None = None,
10182
name: str | None = None,
10283
shorthand: str | None = None,
10384
aliases: set[TagAlias] | None = None,
104-
parent_tags: list["Tag"] | None = None,
85+
parent_tags: set["Tag"] | None = None,
10586
subtags: set["Tag"] | None = None,
10687
icon: str | None = None,
10788
color: TagColor = TagColor.DEFAULT,
10889
):
10990
self.name = name
11091
self.aliases = aliases or set()
111-
self.parent_tags = parent_tags or list()
92+
self.parent_tags = parent_tags or set()
11293
self.subtags = subtags or set()
11394
self.color = color
11495
self.icon = icon

tagstudio/src/qt/modals/tag_database.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ def update_tags(self, query: str | None = None):
8484
row = QHBoxLayout(container)
8585
row.setContentsMargins(0, 0, 0, 0)
8686
row.setSpacing(3)
87-
display_name = tag.display_name
88-
tag_widget = TagWidget(
89-
tag, tag_display_name=display_name, has_edit=True, has_remove=False
90-
)
87+
tag_widget = TagWidget(tag, has_edit=True, has_remove=False)
9188
tag_widget.on_edit.connect(lambda checked=False, t=tag: self.edit_tag(t))
9289
row.addWidget(tag_widget)
9390
self.scroll_layout.addWidget(container)

tagstudio/src/qt/ts_qt.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,10 @@ def clear_select_action_callback(self):
661661

662662
def show_tag_database(self):
663663
self.modal = PanelModal(
664-
TagDatabasePanel(self.lib), "Library Tags", "Library Tags", has_save=False
664+
TagDatabasePanel(self.lib),
665+
"Library Tags",
666+
"Library Tags",
667+
has_save=False,
665668
)
666669
self.modal.show()
667670

tagstudio/src/qt/widgets/tag.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def __init__(
105105
tag: Tag,
106106
has_edit: bool,
107107
has_remove: bool,
108-
tag_display_name: str = None,
109108
on_remove_callback: FunctionType = None,
110109
on_click_callback: FunctionType = None,
111110
on_edit_callback: FunctionType = None,
@@ -125,7 +124,7 @@ def __init__(
125124

126125
self.bg_button = QPushButton(self)
127126
self.bg_button.setFlat(True)
128-
self.bg_button.setText(tag_display_name or tag.name)
127+
self.bg_button.setText(tag.name)
129128
if has_edit:
130129
edit_action = QAction("Edit", self)
131130
edit_action.triggered.connect(on_edit_callback)

0 commit comments

Comments
 (0)