On Mon, Jun 22, 2020 at 12:54 PM Félix <[email protected]> wrote:
(multiple opened file support is the last major feature of leointeg to be
> done, the rest is trivial...
>
Really? What about syntax coloring?
So i'm tempted to ask questions instead of studying the problem for a
> longer time because i'm eager to finish! )
>
> ...I start my 'openFile' method in leobridgeserver.py as usual, but I
> added a printout of the g.app.commanders this way...*but the print
> outputs an empty array : [ ]... !*
>
Hmm. g.app.windowList was not populated when using the bridge. But now it
is. See below.
Here is my test file, in c:\test\bridgeTest.py:
import leo.core.leoBridge as leoBridge
import leo.core.leoGlobals as g
path = r'c:\leo.repo\leo-editor\leo\core\LeoPyRef.leo'
assert g.os_path_exists(path)
controller = leoBridge.controller(gui='nullGui',
loadPlugins=False, # True: attempt to load plugins.
readSettings=True, # True: read standard settings files.
silent=False, # True: don't print signon messages.
verbose=False) # True: print informational messages.
g = controller.globals()
c = controller.openLeoFile(path)
g.printObj(g.app.windowList, tag='g.app.windowList')
g.printObj(g.app.commanders(), tag='g.app.commanders()')
You can run this directly from python, or from this Leo script:
path = r'c:\test\bridgeTest.py'
assert g.os_path_exists(path)
g.executeFile(path)
A cff shows that only qtFrame.finishCreate appends 'self' to
g.app.windowList. Let's have nullFrame do the same. In NullFrame.ctor I
added these lines:
# Leo 6.3: support for leoInteg.
g.app.windowList.append(self)
Well, that failed (details omitted). Boo hoo.
Let's try setting g.app.windowList in leoBridge.openLeoFile:
c = self.createFrame(fileName) # existing code
# Leo 6.3: support leoInteg.
g.app.windowList.append(c.frame)
Success! Now the test program prints:
g.app.windowList:
[
<leo.core.leoFrame.NullFrame object at 0x0000022C4166E608>
]
g.app.commanders():
[
Commander 2389099200456: 'c:/leo.repo/leo-editor/leo/core/LeoPyRef.leo'
]
The new code is at rev 3f19711 in devel.
I'm still trying to untangle the concepts of window, frame, commander ...
> they're all somewhat synonyms in my mind
>
They are not synonyms, but they are interconnected.
Commanders always exist. A commander represents all the data of an outline
(.leo file).
c.frame is the (gui) frame associated with the commander/outline/.leo file.
Window is a gui-only concept. You can forget about it.
*Summary*
leoBridge.openLeoFile now supports leoInteg by setting g.app.windowList,
thereby also causing c.commanders() to return the list commanders opened by
the bridge.
Note 1: Closing a commander will *not* update g.app.windowList. Indeed, the
bridge has no closeLeoFile method. That may not actually be a problem. I
don't see any reason ever to close a .leo file in the bridge.
Note2: leoBridge.openLeoFile will return an already-open commander if it
has been opened previously. Closing the commander would interfere with this.
HTH.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/1fc6463e-1761-4760-994d-b57e47d73736o%40googlegroups.com.