How to add Remote button Feature to My addon? (Please Read Full)
#1
textline = 'Key Pressed'
xbmcgui.Dialog().ok(__addonname__, textline)

Assume this is the code... On Kodi Android Box Have Buttons... I have the video addon...

So I need to When I press any button (For Example if I press OK Button) Then wanna run this Top Code...

Any Help Please?
Reply
#2
if i understand it correctly, you want to map a button on your remote to run the script above.
you would need to create a custom keymap: http://kodi.wiki/view/HOW-TO:Modify_keyboard.xml
and add something like:
Code:
<keymap>
  <global>
    <remote>
      <enter>RunScript(script.yourscript)</enter>
    </remote>
  </global>
</keymap>
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
(2015-12-21, 13:21)ronie Wrote: if i understand it correctly, you want to map a button on your remote to run the script above.
you would need to create a custom keymap: http://kodi.wiki/view/HOW-TO:Modify_keyboard.xml
and add something like:
Code:
<keymap>
  <global>
    <remote>
      <enter>RunScript(script.yourscript)</enter>
    </remote>
  </global>
</keymap>

No no not this one...

if action == ACTION_PREVIOUS_MENU

Like this one... Is this only works on a Class?

On tutorial have like this

Code:
ACTION_PREVIOUS_MENU = 10

class MyClass(xbmcgui.Window):
  def onAction(self, action):
    if action == ACTION_PREVIOUS_MENU:
      self.close()
mydisplay = MyClass()
mydisplay .doModal()
del mydisplay
Reply
#4
yup, you can only catch key presses in one of these classes:
xbmcgui.Window
xbmcgui.WindowDialog
xbmcgui.WindowXML
xbmcgui.WindowXMLDialog
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
Mmmm catch key presses means?
Reply
#6
(2015-12-21, 14:15)bloodhod Wrote: Mmmm catch key presses means?

It means that the classes listed above have the event loop that is activated via doModal() method. This event loop catches key actions (a key is pressed) and control events (a UI control is activated) via onAction and onControl methods respectively.
Reply
#7
http://mirrors.xbmc.org/docs/python-docs...w-onAction
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
How to add Remote button Feature to My addon? (Please Read Full)0