When developing a Komodo extension, say i have this:
<command id="Tasks:HelloWorld" oncommand=""/>
How can I set
oncommand to say the function
also, how do I activate a popup menu such as:
I pretty sure that you CAN’T use Python functions or anything else written in Python in your add-on without making an UDL and accessing it via JS.
Oh, that’s OK, I’m better with JS anyway(I just wanted to be able to use a python wrapper around a REST API). Is there a way I can use a function from an external script file?
Not sure what do you mean by “external script file”. You can download it locally and just use it (via
<script>). But if your script is a part of some cool API (not sure what the correct name for that type of the API, but probably it’s a remote SDK or something like that when you include the script and just use objects and functions from that to access to the API, yes?) - I don’t know because I never tried to do that. Just try what you want and describe the result!
Cool, now the last I need to know are
- How to activate that popup menu
- Do you know of any good reference for xul layout and such. It would help if it were tainted toward Komodo.
In order to access Python from XUL/JS you would have to build your own XPCOM component, for reference you can check here: https://github.com/Komodo/KomodoEdit/tree/master/src/components
I would not recommend this unless you are doing stuff that specifically requires Python or is very process intensive.
See the relevant documentation here: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/menupopup#m-openPopup
A good way of finding documentation is to do a google search prefixed with
mdn xul, eg.
mdn xul menupopup is how I found the documentation link above.
Should all UI be done in the overlay file?
Depends on what you’re doing. If you’re injecting XUL into an existing XUL document then you’d probably just be using the overlay, yes.