2011-05-08, 23:49
Hello everybody.
I'm trying to develop a script that starts automatically and handles all "ACTION_TOGGLE_WATCHED" actions, to move the watched item into a separate folder on the filesystem.
I looked up the codes in the Key.h sourcefile. However so far I've been unsuccessful in handling any actions at all.
The following code is from two examples in docu.
I tried putting the onAction function into the class, but then the script wouldn't run at all. If I moved the onAction function into the class and removed the __init__ method, then the modal window would be nonresponsive to any input.
What am I doing wrong ? Am I going about this all wrong ?
Cheers
I'm trying to develop a script that starts automatically and handles all "ACTION_TOGGLE_WATCHED" actions, to move the watched item into a separate folder on the filesystem.
I looked up the codes in the Key.h sourcefile. However so far I've been unsuccessful in handling any actions at all.
The following code is from two examples in docu.
Code:
# import the XBMC libraries so we can use the controls and functions of XBMC
import xbmc, xbmcgui
# name and create our window
class BlahMainWindow(xbmcgui.Window):
# and define it as self
def __init__(self):
# add picture control to our window (self) with a hardcoded path name to picture
self.addControl(xbmcgui.ControlImage(0,0,720,480, '/tmp/Piracy.jpg'))
def onAction(self,action):
xbmcgui.Dialog().ok("Message",str(action))
# store our window as a short variable for easy of use
W = BlahMainWindow()
# run our window we created with our background jpeg image
W.doModal()
# after the window is closed, Destroy it.
del W
What am I doing wrong ? Am I going about this all wrong ?
Cheers