How to 'close' an opened leo file within leoBridge?

66 views
Skip to first unread message

Félix

unread,
Nov 26, 2019, 4:31:23 PM11/26/19
to leo-editor
leoBridge gives back a commander upon opening a leo file. This is great.

But now I want ot offer the possibility to Close a leo file. (to subsequently open another)

I know i can open more than one, and I might offer that possibility of having multiple leo files opened (selectable via tabs, or whatever) but for now I'd like to support having only one opened leo file at a time, and so I'd like to know how to 'close' a leo file.

Thanks in advance! 
--
Félix

P.S. Going to merge all the new dev stuff from the last 2 months into master this week and make a post explaining all the new stuff. Stay Tuned! 

Edward K. Ream

unread,
Nov 27, 2019, 6:16:05 AM11/27/19
to leo-editor
On Tuesday, November 26, 2019 at 3:31:23 PM UTC-6, Félix wrote:

leoBridge gives back a commander upon opening a leo file. This is great.

But now I want...to Close a leo file. (to subsequently open another)

After:

controller = leoBridge.controller(...)
g
= controller.globals()
c
= controller.openLeoFile(path)

c is a Commander object.  Just call c.close()

You can have multiple commanders open at once:

commanders = [controller.openLeoFile(z) for z in paths]

Edward

Félix

unread,
Nov 27, 2019, 9:22:52 AM11/27/19
to leo-editor
Thanks ! Why didI just not tried it!?  Maybe I did not look at the right place. I was trying to find if the 'close' method was callable on a commander. Exactly what I needed!

Edward K. Ream

unread,
Nov 27, 2019, 5:22:18 PM11/27/19
to leo-editor


On Wed, Nov 27, 2019 at 8:22 AM Félix <felix...@gmail.com> wrote:
Thanks !

You're welcome.
Why didI just not tried it!?  Maybe I did not look at the right place. I was trying to find if the 'close' method was callable on a commander. Exactly what I needed!

Glad to hear it.

Edward
Reply all
Reply to author
Forward
0 new messages