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

Implement dynamic status update of the dictionaries #1400

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

user202729
Copy link
Member

@user202729 user202729 commented Aug 3, 2021

Summary of changes

(See also the linked issue.) In summary, this change will make it such that if some dictionaries are fast to load and others are slow to load, the icon will only display on the dictionaries which haven't finished loading.

Breaking change:

  • add a new hook (and a new corresponding qt signal)
  • I did some refactor, in that previously StenoLoadingManager.load() returns a list of mixed DictionaryLoaderException and JsonDictionary etc. objects, only for the Exception objects to be immediately converted into ErroredDictionary object in engine.py right after, now load() returns a list of mixed ErroredDictionary and JsonDictionary objects which are homogeneous (both are instances of StenoDictionary).

Note:

The favorite icon is not shown until all dictionaries are loaded (although it might be impossible to determine it correctly in advance before all dictionaries are loaded)

Note: make sure that there's no race condition and the final dictionaries_changed hook is always triggered later than the dictionary_state_changed hooks.

Closes #1331 .

Pull Request Checklist

  • Changes have tests
  • News fragment added in news.d. See documentation for details

@user202729
Copy link
Member Author

user202729 commented Aug 3, 2021

Of course the additional hooks triggered/events emitted will break the tests...

Note that if there are more than one dictionaries loaded, the checking functions might need to be modified to account for the different orders of the dictionary_state_changed events (it's not deterministic)


Note that this creates a circular reference loop (engine -> dictionary load manager -> dictionary load operation -> ...), but there probably isn't that many of them, and Python can collect them.

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.

Dynamically show refreshing icon on the dictionaries widget
1 participant