-
Notifications
You must be signed in to change notification settings - Fork 0
Debugging
Enable verbose debug output for drag/drop, layout, dock and package lifecycle operations:
mdw.debugMode = trueIt survives MDW's own scripts re-running, so it stays on across a package update - which is what makes it useful for tracing one.
When a game package comes back from an update half-built, this is what to look at. The lifecycle prints who did what, in order:
[DEBUG] swapPackage: uninstalling MyGameUI
[DEBUG] cleanupGame: reaping everything owned by MyGameUI
[DEBUG] swapPackage: installing MyGameUI from /path/to/MyGameUI.mpackage
[DEBUG] swapPackage: MyGameUI installed, Mudlet accepted
[DEBUG] onInstall MyGameUI: registered=true isSetUp=true onReady=true
[DEBUG] onInstall MyGameUI: re-running onReady for owner MyGameUI
A swap that lands while Mudlet saves the profile shows
swapPackage: Mudlet will not uninstall MyGameUI yet (saving the profile?) - retrying in 1s
before the uninstall goes through, or the install of MyGameUI is queued behind a profile save
after it. Both are normal and resolve by themselves within seconds.
The onInstall line is the one that usually answers the question. MDW rebuilds
a reinstalled game package by re-running its onReady, and it only does that
when all three hold:
-
registered- the package is inmdw.gamePackages. Your package seeds that at script-load time; if it isfalse, your scripts have not re-seeded it. -
isSetUp- MDW itself is up. -
onReady- a callback is registered under that owner key.
All three false look identical from the outside - a UI that does not come
back - and are entirely different faults.
One thing the trace will not show you: re-running onReady recreates your
widgets but does not restore their placement, because only a full
mdw.setup() loads the layout (you will see Layout loaded from ... when it
does). If your widgets exist in mdw.widgets but are not on screen, that is
why - finish an update with mdw.rebuild() rather than relying on the
onReady re-run alone.
-- Print saved layout details to main window
mdw.showLayout()
-- Print current widget state to main window
mdw.showWidgets()
-- The live layout as plain data (docks, rows, groups, floats, hidden widgets)
display(mdw.describeLayout())If the UI is ever half-torn - a script-editor save that re-ran MDW's scripts over a live session, say (MDW schedules its own rebuild in that case) - mdw.rebuild() or the gear menu's Rebuild UI tears everything down and builds it fresh, consumer registrations included. mdw.resetLayout() does the same after throwing the saved layout away.