Kodi Community Forum
WindowXML GUI Toolkit (replaces GUIBuilder for XBMC python scripts for GUI coding) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: WindowXML GUI Toolkit (replaces GUIBuilder for XBMC python scripts for GUI coding) (/showthread.php?tid=24839)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


- Nuka1195 - 2007-05-08

Hi Donno,

A couple of things:

1. Can the force_fallback, force the media folder in the default skin to be used also, as it should with the xml?

2. Maybe not an issue with WindowXML, I'm not sure. The following code works fine:

Code:
import xbmc, xbmcgui
import os
class GUI( xbmcgui.WindowXML ):
    def __init__( self, *args, **kwargs ):
        self.videoplayer_resolution = int( xbmc.executehttpapi( "getguisetting(0,videoplayer.displayresolution)" ).replace("<li>","") )

    def onInit( self ):
        self._change_resolution()

    def _change_resolution( self ):
        print self.videoplayer_resolution
        xbmc.executehttpapi( "SetGUISetting(0,videoplayer.displayresolution,%d)" % ( self.videoplayer_resolution, ) )

ui = GUI("httptest.xml", os.getcwd().replace(";",""),"Default", True)
ui.doModal()
del ui

But in real life I have other things going on from onInit() and calling "xbmc.executehttpapi( "SetGUISetting(0,videoplayer.displayresolution,%d)" % ( self.videoplayer_resolution, ) )" before onInit() finishes causes a lockup. I haven't been able to track down the conflict, since it works fine with the above code it may not be related.

Could we have another event OnWindowLoaded() <- not sure if that's the correct event though, but something after onInit(). This may not solve my issue though.

Edit: Another issue, the object count label id="12", when setting the list id="50" invisible and visible, sometimes the labels count is one less than it should be.

Edit2: <info>Listitem.Icon</info> doesn't seem to work for separate cimage controls, unless I'm doing something wrong. I set the list id="50" to have an image with Listitem.icon.

Code:
<control type="image" id="201">
   <description>Trailer Poster</description>
   <posx>520</posx>
   <posy>120</posy>
   <width>170</width>
   <height>250</height>
   <info>Listitem.Icon</info>
   <aspectratio>keep</aspectratio>
   <visible>Control.IsVisible(50)</visible>
  </control>

  <control type="list" id="50">
   <posx>190</posx>
   <posy>100</posy>
   <width>485</width>
   <height>425</height>
   <onleft>9000</onleft>
   <onright>60</onright>
   <onup>50</onup>
   <ondown>50</ondown>
   <viewtype label="535">list</viewtype>
   <pagecontrol>60</pagecontrol>
   <scrolltime>200</scrolltime>
   <include>contentpanelslide</include>
   <itemlayout height="29">
    <control type="image">
     <posx>5</posx>
     <posy>3</posy>
     <width>22</width>
     <height>22</height>
     <info>ListItem.Icon</info>
    </control>
    <control type="label">
     <posx>30</posx>
     <posy>3</posy>
     <width>430</width>
     <height>22</height>
     <font>font13</font>
     <aligny>center</aligny>
     <include>listselectedcolor</include>
     <align>left</align>
     <info>ListItem.Label</info>
     <visible>!Container.Sort(SongRating)</visible>
    </control>
    <control type="label">
     <posx>475</posx>
     <posy>3</posy>
     <width>300</width>
     <height>22</height>
     <font>font13</font>
     <aligny>center</aligny>
     <include>listselectedcolor</include>
     <textcolor>60ffffff</textcolor>
     <align>right</align>
     <info>ListItem.Label2</info>
     <visible>!Container.Sort(SongRating)</visible>
    </control>
    <control type="label">
     <posx>30</posx>
     <posy>3</posy>
     <width>345</width>
     <height>22</height>
     <font>font13</font>
     <aligny>center</aligny>
     <include>listselectedcolor</include>
     <align>left</align>
     <info>ListItem.Label</info>
     <visible>Container.Sort(SongRating)</visible>
    </control>
    <control type="image" id="1">
     <description>Song Rating Image</description>
     <height>21</height>
     <width>121</width>
     <posx>380</posx>
     <posy>4</posy>
     <info>listitem.rating</info>
     <aspectratio>stretch</aspectratio>
     <texture flipx="true" />
     <visible>Container.Sort(SongRating)</visible>
    </control>
   </itemlayout>
   <focusedlayout height="29">
    <control type="image">
     <width>485</width>
     <height>29</height>
     <posx>0</posx>
     <posy>0</posy>
     <visible>Control.HasFocus(50)</visible>
     <texture>list-focus.png</texture>
    </control>
    <control type="image">
     <posx>5</posx>
     <posy>3</posy>
     <width>22</width>
     <height>22</height>
     <info>ListItem.Icon</info>
    </control>
    <control type="label">
     <posx>30</posx>
     <posy>3</posy>
     <width>430</width>
     <height>22</height>
     <font>font13</font>
     <aligny>center</aligny>
     <include>listselectedcolor</include>
     <align>left</align>
     <info>ListItem.Label</info>
     <visible>!Container.Sort(SongRating)</visible>
    </control>
    <control type="label">
     <posx>475</posx>
     <posy>3</posy>
     <width>300</width>
     <height>22</height>
     <font>font13</font>
     <aligny>center</aligny>
     <include>listselectedcolor</include>
     <textcolor>60ffffff</textcolor>
     <align>right</align>
     <info>ListItem.Label2</info>
     <visible>!Container.Sort(SongRating)</visible>
    </control>
    <control type="label">
     <posx>30</posx>
     <posy>3</posy>
     <width>345</width>
     <height>22</height>
     <font>font13</font>
     <aligny>center</aligny>
     <include>listselectedcolor</include>
     <align>left</align>
     <info>ListItem.Label</info>
     <visible>Container.Sort(SongRating)</visible>
    </control>
    <control type="image" id="1">
     <description>Song Rating Image</description>
     <height>21</height>
     <width>121</width>
     <posx>380</posx>
     <posy>4</posy>
     <info>listitem.rating</info>
     <aspectratio>stretch</aspectratio>
     <texture flipx="true" />
     <visible>Container.Sort(SongRating)</visible>
    </control>
   </focusedlayout>
  </control>



- donno - 2007-05-10

1. Can the force_fallback, force the media folder in the default skin to be used also, as it should with the xml?
No. XBMC afaik won't let you do this.
SOLUTION: name the media for bonus skins and the default skin UNQUIE names like the background other then backgorund.png so it doesn't conflict with that name in any skin.

2.
__init__ is called when the python object is constructors.
OnInit is called when teh Application/Window/Message Manger in XBMC picks up a Window_INIT case. im sure this is after the Load(xml) has been called and after OnWindowLoaded.

As for Another issue, the object count label id="12", when setting the list id="50" invisible and visible, sometimes the labels count is one less than it should be. if u can track it down

as for the <info>Listitem.Icon</info> , not really sure. Simpley don't have time to look into it now.


- Nuka1195 - 2007-05-10

1. I figured you were going to say that Smile Only an issue for custom skins and they can use unique names.

2. Ok, might be something else conflicting anyways.

3. I'll just use my own and set the value.

4. Ok, again I'll just setImage() manually.


- jmarshall - 2007-05-10

Regarding OnInitWindow/OnWindowLoaded:

The process is as follows for the base class CGUIWindow

1. The GUI_MSG_WINDOW_INIT message is sent from the window manager to the window.

2. It calls AllocResources() which then calls Load() if the window XML is not already loaded.

3. Load() then calls OnWindowLoaded() before exitting.

4. OnInitWindow() is then called at the end of the GUI_MSG_WINDOW_INIT handler.

As for the ListItem.Icon, that looks like it's probably an issue with the window not returning the listitem information to the infomanager. Does ListItem.Label work outside the list?

Cheers
Jonathan


- Nuka1195 - 2007-05-11

Hi,

None of the ListItem.* work for the media list.

About the executehttp, there may be other issues with that command.

Edit: I'm also getting intermitten lockups after a movie plays and it returns to the script. I have two controls id="50" is a list and id="51" is a panel. This works, I can select a movie to play from the panel, but when the movie ends and returns back to the script, the list is visible not the panel. Since there is no panel control in python maybe that's why?

Quote:19:48:08 M: 20652032 NOTICE: CDVDPlayer::CloseFile()
19:48:08 M: 20652032 NOTICE: DVDPlayer: waiting for threads to exit
19:48:08 M: 20652032 NOTICE: DVDPlayer: finished waiting
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: CApplication::Render(), too many exceptions
19:48:08 M: 16842752 FATAL: EXCEPTION_ACCESS_VIOLATION (0xc0000005)
at 0x001f0332



- Nuka1195 - 2007-05-12

Another WindowXML Bug or Python scrollbar bug?

The x factor does not work for a scrollbar in python/windowxml.

It works fine for an image control.

<animation effect="zoom" end="231,115,250,250" time="0" condition="Control.IsVisible(50)">Conditional</animation>


- donno - 2007-05-13

could be that python has no panel. but still the viewControl should still be set for what ever u left it at weather that was a normal control or a panel, python its self doesn't need to change the focus or what visiblities. Sad intresting problem,


- Nuka1195 - 2007-05-13

So does that mean your looking into it?

If I start a movie from the panel, when it returns it does not lock.

If I start a movie from the list(a python native control), it locks on return.

Even though this doesn't work properly, I'm going to tag AMT and commit this, then if you want to look at it great.

I need a long break from this stuff.


- mrz - 2007-05-16

Hi donno!
Firstly a big thank you for this excellent new capability. I'm currently updating my DagensTV script using WindowXML.
I found a minor bug;- if executing self.getFocus() while a scrollbar is in focus generates "unknown control type for python".
Then a suggestion;- linking a control for control within the script e.g self.getControl(id), would it be tricky to allow names like self.getControl('My special button') maybe by utilizing the description field.

Thanks again,

MrZ


- Nuka1195 - 2007-05-16

Quote:
Then a suggestion;- linking a control for control within the script e.g self.getControl(id), would it be tricky to allow names like self.getControl('My special button') maybe by utilizing the description field.

Just set variables at the top of your script or inside the windowxml class.

CONTROL_MY_SPECIAL_BUTTON = 100

self.getControl( CONTROL_MY_SPECIAL_BUTTON ).setLabel("ok")

remember inside the class, you'll need to add "self."


- Basje - 2007-05-17

I have question regarding the order in which the media files are found.

I have a script which folder looks like this:

Script folder: Q:\scripts\Uitzendinggemist
Skin folder: Q:\scripts\Uitzendinggemist\skins\Project Mayhem III\
Skin file: Q:\scripts\Uitzendinggemist\skins\Project Mayhem III\pal\progwindow.xml
Skin media folder: Q:\scripts\Uitzendinggemist\skins\Project Mayhem III\media\

Now in the media folder is a file: 1on.png. it is in the xml file like this:
Code:
<control type="button" id="101">
    <!-- Do NOT remove. This control is needed by the script -->
    <description>Nederland 1</description>
    <visible>true</visible>
    <posx>0</posx>
    <posy>120</posy>
    <width>60</width>
    <height>60</height>
    <onleft>50</onleft>
    <onright>50</onright>
    <onup>106</onup>
    <ondown>102</ondown>
    <aligny>center</aligny>
    <texturefocus>1on.png</texturefocus>
    <texturenofocus>1off.png</texturenofocus>
</control>

Now on my XBMC (both PC and real XBox) this goes fine. But some people actually get these errors:
Code:
21:29:26 M: 36941824   ERROR: Texture manager unable to load file: Q:\skin\Project Mayhem III\media\1on.png
So it seems that it cannot find the file? Because it is looking in the wrong folder.

So my question is: how does windowxml look for it's files? Does it default to the main Q:\Skins\Project Mayhem III\media\ folder and then, if the file is not found, it searches Q:\scripts\Uitzendinggemist.v2\skins\Project Mayhem III\media\?

And, is there anyway to have this reversed? First look into the Q:\scripts\Uitzendinggemist.v2\skins\Project Mayhem III\media\ then in the Q:\Skins\Project Mayhem III\media\?

(if somebody wants the complete script to see if more is wrong, please visit http://www.rieter.net/uitzendinggemist/ )


- mrz - 2007-05-18

Nuka1195, agreed thats one way to do it. I think we both can agree that the code gets much more readable when using names instead of IDs. If joins by name was possible you could skip the constants.

Found a second bug.
If you have some controls in the XML file and then add some at runtime these new controls will collide with and therefor be treated like the reserved ones. For example ID 2 is the view button, ID 3 is sort and so on.
You can work arround this by adding 59 dummy controls and the delete them. In my mind self.addControl() should not use these reserved IDs.


- mrz - 2007-05-18

Hi Basje!

I had the same problem until I upgraded to XBMC-SVN_2007-05-14_rev8943-T3CH.rar found herehttp://217.118.215.116/


- Nuka1195 - 2007-05-18

mrz, guibuilder can use description as a key, but you would be missing some functionality that windowXML has.

<description> will not be used for id's in WindowXML, either use constants or assign each control to a dictionary, where you can use descriptions.

The conflicting controls is a issue that needs resolved.

Donno, with the latest commit of ControlGroup, did you forget the xbmcguimodule.cpp file, as it's not reference anywhere in that file.


- mrz - 2007-05-18

Nuka1195 thanks for the clarification.
Regarding the cpp that's not me.