2014-02-04, 07:00
Hi,
I am hoping someone can help with a challenging puzzle. I am in the process of creating an addon that controls INSTEON home automation using XBMC.
This addon is a service, therefore it is constantly running.
I am now looking to create a popup window dialog for my addon (this will allow users to execute predefined INSTEON Scenes from a range of 5 buttons).
This works well, however I really want to be able to open this dialog window with a keyboard shortcut combination. Can anyone point me in the right direction? I believe a major issue is this needs to be available globally throughout XBMC - I do not want it to interfere with basic XBMC functionality.
Is there another way. Open to any and all suggestions. As always, the assistance of the XBMC development community is appreciated.
PS>
I have asked this question here, I apologise for the double post, however I feel it will get lost in the mentioned post and is somewhat off-topic to urllib2 (which is what that post was about), so I moved it here.
I am hoping someone can help with a challenging puzzle. I am in the process of creating an addon that controls INSTEON home automation using XBMC.
This addon is a service, therefore it is constantly running.
I am now looking to create a popup window dialog for my addon (this will allow users to execute predefined INSTEON Scenes from a range of 5 buttons).
Code:
import xbmc,xbmcgui
#get actioncodes from https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/Key.h
ACTION_PREVIOUS_MENU = 10
class MyClass(xbmcgui.WindowDialog):
def __init__(self):
background = xbmcgui.ControlImage(40, 40, 270, 154, 'ContentPanel.png')
self.addControl(background)
self.strActionInfo = xbmcgui.ControlLabel(100, 400, 200, 200, '', 'font13', '0xFFFF00FF')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('')
self.button0 = xbmcgui.ControlButton(42, 42, 270, 30, shortName1)
self.addControl(self.button0)
self.button1 = xbmcgui.ControlButton(42, 72, 270, 30, shortName2)
self.addControl(self.button1)
self.button2 = xbmcgui.ControlButton(42, 102, 270, 30, shortName3)
self.addControl(self.button2)
self.button3 = xbmcgui.ControlButton(42, 132, 270, 30, shortName4)
self.addControl(self.button3)
self.button4 = xbmcgui.ControlButton(42, 162, 270, 30, shortName5)
self.addControl(self.button4)
self.setFocus(self.button0)
self.button0.controlDown(self.button1)
self.button0.controlUp(self.button4)
self.button1.controlUp(self.button0)
self.button1.controlDown(self.button2)
self.button2.controlUp(self.button1)
self.button2.controlDown(self.button3)
self.button3.controlUp(self.button2)
self.button3.controlDown(self.button4)
self.button4.controlUp(self.button3)
self.button4.controlDown(self.button0)
def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
def onControl(self, control):
if control == self.button0:
self.close()
if control == self.button1:
self.close()
if control == self.button2:
self.close()
if control == self.button3:
self.close()
if control == self.button4:
self.close()
mydisplay = MyClass()
mydisplay .doModal()
del mydisplay
This works well, however I really want to be able to open this dialog window with a keyboard shortcut combination. Can anyone point me in the right direction? I believe a major issue is this needs to be available globally throughout XBMC - I do not want it to interfere with basic XBMC functionality.
Is there another way. Open to any and all suggestions. As always, the assistance of the XBMC development community is appreciated.
PS>
I have asked this question here, I apologise for the double post, however I feel it will get lost in the mentioned post and is somewhat off-topic to urllib2 (which is what that post was about), so I moved it here.