This post will be pre-writing for code-level documentation, including the Scripting Miscellany.
leoApp.py now contains the IdleTimeManager (ITM) class, with a singleton instance, g.app.idleTimeManager.
This class handles all details of running code at idle time, including running 'idle' hooks.
The new encapsulation has simplified code all over Leo:
- ITM ivars replace several LeoApp ivars.
- LM.load now calls g.app.idleTimeManager.start() to start idle-time processing, leaving all the details to the ITM class.
- The g.idle time functions in leoGlobals.py now simply set g.app.idle_time_hooks_enabled.
This is the only other remaining LeoApp ivar pertaining to idle-time processing.
- To schedule code for running at idle time, code calls g.app.idleTimeManager.add_callback(callback).
These are the kinds of simplification I live for. They put all related code in a separate class, where they belong. They make Leo's code easier to understand, even as the code continues to grow. That's why Leo remains maintainable after all these years.
Edward