On Apr 2, 1:04 am, "Ville M. Vainio" <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 2, 2008 at 2:38 AM, Edward K. Ream <[EMAIL PROTECTED]> wrote:
>
> > I'm not sure what the solution is. Possibly all Leo imports will have
> > to be changed from:
>
> > import leoX
>
> > to
>
> > import leo.core.x.
>
> Yes. Fully qualified imports will be made mandatory in the future anyway,
> IIRC.
I have started a branch to explore this project.
Actually, I should create an "official" branch. I just realized that
what I have done (create a local branch of the trunk) is dangerous: if
I forget and push that branch we will not be happy. I'll create a
proper branch on launchpad before further work.
Anyway, it looks like only a little more work is needed. What I did:
1. Changed the name of the leo/src directory to 'core'
2. Added the following __init__.py to the top-level leo directory:
# Dummy file to make this a potential package.
def run(*args,**keys):
import pdb ; pdb = pdb.set_trace
pdb()
import leo.core.leo
leo.core.leo.run(*args,**keys)
Assuming this leo directory is in Python25/Lib/site-packages, the user
can just do the following in the python interpreter:
import leo
leo.run() # could add optional path to a .leo file.
This works with little or no changes in any of Leo's core sources. In
particular, imports in Leo's core must *stay as they are*. Qualified
imports do not work. Not sure why, but I am quites sure that no form
of qualified import works.
However, imports referring to Leo's core from plugins must be
qualified. The easy way is to change
import leoWhatever
to import leo.core.leoWhatever as leoWhatever
The script
Scripts-->@file leoScripts.txt-->Important-->@@button change leo
imports
in scripts.leo does this. It also handles the case when the original
import already has an 'as' clause.
I have converted some, but not all, of the plugins code. We appear to
be very close. The only remaining questions, I think, relate to how
people will invoke Leo.
Edward
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---