re-use skins windows from python
#1
Hello everybody

I was thinking reusing a XBMC native window for the purpose of my plugin 'my pictures database'.
The goal is to reuse the 'smartplaylisteditor' window, set the strings I need everywhere (as for example, I don't need the choice of music/videos for the type, but pictures instead)
I think the idea is to call a windowXMLdialog with SmartPlayListEditor.xml.
I'm able to show the window, to cache some actions and some controls, but can't change anything
This is my starting idea :
Code:
class GUI(xbmcgui.WindowXMLDialog):
    def __init__(self,*args, **kwargs):
        xbmcgui.WindowXML.__init__( self, *args, **kwargs )
        pass
    
    def onInit(self):
        print "= STARTING SMARTALBUM ="
        self.getControl(22).Label("test")

    def onAction(self, action=None):
        #here I often got errors with a simple print command
        #so I wrote a print into a try/except
        try:
            print "..."#action
        except:
            #print "exception raised by the script :"
            #print print_exc()
            return
        print "> action=%s"%action.getId()
        print "<-"
        #Close the script
        if action == ACTION_PREVIOUS_MENU :
            print "= QUITTING SMARTALBUM ="
            self.close()

    def onFocus(self,param):
        print "> focus=%s"%param
        print dir(self.getFocus(param))
        print self.getFocus(param).getSelectedItem()
        print "<-"

    def onClick(self, controlID):
        print "> onclick=%s"%controlID
        print "<-"


ui = GUI('SmartPlaylistEditor.xml', os.getcwd(), forceFallback=True)
import time
ui.doModal()
del ui

Does someone have an idea ?
Reply
#2
it's possible off course - for starter - replace
Code:
self.getControl(22).Label("test")
with
Code:
self.getControl(22).setLabel("test")
Reply
#3
oups... Sad you're right ! But it doesnt change anything...

It looks like my onInit just execute the first command...
If I write :
Code:
def onInit(self):
    print "1"
    print "2"
then only "1" is written to the log...
Reply

Logout Mark Read Team Forum Stats Members Help
re-use skins windows from python0