Also, on a similar topic, leobridgeserver is meant to be agnostic and reused by anyone who wants to 'talk' to, or control leo via http websockets. So I wouldn't even say all that interaction with leo is 'vscode' specific.
I'll perfect it some more, and reconsider later if it should just be part of Leo instead of leoInteg.
Felix (on mobile, so no accent in the e)
I'm just learning about those @buttons by reading the mod_scripting 'readme' and trying to bring'em into leoInteg :
...
I'm also reading about the @button having to be in a setting file or a @setting node ? but that would be to make them 'global' in all opened files if I got it right...?
To shed some light on my implementation, here are the few lines it took on the leo/python side of things:def getButtons(self, p_package):'''Gets the currently opened file's @buttons list'''w_buttons = []w_dict = self.commander.theScriptingController.buttonsDictfor w_key in w_dict:w_entry = {"name": w_dict[w_key], "index": str(w_key)}w_buttons.append(w_entry)return self.sendLeoBridgePackage("buttons", w_buttons)def clickButton(self, p_package):'''Handles buttons clicked in vscode from the '@button' panel'''w_index = p_package['index']w_dict = self.commander.theScriptingController.buttonsDictw_button = Nonefor w_key in w_dict:if(str(w_key) == w_index):w_button = w_keyw_button.command() # run clicked button commandreturn self.outputPNode(self.commander.p) # return selected node when done
b = self.iconBar.add(text=truncatedText, command=command, kind=kind)
if not b:
return Noneself.iconBar = c.frame.getIconBarObject()Yes, it's a cowboy implementation and i should have had protected some of those lines with "if's" and try/catch blocks.
Edward, I need more time and better comprehension of Leo's code in order to answer you question about a vscode gui. The way I see it, nullgui is perfectly fine.
Also, on a similar topic, leobridgeserver is meant to be agnostic and reused by anyone who wants to 'talk' to, or control leo via http websockets. So I wouldn't even say all that interaction with leo is 'vscode' specific.
I didn't mention it last night, but the dev branch now has right-click on @buttons to remove them, but finding their 'source' node was not available on the 'button' object kept in the button dict. unless i'm mistaken. I'll put this feature on the no-rush-todo list for now. :)