Posts: 1,466
Joined: Jul 2005
Reputation:
29
Basje
Team-Kodi Member
Posts: 1,466
Today I noticed that the lists in my WindowXML scripts are clearing out by them self.
I have two windows (1 and 2, both WindowXML) with each one list (List A and B). At some point I hide list A in window 1 (only the list). Then I show window 2 with list B. Finally I close window 2 again and go back to window 1. At this point List A is still hidden. When I unhid it (set it visible) the list seems to have cleared!
Check my XOT-Uzg script: select a channel, select a program and then scroll through the episodes. Then go back to the program list (that one is still filled, but it isn't a windowxml list), go back again and you end up with an empty list where the channels should have been.
I checked the debug log file of XBMC, but I cannot see any errors related to this. Anyone a clue?
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Whenever a window is closed the list is freed. Thus, setup your list whenever you initialize the window in onInit. This ensures that you always end up with what you want.
Posts: 3,909
Joined: Dec 2004
Reputation:
20
Nuka1195
Skilled Python Coder
Posts: 3,909
this is the way it works now. just store your info, then call your function to fill the list. the alternative is make the second window a dialog.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
If you open a second window then the first is closed, unless the second is a dialog.
Cheers,
Jonathan
Posts: 1,466
Joined: Jul 2005
Reputation:
29
Basje
Team-Kodi Member
Posts: 1,466
Oke, I am modifying my scripts to work with these changes, but the more I work with it the less I understand this move in clearing the lists.
Example: Lets say I have list with a lot of video items. I scrolled down a to the 32nd, or whatever item, and click it to start playback. When the playbacks stops I end up at the same window, but the list is empty. To me, that is not logical.
Of course I could reload the list, but then I also need to restore the selected position (else the user needs to scroll down again). But is the list was long, it will take some time every time it is done.
That is a lot of work for a change in the XBMC source code. Was there a reason to do this? The moving of the skin fallback folder I understand, but this? May I ask the reason for doing this?
Posts: 26,215
Joined: Oct 2003
Reputation:
187
You shouldn't need to restore the position - XBMC does that for you, assuming the list is up at the appropriate time. There's currently some problems as we don't wait on python to process stuff - this means that if python's onInit() is executed slowly, then some things may start rendering before it's ready.
The reason the change was made is to bring it inline with the rest of the code. All XBMC windows do this. It has some obvious advantages:
1. Less memory used.
2. Makes sure that the list is always free'd when the script exits.
3. No need to keep a "first loaded" state to handle what to do in onInit().
Obviously all consideration will be made into making it easy for scripters.
Perhaps Nuka1195 can indicate how he handles things in AMT?
Cheers,
Jonathan