Hi, am at home now, so am using Linux, so I know where I stand a little better.
I amended the code as you suggested and it started to load with no errors (well, I had to include "os", but other than that it worked straight away).
...apart from, all I get is a blank (full) screen.
I amended the code as so:
Code:
<window>
<defaultcontrol always="true">201</defaultcontrol>
<animation type="WindowOpen">
<effect type="slide" start="0,-100" time="1500" tween="back"/>
<effect type="fade" start="0" end="90" time="1500"/>
</animation>
<controls>
<!-- HEADER -->
<control type="group" id="201">
<visible>!Skin.String(TabSettings,1)</visible>
<animation effect="fade" time="1500" >VisibleChange</animation>
<control type="image">
<description>Background Image</description>
<width>1024</width>
<height>100</height>
<posx>0</posx>
<posy>0</posy>
<texture>/home/dave/.xbmc/scripts/Control/resources/skins/DefaultSkin/media/high_bar.png</texture>
<colordiffuse>FF000000</colordiffuse>
</control>
</control>
</controls>
</window>
Code:
import xbmcgui
import os
KEY_BUTTON_BACK = 275
KEY_KEYBOARD_ESC = 61467
"""
Problems At The Moment
- Requires the xml to be present in the current running skin (so no way to load a included xml and gfx)
- Currently you can not get ControlList type returned if you do self.getControl(id).
Window.cpp Window_GetControlByID in the switch(pGUIControl->GetControlType()) needs a case for case CGUIControl::GUICONTAINER_LIST: \_
and a matching python type. Making it a ControlList causes access issues
- 'Exiting Problem' if you do use <onclick> in the xml (builtins) [i find u have to activatewindow(13000) 'usually' to show the script again then ESC/BACK to close
"""
"""
xbmcgui.WindowXML()
xbmcgui.WindowXML().onInit(self) Replacement for __init__
xbmcgui.WindowXML().onAction(self,action)
xbmcgui.WindowXML().onClick(self,controlID) Replacement for onControl
xbmcgui.WindowXML().onFocus(self,controlID)
"""
class WindowXML(xbmcgui.WindowXML):
def onInit(self):
"""
This function has been implemented and works
The Idea for this function is to be used to get initial data and populate lists
"""
print "onInit(): Window Initialized"
#self.listctrl = self.getControl(50)
#self.listctrl.addItem("hey")
self.button = self.getControl(2) # Example of getting a control based on ID
self.button.setLabel('Hello 2', 'font14', '0xFFFFFFFF', '0xFFFF3300', '0xFF000000') #
w = WindowXML("/home/dave/.xbmc/scripts/Control/resources/skins/Default/720p/display.xml/display.xml",os.getcwd(), "Default")
def onAction(self, action):
""""
onAction in WindowXML works same as on a Window or WindowDialog its for keypress/controller buttons etc
This function has been implemented and works
"""
buttonCode = action.getButtonCode()
actionID = action.getId()
print "onAction(): actionID=%i buttonCode=%i" % (actionID,buttonCode)
if (buttonCode == KEY_BUTTON_BACK or buttonCode == KEY_KEYBOARD_ESC):
self.close()
def onClick(self, controlID):
"""
onClick(self, controlID) is the replacement for onControl. It gives an interger.
This function has been implemented and works
"""
print "onclick(): control %i" % controlID
if (controlID == 2):
print "Some Control with id 2 was pressed"
pw = WindowXML("/home/dave/.xbmc/scripts/Control/resources/skins/Default/720p/display.xml",os.getcwd(), "Default")
def onFocus(self, controlID):
""""
onFocus(self, int controlID)
This function has been implemented and works
"""
print "onFocus(): control %i" % controlID
if (controlID == 5):
print 'The control with id="5" just got focus'
if __name__ == '__main__':
w = WindowXML("display.xml",os.getcwd(), "Default")
w.doModal()
del w
As you can see, I have changed the path to the xml and images files (I've actually used your images to start with to see if I can get it working) to include their full path in an attempt to get them loaded, but that fails the same as if I left them without the path.