Skip to content
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

Add the ability to create tags when adding a tag to a file #262

Merged
merged 6 commits into from
Aug 28, 2024

Conversation

bjorn-out
Copy link

@bjorn-out bjorn-out commented Jun 8, 2024

Closes #1

  • Adds a button to the "add tag" modal, below the search results, to create a new tag with the search query as its name, and immediately adds it to the file.
    • It will be a simple tag with no subtags or aliases, and a random color will be assigned.
    • If there are no search results, hitting enter will also create a tag.
  • Search box is now cleared when the modal opens.

Ability to change further details for the newly created tag (like subtags) should be added. My suggestion would be to allow editing any tag in the search results by right-clicking. I tried to implement this, but did not get it to work yet.

I do believe the full tag creation modal should not pop-up by default, as this is frankly annoying when trying to tag many files manually. You can already use Ctrl + T or Cmd + T if you want to create a tag with more details, or use the aforementioned edit button once implemented.

@CyanVoxel CyanVoxel added Type: Enhancement New feature or request Type: QoL A quality of life (QoL) enhancement or suggestion Type: UI/UX User interface and/or user experience TagStudio: Tags Relating to the TagStudio tag system Status: Review Needed A review of this is needed labels Jun 8, 2024

create_button = QPushButton(self)
create_button.setFlat(True)
create_button.setText(f"Create \"{query.replace("&", "&&")}\"")
Copy link
Collaborator

@yedpodtrzitko yedpodtrzitko Jun 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the label "Create " is slightly misleading, because it not only creates the tag, but it also assigns it straight away

f"border-color:{get_tag_color(ColorType.BORDER, "dark gray")};"
f"border-radius: 6px;"
f"border-style:solid;"
f"border-width: {math.ceil(1*self.devicePixelRatio())}px;"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the 1* multiplying for?

@CyanVoxel CyanVoxel removed the Status: Review Needed A review of this is needed label Jun 11, 2024
@CyanVoxel CyanVoxel added this to the Alpha 9.4 milestone Jul 19, 2024
@CyanVoxel CyanVoxel changed the base branch from main to Alpha-v9.4 August 26, 2024 00:13
@CyanVoxel
Copy link
Member

I've made some changes and implemented the feedback given here as well as in #1.
Thank you for your existing work on this!

@CyanVoxel CyanVoxel added the Status: Mergeable The code is ready to be merged label Aug 26, 2024
Focus the save button on the Add Tag panel. This allows the user to promptly hit enter to add the tag as-is.
Computerdores added a commit to Computerdores/TagStudio that referenced this pull request Aug 27, 2024
@CyanVoxel CyanVoxel merged commit 5ac40f5 into TagStudioDev:Alpha-v9.4 Aug 28, 2024
4 checks passed
@CyanVoxel CyanVoxel removed the Status: Mergeable The code is ready to be merged label Aug 28, 2024
CarterPillow pushed a commit to CarterPillow/TagStudio that referenced this pull request Sep 7, 2024
…Dev#262)

* Add the ability to create tags when adding a tag to a file.

* ui: unify tag widget appearance

Unify the tag widget appearance and remove unnecessary "*1" multiplication.

* refactor: change some var names & add docstrings

* feat: edit panel is opened before adding tag

* feat(ui): focus save button on add panel

Focus the save button on the Add Tag panel. This allows the user to promptly hit enter to add the tag as-is.

---------

Co-authored-by: bjorn-out <b.g.out@uva.nl>
Co-authored-by: Travis Abendshien <46939827+CyanVoxel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TagStudio: Tags Relating to the TagStudio tag system Type: Enhancement New feature or request Type: QoL A quality of life (QoL) enhancement or suggestion Type: UI/UX User interface and/or user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SUGGESTION] Add Tag button in "Search Tag" window when Tag cannot be found by the app
3 participants