On Sep 8, 6:40 pm, "Edward K. Ream" <edream...@gmail.com> wrote:

> leoPlugins.py [is] a sewer: it's nothing but functions and globals.

Rev 3358 completes a grand rewrite of leoPlugins.py.  The highlights:

1. Early in the startup process, leo calls leo.core.leoPlugins.init(),
which in turn sets g.app.pluginsController to an instance of the
LeoPluginsController class, defined in leoPlugins.py.

2. Rather than importing leo.core.leoPlugins, all code is expected to
use g.app.pluginsController.

3. For compatibility, the module level
leo.core.leoPlugins.registerHandler function still exists.  It merely
calls g.app.pluginsController.registerHandler.  I may revise the
plugins code to call g.app.pluginsController.registerHandler rather
than leo.core.plugins.registerHandler, but there is no rush.

4. I left the baseLeoPlugin and CommandChainDispatcher classes
completely untouched.  Ditto for the TryNext exception.

This strategy was a complete success.  The code started working almost
instantly. Moreover, the code seems considerably faster.  This
shouldn't be a surprise: accessing the LeoPluginsController class
without doing an import is a big savings.  This speeds up all event
handlers.

I am now in the position to revise the LeoPluginsController class.  A
bit of refactoring is urgently needed, but this should be
straightforward.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to leo-edi...@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to