Edward,

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.buttonsDict

for 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.buttonsDict
w_button = None
for w_key in w_dict:
if(str(w_key) == w_index):
w_button = w_key
w_button.command() # run clicked button command
return self.outputPNode(self.commander.p) # return selected node when done

Yes, it's a cowboy implementation and i should have had protected some of 
those lines with "if's" and try/catch blocks.

imma clean it up a bit and push back to dev in a few minutes. 

--
Félix (i'm home now)


On Saturday, July 11, 2020 at 12:33:02 PM UTC-4, Félix wrote:
>
> 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'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)
>
>

-- 
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/be0e0b0c-14fa-40ad-a155-a302a32592a9o%40googlegroups.com.

Reply via email to