2014-11-23, 20:18
Hi there,
after searching hours on the internet, I still don't get it. I found posts that seemed to match my current problem but after having a closer look the problems they had mostly had to deal with wrong xml implementation. They also had relating messages in the log, which I don't have.
What I try to do:
Creating an WindowXMLDialog in an video addon => Done, will be displayed properly, "lorem ipsum" is autoscrolling, window looks as wished
Changing the content of an control element to make things more dynamic => Ends up in control is non-existent, makes me mad
However, heres the xml of my guitest addon:
Here is the default.py implementation:
Here is the result in the xbmc log:
As said I have no errors saying the xml is not valid or anything else. I hope someone can help me finding out why i cannot reference the textbox element of the xml. Hopefully its just a stupid mistake by myselt
Thanks for any hint
after searching hours on the internet, I still don't get it. I found posts that seemed to match my current problem but after having a closer look the problems they had mostly had to deal with wrong xml implementation. They also had relating messages in the log, which I don't have.
What I try to do:
Creating an WindowXMLDialog in an video addon => Done, will be displayed properly, "lorem ipsum" is autoscrolling, window looks as wished
Changing the content of an control element to make things more dynamic => Ends up in control is non-existent, makes me mad
However, heres the xml of my guitest addon:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol always="true">11</defaultcontrol>
<coordinates>
<system>1</system>
<left>10</left>
<top>10</top>
</coordinates>
<include>dialogeffect</include>
<controls>
<control type="image">
<left>0</left>
<top>0</top>
<width>1270</width>
<height>700</height>
<texture border="40">DialogBack.png</texture>
</control>
<control type="image">
<description>Dialog Header image</description>
<left>40</left>
<top>16</top>
<width>1270</width>
<height>40</height>
<texture>dialogheader.png</texture>
</control>
<control type="label" id="1">
<description>header label</description>
<left>40</left>
<top>20</top>
<width>1270</width>
<height>30</height>
<font>font13_title</font>
<label>Details zum Film</label>
<align>center</align>
<aligny>center</aligny>
<textcolor>selected</textcolor>
<shadowcolor>black</shadowcolor>
</control>
<control type="button">
<description>Close Window button</description>
<left>1190</left>
<top>15</top>
<width>64</width>
<height>32</height>
<label>-</label>
<font>-</font>
<onclick>PreviousMenu</onclick>
<texturefocus>DialogCloseButton-focus.png</texturefocus>
<texturenofocus>DialogCloseButton.png</texturenofocus>
<onleft>10</onleft>
<onright>10</onright>
<onup>10</onup>
<ondown>10</ondown>
<visible>system.getbool(input.enablemouse)</visible>
</control>
<control type="textbox" id="9988">
<description>moviedescription</description>
<left>30</left>
<top>60</top>
<width>1200</width>
<height>100</height>
<align>left</align>
<label>This is a textbox with autoscroll[CR][CR]Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</label>
<font>font13</font>
<autoscroll time="3000" delay="4000" repeat="5000">true</autoscroll>
</control>
</controls>
</window>
Here is the default.py implementation:
Code:
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# Movie4k
# Version 1.0.2
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
#------------------------------------------------------------
import xbmc
import xbmcplugin
import xbmcaddon
import xbmcgui
import os
import sys
import datetime
import urlparse
import urllib2
#get actioncodes from https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/Key.h
ACTION_PREVIOUS_MENU = 10
ACTION_SELEC_ITEM = 7
# Eleement IDs
MY_DESCRIPTION = 9988
# Plugin Info
ADDON_ID = 'plugin.video.guitest2'
REAL_SETTINGS = xbmcaddon.Addon(id=ADDON_ID)
ADDON_ID = REAL_SETTINGS.getAddonInfo('id')
ADDON_NAME = REAL_SETTINGS.getAddonInfo('name')
ADDON_PATH = REAL_SETTINGS.getAddonInfo('path')
ADDON_VERSION = REAL_SETTINGS.getAddonInfo('version')
xbmc.log(ADDON_ID +' '+ ADDON_NAME +' '+ ADDON_PATH +' '+ ADDON_VERSION)
SkinMasterPath = os.path.join(ADDON_PATH, 'skins' ) + '/'
MySkinPath = (os.path.join(SkinMasterPath, '720p')) + '/'
MySkin = 'mygui.xml'
class MyFirstWinXML(xbmcgui.WindowXMLDialog):
def __new__(cls):
return super(MyFirstWinXML, cls).__new__(cls, "mygui.xml", ADDON_PATH)
def __init__(self):
super(MyFirstWinXML, self).__init__()
def mySetLabelText(self, MyText):
self.getControl(MY_DESCRIPTION).setLabel(MyText)
xbmc.log("MySkin is: " + MySkin)
mydisplay=MyFirstWinXML()
mydisplay.mySetLabelText("Text is now differen[CR]The quick brown fox jumps over the lazy dog![CR]The quick brown fox jumps over the lazy dog!")
mydisplay.doModal()
Here is the result in the xbmc log:
Code:
19:10:57 T:140092425709312 NOTICE: MySkin is: mygui.xml
19:10:57 T:140092425709312 ERROR: EXCEPTION: Non-Existent Control 9988
19:10:57 T:140092425709312 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.RuntimeError'>
Error Contents: Non-Existent Control 9988
Traceback (most recent call last):
File "/home/kbox/.xbmc/addons/plugin.video.guitest2/default.py", line 50, in <module>
mydisplay.mySetLabelText("Text is now differen[CR]The quick brown fox jumps over the lazy dog![CR]The quick brown fox jumps over the lazy dog!")
File "/home/kbox/.xbmc/addons/plugin.video.guitest2/default.py", line 46, in mySetLabelText
self.getControl(MY_DESCRIPTION).setLabel(MyText)
RuntimeError: Non-Existent Control 9988
-->End of Python script error report<--
As said I have no errors saying the xml is not valid or anything else. I hope someone can help me finding out why i cannot reference the textbox element of the xml. Hopefully its just a stupid mistake by myselt
Thanks for any hint