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

Update models only once on init #3530

Merged
merged 2 commits into from
Sep 11, 2020

Conversation

SuslikV
Copy link
Contributor

@SuslikV SuslikV commented May 29, 2020

Because view models has same origin, there is no sense to update models from the each view during initialization.

Now log-file shows that same models are updated twice on init (one for each View). This PR removes this excessive update on View init.

@ferdnyc
Copy link
Contributor

ferdnyc commented May 29, 2020

I'm on my phone right now and can't get a REALLY good look at it, but makes total sense to me. 👍

We probably don't even need the call to self.refresh_columns() in the view __init__()s, since by then it'll be connected to the signal that the model will emit after refresh.

@ferdnyc
Copy link
Contributor

ferdnyc commented May 29, 2020

In fact, now I'm wondering if the model refresh shouldn't be delayed until after the project file is loaded (when one is being loaded) -- if it isn't already. (Again, phone. Can't remember.) Before then, there's nothing to refresh.

@ferdnyc
Copy link
Contributor

ferdnyc commented Jul 23, 2020

Hrm. So, I was going to merge this (sorry for the delay, lost track of it), and then during a final quick test I actually spotted a difference from the current develop code.

In develop, if I have the Emojis filter selector set on one of the groups (e.g. 'Smileys'), then when I bring up OpenShot that group will be selected, since it's stored in my user settings.

But with this branch, the Emojis list always comes up showing all items — it doesn't respect the saved filter settings. Not sure why.

It might be because the refresh is being done before the dock is visible. If it's done after that point, the view refresh should happen automatically, because the signal's been connected. Might work to just move the update_model() calls down a few lines each, to after the `show() calls for the enabled View. (Or, alternately, that may be backwards. It may have to happen before the view objects are created.)

@ferdnyc
Copy link
Contributor

ferdnyc commented Jul 23, 2020

Oh, yeah, moving the update_model() to before EmojisListView() is created fixes it, for that one. Which makes total sense come to think of it, because the View code makes use of the model data, when it's creating that dropdown list.

Emojis model may has filters applied, thus should be updated before submitting it to the new view.

Co-authored-by: Frank Dana <[email protected]>
@jonoomph jonoomph merged commit 57b7d03 into OpenShot:develop Sep 11, 2020
@jonoomph
Copy link
Member

LGTM, seems to work in my testing

@SuslikV SuslikV deleted the no-model-update-from-view branch October 4, 2020 17:53
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