2018-08-06, 22:22
I have a python script add-on based on plugin.video.example. Here I am basically providing a Custom XML page which has different panels and lists. I hide and show panels and lists depending upon what the user is trying to do.
The page in question is much similar to "MyPVRChannels.xml". It has a 'List' for Channels and Each list item has the following type of controls - Labels, Images and progress bar. I'm able to populate all controls (except Progress bar) from Python by creating Properties for each list item as shown below:
list_item = xbmcgui.ListItem(label=row['channelName'])
list_item.setProperty('nowPlaying', row['Title'])
list_item.setProperty('imageUrlForNowPlaying', row['ImageURL'])
and then retrieving those properties in XML file for matching controls:
...
<info>ListItem.Label</info>
...
<info>ListItem.Property("nowPlaying")</info>
...
<info>ListItem.Property("imageUrlForNowPlaying")</info>
But this method does not work for setting the Progress on Progress Bar.
I am able to set the Progress of a Progress bar if it is not a part of the List and instead has a unique control ID. In that case I get the control via its ID and then set Percent as follows:
ctrlProgressBar.setPercent(<intProgressValue>)
I imaging I'll need to do something similar for the progress bar that is inside the list. But the problem is even if I assign it a unique control ID, I will still have multiple controls with that ID.
I tried iterating through the List to get list Item, but once I have list_item it does not have a method called list_item.getControl(ID), so I am not able to directly gain access to the progress bar.
I do see that MyPVRChannel is able to populate the ProgressBar inside the list under the TV channel lineup, so it is possible.
Please advice on how to get access to ProgressBar that is placed inside a List.
Thanks,
The page in question is much similar to "MyPVRChannels.xml". It has a 'List' for Channels and Each list item has the following type of controls - Labels, Images and progress bar. I'm able to populate all controls (except Progress bar) from Python by creating Properties for each list item as shown below:
list_item = xbmcgui.ListItem(label=row['channelName'])
list_item.setProperty('nowPlaying', row['Title'])
list_item.setProperty('imageUrlForNowPlaying', row['ImageURL'])
and then retrieving those properties in XML file for matching controls:
...
<info>ListItem.Label</info>
...
<info>ListItem.Property("nowPlaying")</info>
...
<info>ListItem.Property("imageUrlForNowPlaying")</info>
But this method does not work for setting the Progress on Progress Bar.
I am able to set the Progress of a Progress bar if it is not a part of the List and instead has a unique control ID. In that case I get the control via its ID and then set Percent as follows:
ctrlProgressBar.setPercent(<intProgressValue>)
I imaging I'll need to do something similar for the progress bar that is inside the list. But the problem is even if I assign it a unique control ID, I will still have multiple controls with that ID.
I tried iterating through the List to get list Item, but once I have list_item it does not have a method called list_item.getControl(ID), so I am not able to directly gain access to the progress bar.
I do see that MyPVRChannel is able to populate the ProgressBar inside the list under the TV channel lineup, so it is possible.
Please advice on how to get access to ProgressBar that is placed inside a List.
Thanks,