-
Notifications
You must be signed in to change notification settings - Fork 385
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: correct behavior for tag widget search options #398
Conversation
Remove unused "Add to Search" context menu item for tag widgets.
Add missing functionality for the "Search for Tag" context menu option + left click functionality inside `tag_database.py` aka the "Tag Manager" panel.
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.
Approved when comments are resolved.
tagstudio/src/core/library.py
Outdated
tag_only_ids.append(int(query_words[0])) | ||
tag_only_ids = tag_only_ids + self.get_tag_cluster(int(query_words[0])) |
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.
Will query_words[0] always be a digit?
Use extend on tag_only_ids instead of adding two lists together.
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.
Was about to confidently say "Yes, the tag_id:
prefix is only triggered automatically by the program" and then realized that if the user typed in something like "tag_id: gotcha" it would fail...
|
||
class TagDatabasePanel(PanelWidget): | ||
tag_chosen = Signal(int) | ||
|
||
def __init__(self, library): | ||
def __init__(self, library: "Library", driver: "QtDriver"): |
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.
Literal string "Library"
and "QtDriver"
as the type looks like a typo.
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.
The string literals are there to prevent NameErrors, since QtDriver is not actually imported at runtime (nor should Library be, just caught that) and is only under if typing.TYPE_CHECKING:
for type checking. It's quirky, but it's what PEP 484 suggests
tagstudio/src/qt/widgets/tag.py
Outdated
# add_to_search_action = QAction("Add to Search", self) | ||
# self.bg_button.addAction(add_to_search_action) |
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.
Can these two lines be deleted instead?
* fix(tags): include cluster in tag_id search * fix(ui): remove unused tag context menu item Remove unused "Add to Search" context menu item for tag widgets. * fix(ui): add tag search from tag_database Add missing functionality for the "Search for Tag" context menu option + left click functionality inside `tag_database.py` aka the "Tag Manager" panel. * fix: verify `tag_id:` input in search * style: remove commented code * fix: change `Library` import to type check only
This PR addresses three related issues:
search_library()
method.I have not updated the display of tag IDs in the search bar as discussed in 211, as I feel this is much better suited for a future UI revamp of how tags are displayed in the search bar.
Closes #211.