WindowXML GUI Toolkit (replaces GUIBuilder for XBMC python scripts for GUI coding)

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
matthuisman Offline
Skilled Python Coder
Posts: 600
Joined: Sep 2006
Reputation: 5
Location: Chch, New Zealand
Post: #121
I also struck a similar problem. My problem also occurs allot more on the xbox than on the PC (memory problem?). It's when I add list items like you have, but I am using two methods of adding them, one is to add them to the top of the list, and the other is to add them to the bottom of the list - this problem annoyed me so much it ended my creative spree :-(

It appears to fail when used in a loop (multiple items being added), but not just when one item is added.
find quote
Basje Offline
Skilled Python Coder
Posts: 1,108
Joined: Jul 2005
Reputation: 6
Post: #122
stanley87 Wrote:I also struck a similar problem. My problem also occurs allot more on the xbox than on the PC (memory problem?). It's when I add list items like you have, but I am using two methods of adding them, one is to add them to the top of the list, and the other is to add them to the bottom of the list - this problem annoyed me so much it ended my creative spree :-(

It appears to fail when used in a loop (multiple items being added), but not just when one item is added.

Although it is not great that something like this is happening, I am glad to hear I am not the only one experiencing the problem. The only thing that we need is a solution. Does this problem sound familiar to one of the Devs?

find quote
donno Offline
Team-XBMC Python Developer
Posts: 130
Joined: Jan 2005
Reputation: 0
Location: Australia
Post: #123
@Nuka1195
I think on
As for getListSize(), the reason i didn't go with getSize is little bit ambious what it means, after all its a WindowXML, 'getSize implies it gets the size of the window' hence why i chose getListSize(), most the other stuff is getCurrentListPosition and getListItem. Ideally i would have pefered something like self.list.addItem() etc (where list is like a 'controlwindowlist' thats automatically part of the WindowXML like the Smile otehr methods. The idea would be controlwindowlist ineheirt ControlList and overwrite the methods to provide the infomation from the 'window lists', but i wasn't sure about that.

I tried labeling most the 'WindowList' specific stuff with the 'List' in the name, plus then u don't get confused and think self is suddenly an actual list control.

My getListItem changes are in rev 9223, and few others things are different there as well.

Basje) i don't get an exception like that on XBMC_PC, yet to try my new script on XBOX with WindowXML Smile. (i had an older one taht used WindowXML and creates listitems/ on screen fine.

Both my scripts uses a loop to create items from an array Smile
I might be able to release the new script as a new demo. (part of a bigger script i want to redo Smile

** Team XBMC Tester** XBMC 4 ever

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Basje Offline
Skilled Python Coder
Posts: 1,108
Joined: Jul 2005
Reputation: 6
Post: #124
donno Wrote:@Nuka1195
Basje) i don't get an exception like that on XBMC_PC, yet to try my new script on XBOX with WindowXML Smile. (i had an older one taht used WindowXML and creates listitems/ on screen fine.

It only happens like once every 50 lists I try to fill on my XBMC_PC, but once very 10 lists on XBMC. The first is acceptable, but the latter is much to frequent.

find quote
matthuisman Offline
Skilled Python Coder
Posts: 600
Joined: Sep 2006
Reputation: 5
Location: Chch, New Zealand
Post: #125
Basje, my problem has now fixed in REV 9286.
GIVE IT A TRY! :-D
find quote
Basje Offline
Skilled Python Coder
Posts: 1,108
Joined: Jul 2005
Reputation: 6
Post: #126
stanley87 Wrote:Basje, my problem has now fixed in REV 9286.
GIVE IT A TRY! :-D

I saw the changelog and will do a build tomorrow. I will let you know the results.

find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #127
Some tips for using non-native controls in WindowXML.

1. wrap the control in a group. This allows setting it visible or hidden.
2. use xbmc.executebuiltin( "Skin.SetString(setting-name,setting-value") ) for any info you need to change(e.g.<info>Skin.String(AMT-thumbfolder)</info> for a multiimage control)
3. to use a media panel control. make sure you have a media list control and always reference the media list control for getListItem() and things.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #128
The getPosition() python method returns what the controls <posx>, <posy> tags are for a list control.

If the control is inside a group when the group has it's own <posx> or <posy>, or if there is a coordinates system. It does not take that into account.

Is thers a way to return the actual position?

I need the actual position to center a context menu.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,228
Joined: Oct 2003
Reputation: 177
Post: #129
Not at this point, no.

One way to do it would be to:

1. Grab controls position.

2. Iterate up through it's parents and add their positions.

3. Finally, add the window's position (may not be it's GetPosition() stuff due to conditional origins!)

Alternatively you could implement a CGUIWindow::GetControlPosition(id) routine that does the same thing but in a different way:

1. Iterate through controls. If the id matches, we return it's position + the window position.

2. Else, if it's a group, we call the groups' GetControlPosition function.

3. Once we have a position, we return it.

It's similar to how the mouse handling works (See FocusFromPoint and UnfocusFromPoint).

This will give you the position in the window's XML resolution coordinates relative to the screen. It's probably what you want, but may not be if the context menu's dialog was in a different coordinate system (unlikely though).

Cheers,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #130
[quote]It's probably what you want, but may not be if the context menu's dialog was in a different coordinate system (unlikely though)./QUOTE]

I can adjust in the context_menu.xml. That never occured to me. Since it's the same skin, won't be an issue. I didn't realize the coordinates was used if I set the position from python.

Thanks it works perfect, Smile

I still like being able to grab the actual position, so maybe I'll see what I can do.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,228
Joined: Oct 2003
Reputation: 177
Post: #131
Note also, that any animations affect the final on-screen position, and these are only known at render time.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
mrz Offline
Senior Member
Posts: 105
Joined: Apr 2005
Reputation: 0
Location: Stockholm
Post: #132
To me it looks as if there is a problem with the radiobutton control. Once a radiobutton have been fouces all on... functions halts (or reponds very slowly). The workaround is to instead combine button and checkmark. Im on SVN9530 but earlier versions have the same problem.
Xbmcgui never supported radiobuttons so it could be that WindowXML should not either

MrZ
find quote
Basje Offline
Skilled Python Coder
Posts: 1,108
Joined: Jul 2005
Reputation: 6
Post: #133
Hi there,

is there anyway to switch lists via Python? I have two lists with different graphics with ID 50 and 51. How can I change from list 50 to 51 via my pythonscript?

find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #134
you need the reserved button with id=2. Don't do anything with it in code it will keep track and switch views of the lists between 50-59.

One thing I don't know why it does this, but after playing a video, when you return to the script, list 50 is viewable again. Maybe a skinning issue on my part, maybe because my other controls between 50-59 are not native python controls. They are wraplists and panels.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Basje Offline
Skilled Python Coder
Posts: 1,108
Joined: Jul 2005
Reputation: 6
Post: #135
Nuka1195 Wrote:you need the reserved button with id=2. Don't do anything with it in code it will keep track and switch views of the lists between 50-59.

One thing I don't know why it does this, but after playing a video, when you return to the script, list 50 is viewable again. Maybe a skinning issue on my part, maybe because my other controls between 50-59 are not native python controls. They are wraplists and panels.
But then the views can only be switched using the button? I would like to be able to set the view from within the script. The user should not be able to switch manually. Is that possible?

find quote
Post Reply