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

Loader: Implement existing product group picker in Group Products dialog #668

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

BigRoy
Copy link
Collaborator

@BigRoy BigRoy commented Jun 18, 2024

Changelog Description

Implement an "existing product group" picker in Group Products dialog,

image

Additional info

Fixes #648

Testing notes:

  1. Press CTRL+G in loader to get the Group Products dialog
  2. If the current folder has any existing product groups - clicking button right hand side in pop-up should list them for you to easily "put it into that group"
  3. if the current folder has no existing product groups - the button right hand side should be disabled.

@BigRoy BigRoy requested a review from iLLiCiTiT June 18, 2024 20:15
@BigRoy BigRoy added the community Issues and PRs coming from the community members label Jun 18, 2024
@ynbot ynbot added size/XS type: enhancement Improvement of existing functionality or minor addition labels Jun 18, 2024
@BigRoy BigRoy requested a review from iLLiCiTiT June 19, 2024 22:17
@BigRoy BigRoy requested a review from iLLiCiTiT June 20, 2024 18:46
@BigRoy BigRoy assigned BigRoy and unassigned iLLiCiTiT Sep 17, 2024
Comment on lines +53 to +54
self._name_line_edit.set_options(list(sorted(product_groups)))

Copy link
Member

@iLLiCiTiT iLLiCiTiT Sep 18, 2024

Choose a reason for hiding this comment

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

Pre-fill group field value based on selection.

Suggested change
self._name_line_edit.set_options(list(sorted(product_groups)))
product_group = ""
if product_groups:
product_group = next(iter(product_groups))
self._name_line_edit.setText(product_group)
self._name_line_edit.set_options(list(sorted(product_groups)))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The listed product groups are ALL groups under the active folders - not just the groups of the products in your selection. Just so that you can easily move it into another group outside of your selection.

So technically, this would first have to get all the product entities, get their product groups - then from those pick the first entry (or most used entry)...

Copy link
Member

@iLLiCiTiT iLLiCiTiT Sep 18, 2024

Choose a reason for hiding this comment

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

Well, right now it's prefilled with previous value of the widget. So either we use first, or empty string, or most common, but current behavior is not correct.

Suggested change
self._name_line_edit.set_options(list(sorted(product_groups)))
self._name_line_edit.setText("")
self._name_line_edit.set_options(list(sorted(product_groups)))


def set_product_ids(self, project_name, product_ids):
self._project_name = project_name
self._product_ids = product_ids

# Update the product groups
product_groups = self._controller.get_folder_product_group_names(
project_name=self._controller.get_selected_project_name(),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
project_name=self._controller.get_selected_project_name(),
project_name=project_name,

# Update the product groups
product_groups = self._controller.get_folder_product_group_names(
project_name=self._controller.get_selected_project_name(),
folder_ids=self._controller.get_selected_folder_ids()
Copy link
Member

@iLLiCiTiT iLLiCiTiT Sep 18, 2024

Choose a reason for hiding this comment

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

BTW I think the method should expect product_ids instead of folder ids, to avoid using self._controller.get_selected_folder_ids(). Or set_product_ids method should expect folder ids too, because the widget calling the method has access to folder ids.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See: https://github.com/ynput/ayon-core/pull/668/files#r1765457734

  1. We need the folder ids to query ALL the available product names under the folders - including those not in the current products selection.
  2. We need the product ids to know which products we actually want to change with the dialog.

Copy link
Member

@iLLiCiTiT iLLiCiTiT Sep 18, 2024

Choose a reason for hiding this comment

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

Yes, both can be send to this method. The only place calling this function already have access to it, so it can just pass it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues and PRs coming from the community members size/XS type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loader: Set Product Group add dropdown for existing product groups
3 participants