--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/lbrgq0YBG-0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/7b202db9-8d4f-430f-84c4-8c4bebdbe7d4n%40googlegroups.com.
just to reiterate, leoserver can run on another computer on lan or even wan. just start it with command line argument of file you want open , and you can connect to it from any computer on network. (of course for now only client that exist is leointeg but i just wanted to clarify)
So really, I need a Leo client...I wonder if there's an almost-no-effort solution lurking here (apart from running leointeg on the remote machine, I mean).
...Perhaps the remote Leo needs only two new commands:
1: get a remote outline by name and2: save the remote outline (possibly with another name)
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.
–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?
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.
> That is, we want the desktop version of Leo to be the "client".Oh! I get it now!
> That is, we want the desktop version of Leo to be the "client".Oh! I get it now! - (I thought Thomas was thinking about writing a Leo-dumb-terminal client (à la leointeg) in python with Qt5/Qt6/tcl-tk or some other gui framework)
Throwing ideas here:1- i like the idea of openFileViaServer(host_address, file_path) , there also could be a connectToServer(host_address) which might just connect and present the currently opened files on the server as opened files in the leo "Client"... as if opened with "openFileViaServer", in that new 'remote-server-side-based' mode.
2-Like Thomas stated, the files operations have to be intercepted. for example, a save command needs to be intercepted and instead sent as a sequence of two server commands : send-outline-to-server and save-outline. (those methods names are not definitive and just brainstorming here) Another example, the server detects a file change (either derived external file or the leo file itself), so it send the alert-websocket-package to ask the user dialog: 'external file changed, reload?' if so, the client sends it's accepting packet and the server sends back a new model of the outline...
in conclusion, the server needs only, as a preliminary estimate, two new methods: copy_root and paste_root_as_clone to replace the whole of it's outline. Some kind of whole outline + body transfer method instead of the existing 'partial' transfer methods like regular copy and paste outline.
other methods such as open_outline(path), save to file, etc.. are all already in place in the server. I'll write those methods this week as I finish the server modifications needed for the nav panel which is almost complete.
Edward
It seems to me that almost everything we need already exists except for the actual acquire-from-the-leoserver. part.
And the new (very simpleminded) leoserver command is:
I'd like to open a Leo outline that is on another computer - strictly within my home LAN. I could do that by sharing a directory and putting the outline into that directory. But I'd rather have that outline be in its intended place on the drive, not in some other shared directory.