-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise the client/server protocol #178
Comments
This is similar to a capability I came up with in a non-Leo program. A whole lot of commands are triggered by pushbuttons. The child window that has the buttons is almost entirely independent, except for having a reference to the dispatcher located in its parent window. When a button is pressed in the child window, its callback sends back to the dispatcher a string which is the lookup name for the real method. The dispatcher has a lookup table - a dict, of course, being Python - to dispatch the actual method. Neither the parent nor the child need to know anything about how the other one implements any of the details. They only need to know how to send/receive the right string. It works great for my application, it should work just as well for Leo. |
Done in dev :) |
See Leo PR: #2095.
Background
This problem appeared while working on #173. Imo, the problem can not be fixed in leoserver.py. The client/server protocol must be changed.
At present, server.get_all_leo_commands returns a lists of dictionaries, each of the form:
However, for
@command
or@button
scripts, the func_name will be the name of a callback function, which in effect is an anonymous function! The horrendous details are in sc.registerAllCommands (in mod_scripting.py) and also in the AtButtonCallback class, instances of which are (iirc) essentially fancy callbacks.Proposal
Discussion
ekr-server-protocol branch contains the new version of leoserver.py. See PR #2095.
The leoInteg minibuffer already shows command names, not function names, so very little in leoInteg will have to change.
Summary
server.get_all_leo_commands will supply only command names. The names of anonymous callback functions are useless!
See the docstring of server._do_message for the new protocol.
The text was updated successfully, but these errors were encountered: