v19 An addon script that creates its own keyboard mapping?
#3
(2020-07-06, 12:03)black_eagle Wrote:
(2020-07-06, 00:05)ThumbOne Wrote: The question is, given how cumbersome this extra install effort is, can the addon use a setting (in settings.xml) that defines a key, to add it to the keymap itself (and change it if the setting changes)?

If you mean, can the addon be modified to use a setting to define a key and then place that keymapping into the keymap file then my answer would be yes, that's possible.  You would need to translate the path from a Kodi internal path to a system path (so as to stay cross-platfrom) with something like xbmc.translatePath('special://userdata/keymaps/keyboard.xml') then use xbmc.vfs to check if the file exists, open it, parse the xml and see if your keymap already exists.  If yes, has setting changed?  Add keymap to file if necessary and re-write the file out.

Probably more work than editing the keymap file directly though Wink
Interesting. Would changing the keymap file have immediate effect on the running instance of Kodi?

Parsing XML isn't hard in Python. And the setting could be a string field and there could be an Action field that runs the script to do the XML seek, parse, rewrite.

Easier to do by hand, sure. But not professional. If I want to share this script with others, I like to think on its settings you could type a key code into a box, press a button and have that key sequence registered to launch the script. In fact this seems essential to me fro all scripts. The only other way I know to run the script is to navigate a pile f menus to find it and run it. Admittedly fewer menus in Chorus and Kore (where the keymap wont apply anyhow, so that's a good thing). But in the Kodi UI, if you have a script you want to use a lot, you need to map it to a keystroke IMHO.
Reply


Messages In This Thread
RE: An addon script that creates its own keyboard mapping? - by ThumbOne - 2020-07-06, 13:28
Logout Mark Read Team Forum Stats Members Help
An addon script that creates its own keyboard mapping?0