-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
feat: remove and create tags from tag database panel #569
Conversation
[fix] library panel updates tag list when a new tag is create
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.
avoid lambda as possible.
#131 (comment)
tag_widget.on_edit.connect(lambda checked=False, t=tag: self.edit_tag(t)) | ||
tag_widget.on_remove.connect(lambda t=tag: self.remove_tag(t)) |
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.
use functools.partial
instead of lambda
.
tag_widget.on_remove.connect(lambda t=tag: self.remove_tag(t)) | |
tag_widget.on_remove.connect(partial(self.remove_tag, tag)) |
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.
I believe, the codebase uses lambda throughout when using slots. Is there a real world benefit to using a partial here (or throughout)?
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.
in this case, partial feels comfortable for me because that makes the intent more explicit and ties directly to the idea of binding tag
to self.remove_tag
. however i would say it's a matter of style so i'm okay if @DandyDev01 decides to go with lambda here.
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.
In this case, I will just stick with the lambda, because it seems that using a partial will not guarantee a memory leak won't occur and @seakrueger didn't run into any leaks while testing #131 (comment). Also, I haven't seen partials used too much elsewhere in the code base, so for consistency and readability (most people already know lambda and might have to lookup partials) lambda make more sense for now.
Co-authored-by: VasigaranAndAngel <[email protected]>
Two quick things, sorry. Thanks for the pull!
|
565f8a7
to
39cc16a
Compare
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.
Works great, thanks!
… reflect the changes Co-authored-by: Sean Krueger <[email protected]>
8a6aa29
to
9f9b9a7
Compare
Can you rebase this to main now that parent tags have been added (#596)? I wouldn't want to pull this until we can verify that it's compatible |
Looks very good! Seems to work mostly well with the new subtag and alias implementation, however I did notice that any subtag and alias connections that reference deleted tags will stick around in the db afterwards. Should just be a straightforward addition of making sure those affected rows get purged as well. I've also got a log warning that happens that's related to this:
Also, I know this is a late ask so I understand if you'd rather pass on doing this, but I think a confirmation message box when deleting tags would be a much needed addition. If you'd rather not spend any more time on that, I understand and can implement one myself afterwards (or push to this PR if you're comfortable with that!) |
All good! I can add a confirmation message box. |
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.
Thank you so much for all of your work on this!
This import was accidentally removed in #569. This commit restores the import.
Added a button in the tag database panel for creating new tags
added ability to delete tags from the tag database panel