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

SHOT-2850 Small update to the task_required UI display #130

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

rob-aitchison
Copy link
Contributor

The previous PR explains the why quite well - #81

This new one addresses an open comment from that PR that was not resolved to use a style_constant instead of a hard-coded color plus it introduces a second re-style of the text above the Task box.

@codecov
Copy link

codecov bot commented Aug 5, 2020

Codecov Report

Merging #130 into master will increase coverage by 0.90%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #130      +/-   ##
==========================================
+ Coverage   71.99%   72.89%   +0.90%     
==========================================
  Files          13       13              
  Lines        1296     1306      +10     
==========================================
+ Hits          933      952      +19     
+ Misses        363      354       -9     
Impacted Files Coverage Δ
...ti_publish2/api/plugins/publish_plugin_instance.py 92.85% <0.00%> (+8.37%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09babe7...aef3d8c. Read the comment docs.

Copy link
Contributor

@pscadding pscadding left a comment

Choose a reason for hiding this comment

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

The styling changes look great, thanks for switching it to using the constants!

I have a few comments around the setting of the text on the context widget label though.

self.ui.context_widget.ui.task_label.setStyleSheet("")
self.ui.context_widget.ui.label.setText(
"Task and Entity Link to apply to the selected item:"
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we should be calling the enable_editing method, and passing the message rather than directly modifying the label. Or using the context_label. I don't think the ui property is intended to be public, despite it not having _ at the beginning.
This also applies further up on line 1665.

Also I assume this works when you select an item, but what happens when you select the summary (visible when you have more than 2 root items), the message should be different I think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to add another comment to Phil's :)
When you have more than one item in your publisher and if some of your items has been setup correclty (aka are linked to a Task), the "error" message still appears for these items. Maybe we should update the message according to the selected item.

@rob-aitchison
Copy link
Contributor Author

Alright, I have updated this based on your feedback @pscadding and @barbara-darkshot .
I am also debating whether to override the Validate and Publish button style to display in the SG_ALERT_COLOR to make it more obvious that they will not work as the disabled value is so subtle - thoughts on that?

Copy link
Contributor

@barbara-darkshot barbara-darkshot left a comment

Choose a reason for hiding this comment

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

LGTM!

@barbara-darkshot
Copy link
Contributor

Regarding the Publish/Validate stylesheet, if using the SG_ALERT_COLOR is too flashy, maybe we can just add or modify the tooltip when overflying the buttons saying why they are disabled

Copy link
Contributor

@pscadding pscadding left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @rob-aitchison, I have a few more suggestions.

"<p>Task Required is <b>True</b> in your configuration. "
"Please select a Task to continue.</p>",
)
self.ui.context_widget.ui.label.setStyleSheet(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should be able to use context_widget.context_label instead of going via the ui attribute?
I'm uncomfortable with us using the .ui property as that is not intended to be public .

Copy link
Contributor

Choose a reason for hiding this comment

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

Also could the color be set through the enable_editing, via html tags? That would save you having to modify the stylesheet.

# Check for task_required and change UI styling accordingly
if not self._validate_task_required():
# Change task label color to SG_ALERT_COLOR
self.ui.context_widget.ui.task_label.setStyleSheet(
Copy link
Contributor

Choose a reason for hiding this comment

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

Like I mentioned bellow, I'm not sure it's a good idea to go via the context_widget.ui, the widgets in there might get updated. Though it looks like this particular label is not exposed publicly.

I guess the correct thing to do would be to update the qtwidgets framework to publicly expose that label.
@jfboismenu what do you think?

Comment on lines +817 to +840
# Check for task_required and change UI styling accordingly
if not self._validate_task_required():
# Change task label color to SG_ALERT_COLOR
self.ui.context_widget.ui.task_label.setStyleSheet(
"color: "
+ sgtk.platform.current_bundle().style_constants["SG_ALERT_COLOR"]
)
# Also change the text and color of the label
# Use SG_HIGHLIGHT_COLOR for better readability
context_label_text = (
"<p>Task Required is <b>True</b> in your configuration. "
"Please confirm all Tasks are assigned to continue.</p>"
)
self.ui.context_widget.ui.label.setStyleSheet(
"color: "
+ sgtk.platform.current_bundle().style_constants[
"SG_HIGHLIGHT_COLOR"
]
)
else:
context_label_text = "Task and Entity Link to apply to all items:"
# Ensure styling overrides are cleared
self.ui.context_widget.ui.label.setStyleSheet("")
self.ui.context_widget.ui.task_label.setStyleSheet("")
Copy link
Contributor

Choose a reason for hiding this comment

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

Other than the context_label_text text this looks like a duplication of the code at line 847-873, I wonder if this could be turned into a method?

@rob-aitchison rob-aitchison marked this pull request as draft August 31, 2020 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants