-
Notifications
You must be signed in to change notification settings - Fork 42
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
Action icons #55
Action icons #55
Conversation
Sweet stuff! :)
If the gui is attached to the hosts doesn't it always get unresponsive during processing? I think Pyblish QML works because it's a separate process. |
You are right :) I was getting confused by the debugging mode and that the gui is responsive between plugins processes. |
Yes, an unfortunate consequence of running a GUI within a host. :( I've emulated the behavior of QML by having the GUI update in between processes. Happy to hear it went unnoticed for this long. :) |
This PR is ready for some testing and inspection then :) |
Would it be possible to see a screenshot? :) I'll try and take a closer look asap. |
That's great! |
Ok, here we go. Great job overall. I think it fits the overall code well, and aligns with how it's done in pyblish-qml. It's understandable, is clean and seems maintainable. There are a few issues with it that shouldn't be too challenging.
Great work, and let me know what you think! |
Is it the naming you have a problem with? Is
I tried to defer the action processing, so the icon color would update but didn't have any luck with
Sure, makes sense :)
I did it this way to avoid having to have a duplicate method |
No there shouldn't be any need for this. What we need, is for the GUI to update, before processing begins. Doing this asynchronously could work like this.
This way, results can be passed as usual to the model, and the GUI is given plenty of time to redraw itself. No synchronous functions needed. See how |
Hey @mottosso, I'm sorry but I really don't know what I'm doing with these changes. I can't see what the end result should be, so I'm just fumbling around. There are mostly likely big areas of the UI that I don't have the knowledge about to see what is wrong with my code. |
No problem, Toke. I think just by trying you're already gaining some insight, and then later tonight I can show you what I mean and hopefully you should be able to find that aha-moment along with the ability to implement it yourself next time. GUIs are hard, more so when concurrent. I learned the abstract thinking about it by getting into ZeroMQ and their book which is really great. He talks about how you don't need to wait (i.e. block) for other tasks to finish, but can instead rely on emitting and handling signals when there's time. That's exactly what we're doing here, even with just one thread. |
There are a few things I changed unneccessarily, such as your choice of model roles, but we should take another look at those as well. As you can see, most of what needs to happen happens with just two roles; isVisible and hasError. This is similar to how pyblish-qml does things.
Ok, having a look at this now. (1) For starters, I think we can reduce the number of roles for actions. pyblish-qml gets by with only three roles.
Visible is self-explanatory. Pending means it hasn't yet been run; so it's white/grayed out. If pending is (2) In pyblish-qml, action-related data is updated in the controller, not the model. Having gotten back into the reasoning for this, it was because actions in overall never quite fit into the mental model of processing plug-ins and therefore requires special treatment. As a side-note, this is another reason why thinking about action brought shivers down my spine. What this means is, we won't have to actually update I've PR'd your fork, let's continue the discussion in here. |
My reasoning for having a fourth role |
This feedback should still happen, the GUI updates when the user hits the button, but actual processing doesn't start until 100 milliseconds later, as per the call to |
Have a look at whether the delegate actually as code in it to color it light-blue. The timing looks right to me, it does update the color when you press it and only freezes afterwards. |
I get that it doesn't have the code for colouring it light-blue for processing, but I don't get how to implement this behaviour with just three roles for actions. |
Ahaa, ok. Now I'm with you. In that case, it's possible you need one more role. Unless you can utilise the current state of the program, being in "publishing" mode, from within the delegate. |
That's a good idea. Giving it a try. |
Remove action_processing
Here is a preview of the current state of this feature. One visual difference is that the plugins checkbox updates as well when the action is processing. The checkbox still retains its previous state, but runs light-blue when processing. This is because of using the The code is ready for another review as well. |
Looks great! Does an action affect the color of the plug-in indicator, when the plug-in hasn't yet been run? |
Nope, stays idle color if the plugin was idle before the action was run. |
Ooh, neat. I noticed it was altering the color if it was already green. As in your gif. If that's predictable, then I have no problem with that. Looks good, will take a look at the code asap. |
I'm wondering if this could be merged as it kinda stayed hanging here :). We've used in in production for a month now without issues. Apart from the ones originating from other parts of pyblish-lite. |
Sorry about that, I haven't had time to look into it yet. Having a look now. |
@@ -268,11 +302,12 @@ def setData(self, index, value, role): | |||
else: | |||
self.dataChanged.emit(index, index, [role]) | |||
|
|||
def update_with_result(self, result): | |||
def update_with_result(self, result, action=False): |
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.
This is the only thing making me hesitate.
Some day, me or someone else will try and use this function and wonder "Why does update_with_result()
take a result and an action?".
But I think it's safe to look past, so long as we have this conversation on record and that it will at some point be fixed. :)
@tokejepsen Could you version this up for me? A minor increase should suffice. Then I'll make a new release with it. |
Assuming that is enough? |
Ops, don't forget to zero out the
Starting fresh from new minor version. |
Whoopsie, good point:) |
Done! |
fixed recalculating positions of grouped instances to continue with r…
This is a working version for #53.
One thing I'm not happy about is that when executing an action, the UI becomes unresponsive. I tried to follow how @mottosso went about it for the plugin processing, but I couldn't figure it out.