> 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)
Yeah well this is an even better, and easy thing to accomplish then! Thanks again to Tomas for bringing this concept up! I'm going to have to do this with leojs in the short-middle term anyways! :) So to re-state the concept, (with very loosely defined and half-baked terminology): indeed, Leo could have a third 'mode' where it considers an opened outline, (aka 'commander') as 'remote-server-side-based' ... (the two other 'modes' being. first the "untitled-unsaved" new file, and second a saved file on/from disk ) 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... Although very optimist and simplified scenarios presented here, it's pretty much it ... 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 neede for the nav panel which is almost complete. In the new web client mode of Leo side of things though, some work is to be done too! ...I guess, save and export command intercepts and redirection, along with accepting a whole xml string to replace the whole outline at the hidden root node level. (note: doing this whole outline replace is similar to opening an Leo xml file the normal way, but without all the startup scripts re-running, plugin initialisations and without replacing the state of the find panel, nav tab, etc) I'll leave some time to Thomas to come up with listing other required changes on Leo itself, for it to be run in a 'network-client' mode. Thanks again to both of you for those great ideas and suggestions! :) please comment and correct me as you see fit ! Félix On Friday, March 11, 2022 at 3:33:20 PM UTC-5 Edward K. Ream wrote: > On Fri, Mar 11, 2022 at 1:54 PM [email protected] <[email protected]> > wrote: > >> 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. >> > > Yes, this is what I was thinking when I wrote my initial reply. That is, > we want the desktop version of Leo to be the "client". > > 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/ecec5ed9-7c1d-4cbd-ab08-614f3a025788n%40googlegroups.com.
