It seems to me that this is the simplest thing that could possibly work: Write a new Leo method: openFileViaServer(host_address, file_path)
1. The command on the remote computer sends an open file request to a leoserver instance on the host machine. 2. The server sends back the requested outline, wrapped in a server data package. 3. The remote Leo instance unpacks the outline and creates a new commander for it. Saving the file would require another, complementary save command. Actually, since I'm thinking here of only sending an outline, I suppose that any file server would do. We don't really need to open the outline on the host machine. But why not use leoserver, since it is at hand? With this technique, an open instance of Leo on the host machine wouldn't know that the file is being edited on the remote. For my limited use case, that is probably OK since I presumably wouldn't be changing the outline on both machines at the same time. If the same outline were open in a Leo instance on the host computer, then it would notice when the file on disk has been changed and put up the usual dialog asking if it should reload the outline. This is just how things work with leointeg (or used to - maybe Felix has changed it by now). I think that's acceptable. On Thursday, March 10, 2022 at 10:20:42 PM UTC-5 [email protected] wrote: > So here is my first question. In the linked docs: > > "leoserver.py has optional command line arguments that you can provide to > get specific behaviors from the server. > > *–file <filename> or -f <filename>* > > Open the given file after starting the server." > > What does it mean for leoserver to "open a file"? Does this mean, for > example, that an outline that *seems to be* open in vsc is not really? > Does it mean that any operation that vsc or Leo does to the file is > actually performed by leoserver? Or is leoserver relaying instructions to > the outline's commander in Leo (that is, in the nullgui instance of Leo > that the Bridge has instantiated)? And if this latter is so, then isn't > the outline "open" in the commander rather than leoserver? > > On Thursday, March 10, 2022 at 10:11:54 PM UTC-5 [email protected] wrote: > >> Thanks, @Felix. I thought it was obvious that leoserver *could* play the >> role we needed. After all, if it can connect Leo and Leo outlines to >> vscode, why not to another Leo instance instead of a vsc instance? I >> didn't know, though, what changes, if any, would be needed to let Leo play >> that role, nor how to configure any of it. I'll look at the docs you link >> to and see if I can make some progress. >> >> On Thursday, March 10, 2022 at 8:55:31 PM UTC-5 Félix wrote: >> >>> *@Thomas*, Thanks for the details given! Now I understand. (I wasn't >>> sure i understood your main inquiry/request because that's already >>> implemented and working in leoserver, so I thought: "i'm probably not >>> understanding what he's trying to do if he needs something different") >>> >>> So yeah, leoserver already is capable of multiuser, simultaneous >>> connections to work on the SAME leobridge instance running in leoserver. To >>> try it out, you'll have to use leointeg to connect to it, *or take the >>> time to implement a new client* :) hehe! >>> >>> This server feature is obviously useful for two main usages, first, to >>> work on the same Leo file(s) in multiple client window (instead of each >>> having it's own independent leoserver) the second, obviously, is sharing an >>> open leoserver instance running live to multiple window/people on different >>> computers on a network (lan or internet) - because leoserver accepts >>> clients and does not know nor differentiate if they're on localhost, or on >>> the other side of the planet. >>> >>> Take a look a this section of the leoserver documentation for the >>> details to allow multiple connections: >>> >>> *https://leoeditor.com/leoserver.html#multiple-concurrent-connections >>> <https://leoeditor.com/leoserver.html#multiple-concurrent-connections>* >>> >>> Of course, when editing, the leoserver sends 'refresh' notice events to >>> the other connected clients so that they update their UI, so that all >>> editing and changes are reflected 'live' in all other connected clients. >>> allowing for "multiuser LIVE editing sessions" >>> >>> On the other hand, I hope to finish squashing the remaining leointeg >>> bugs, and adding some more features so that people (like you ;) ) who still >>> prefer the original Leo, to eventually switch to using leointeg, altough *I >>> dont >>> blame you: the refreshing bug that happens when expanding/collapsing nodes >>> of big outlines is pretty annoying.* Good news is I've already made a >>> new outline renderer in leojs, which does not have those bugs, and is much >>> more fast and responsive, so I'll duplicate that new framework to leointeg >>> in the following months when I've gotten leojs up to a particular point. >>> >>> Anyways Thomas i want to thank you very much for considering and having >>> interest in those matters! I hope you try it out first with leointeg as >>> client, just to check if it works with that as a first step, before >>> endeavoring in writing a new client with qt/tcltk/or some other python gui >>> framework. You are one of the best and promordial Leointeg tester ! so >>> thanks again for that! >>> >>> *@Edward* Those 2 features are going to be needed sooner than later. so >>> I'll gladly add them to the server even tho it's not needed for now in the >>> particular case Thomas was inquiring about. (but like i said, it might be >>> useful for leojs or some other clients that want to change/set/reset the >>> whole outline at once.) >>> >>> Please Don't hesitate to ask more about any aspect, or to correct me if >>> you think i'm wrong on something! :) >>> >>> Félix >>> >>> On Thursday, March 10, 2022 at 6:11:09 AM UTC-5 Edward K. Ream wrote: >>> >>>> >>>> >>>> On Wed, Mar 9, 2022 at 7:29 PM Félix <[email protected]> wrote: >>>> >>>> > In my mind, the new functions it would need are rather: >>>>> >>>>> 1-get a leo file over the wire as a string in a json package, (sent >>>>> from local clients filesystem to the remote server's) almost akin to a >>>>> 'paste as root node' >>>>> 2- maybe a "copy root node" (whole outline) - to mirror #1 in opposite >>>>> direction to save modifications. >>>>> >>>> >>>> Thanks for these comments. >>>> >>>> I have just created #2475 >>>> <https://github.com/leo-editor/leo-editor/issues/2475> for this >>>> project. As noted in the issue itself, I would like to delegate this >>>> project to you and Thomas. It might be good for you two to zoom to compare >>>> notes. >>>> >>>> As an experiment in delegating work, I would rather stay out of the >>>> loop :-) Thomas is the one who wants this feature, and you are the expert >>>> in leoserver.py. Of course, I'll be willing to help as needed. >>>> >>>> What do you two think? >>>> >>>> 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/1a857460-7d51-47e2-84e6-ae370c828515n%40googlegroups.com.
