MorphMan
MorphMan copied to clipboard
2.1.50 beta breaks MorphMan
As in the title _get_config_py_preference is failing on startup saying that config_py is NoneType, so it wasn't initialized?
Looks like this code isn't getting called
addHook('profileLoaded', init_preferences)
# ToDo: - move this hook to better home
This lines in stats.py are the culprit of the crashes. Removing them allowed the addon to load, but I don't know if it even works without it as there are no stats or anything.
from aqt import gui_hooks
gui_hooks.top_toolbar_did_init_links.append(on_top_toolbar_did_init_links)
The problem is that the addon tries to start before the user profile is even loaded.
Changing on_top_toolbar_did_init_links in stats.py to this code "fixes" it i suppose. It loads now. Basically added a try except block so it doesn't throw on user profile screen. For some reason top_toolbar_did_init_links hook is called there now.
def on_top_toolbar_did_init_links(links, toolbar):
try:
name, details = getStatsLink()
links.append(
toolbar.create_link(
"morph", _(name), on_morph_link_clicked, tip=_(details), id="morph"
)
)
except:
pass
Also the code needs an update for these lines in newMorphHelper.py (for v3 scheduler). I don't know how to do that yet.
schedv2.Scheduler._fillNew = wrap(schedv2.Scheduler._fillNew, my_fillNew, 'around')
schedv2.Scheduler._getNewCard = wrap(schedv2.Scheduler._getNewCard, my_getNewCard, 'around')
I opened an issue concerning the v3 scheduler: #276. I doesn’t work on 2.1.49 as well.