-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: subtags/parent tags & aliases update the UI for building a tag #534
Merged
Merged
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1b12482
updated parents and aliases to use the flowLaout in the build tag panel
DandyDev01 299e92b
added aliases and subtags to search results
DandyDev01 50ae2a8
aliases now use a table, removed unnecessary keyboard shortcuts
DandyDev01 1435238
reverted subtags to regular list from flowlayout
DandyDev01 4f4ffc8
Merge pull request #16 from DandyDev01/aliases_table
DandyDev01 7e8c33d
chor remove redundant lambda
DandyDev01 8df955a
feat: added display names for tags
DandyDev01 e929712
Merge pull request #17 from DandyDev01/aliases_table
DandyDev01 d591050
fix: aliases table enter/return and backspace work as expected, displ…
DandyDev01 d9186f0
Merge branch 'main' into merge
DandyDev01 d6ab610
fix: can not remove the bottom alias with backspace and removing the …
DandyDev01 3e9b5fe
format
DandyDev01 08ecb34
Merge pull request #19 from DandyDev01/aliases_ui
DandyDev01 9484d28
fix: add parent button on build tag panel
DandyDev01 3d3347e
fix: empty aliases where not being removed all the time
DandyDev01 bb39a3f
fix: alias name changes would be discarded when a new alias was creat…
DandyDev01 979c6f3
merge with upstream/main
DandyDev01 38b0e5d
fix: removed display names, as they didn't display properly and shoul…
DandyDev01 fac0c8d
fix: mypy
DandyDev01 e046681
Merge remote-tracking branch 'upstream/main'
DandyDev01 0f7ba0c
fix: added missing session.expunge_all
DandyDev01 3b0a423
fix: parent_tags relationship in Tag class
DandyDev01 e877eba
fix: pillow_jxl import was missing
DandyDev01 e317509
fix: ruff
DandyDev01 1be7e49
fix: type hint fixes
CyanVoxel 715d10e
fix: fix the type hint fixes
CyanVoxel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,10 +50,10 @@ class Tag(Base): | |
|
||
aliases: Mapped[set[TagAlias]] = relationship(back_populates="tag") | ||
|
||
parent_tags: Mapped[set["Tag"]] = relationship( | ||
parent_tags: Mapped[list["Tag"]] = relationship( | ||
secondary=TagSubtag.__tablename__, | ||
primaryjoin="Tag.id == TagSubtag.child_id", | ||
secondaryjoin="Tag.id == TagSubtag.parent_id", | ||
primaryjoin="Tag.id == TagSubtag.parent_id", | ||
secondaryjoin="Tag.id == TagSubtag.child_id", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any specific reason for this change? |
||
back_populates="subtags", | ||
) | ||
|
||
|
@@ -76,20 +76,39 @@ def alias_strings(self) -> list[str]: | |
def alias_ids(self) -> list[int]: | ||
return [tag.id for tag in self.aliases] | ||
|
||
@property | ||
def display_name(self) -> str: | ||
if len(self.parent_tags) == 0: | ||
return "" | ||
|
||
parent_tag = list(self.parent_tags)[0] | ||
|
||
if parent_tag is None: | ||
return "" | ||
|
||
display_name = "" | ||
|
||
if parent_tag.shorthand.strip() == "" or parent_tag.shorthand is None: | ||
display_name = " (" + parent_tag.name + ")" | ||
else: | ||
display_name = " (" + parent_tag.shorthand + ")" | ||
|
||
return self.name + display_name | ||
|
||
def __init__( | ||
self, | ||
id: int | None = None, | ||
name: str | None = None, | ||
shorthand: str | None = None, | ||
aliases: set[TagAlias] | None = None, | ||
parent_tags: set["Tag"] | None = None, | ||
parent_tags: list["Tag"] | None = None, | ||
subtags: set["Tag"] | None = None, | ||
icon: str | None = None, | ||
color: TagColor = TagColor.DEFAULT, | ||
): | ||
self.name = name | ||
self.aliases = aliases or set() | ||
self.parent_tags = parent_tags or set() | ||
self.parent_tags = parent_tags or list() | ||
self.subtags = subtags or set() | ||
self.color = color | ||
self.icon = icon | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this as well?