(2015-03-08, 15:57)sualfred Wrote: (2015-03-08, 13:27)Jeroen Wrote: Haven't tested, but you could experiment with these as additional onclick actions
Container.Refresh Refresh current listing.
Container.Update Update current listing. Send Container.Update(path,replace) to reset the path history.
Also fighting it.
These commands do their job on a library view very well but not on my dynamic lists widgets.
The only dirty and ugly workaround I found is to place conditions like that in the home.xml header:
<onload condition="Window.Previous(Visualisation)">XBMC.ReloadSkin()</onload>
<onload condition="Window.Previous(FullscreenVideo)">XBMC.ReloadSkin()</onload>
Edit:
Read the complete thread again, this is working:
(2014-05-03, 16:44)`Black Wrote: This should work:
PHP Code:
#Home window
<onload>SetProperty(RefreshList,1,Home)</onload>
#Content
<content>$VAR[PlaylistPath]</content>
#Path Variable
<variable name="PlaylistPath">
<value condition="!Window.IsVisible(3050)">path_to_playlist</value>
</variable>
#Custom window
<?xml version="1.0" encoding="UTF-8"?>
<window type="dialog" id="3050">
<allowoverlay>no</allowoverlay>
<onload>ClearProperty(RefreshList,Home)</onload>
<visible>!IsEmpty(Window(Home).Property(RefreshList))</visible>
<animation effect="fade" start="100" end="0" time="0" delay="5">WindowClose</animation>
<controls></controls>
</window>
That way the path gets changed on window load which triggers a refresh. Clearing the property just after setting it in onload doesn't work because it happens in the same frame so the application will not notice the change. Since AlarmClock doesn't work with ms, you need the custom window unless you can live with a 1 second delay.
I plan to add a reload function for the container which will make it much easier to manually trigger an update.
"I plan to add a reload function for the container which will make it much easier to manually trigger an update."
Has this "reload function" to manually trigger a refresh of the list ever come to see the light? I have a dynamic list using the content tag below.
Code:
<content>plugin://plugin.audio.pandoki/</content>
which on window load gives me a list that comes from the code below.
Code:
def Dir(self, handle):
self.Login()
ic = Val('icon')
li = xbmcgui.ListItem('New Station ...')
li.setIconImage(ic)
li.setThumbnailImage(ic)
xbmcplugin.addDirectoryItem(int(handle), "%s?search=hcraes" % _base, li)
for s in self.Sorted():
li = xbmcgui.ListItem(s['title'], s['token'])
if self.station == s: li.select(True)
art = Val("art-%s" % s['token'])
if not art: art = s.get('art', ic)
li.setProperty( "stationId", s['id'] )
li.setIconImage(art)
li.setThumbnailImage(art)
title = asciidamnit.asciiDammit(s['title'])
rurl = "RunPlugin(plugin://%s/?%s)" % (_id, urllib.urlencode({ 'rename' : s['token'], 'title' : title }))
durl = "RunPlugin(plugin://%s/?%s)" % (_id, urllib.urlencode({ 'delete' : s['token'], 'title' : title }))
surl = "RunPlugin(plugin://%s/?%s)" % (_id, urllib.urlencode({ 'thumb' : s['token'], 'title' : title }))
li.addContextMenuItems([('Rename Station', rurl),
('Delete Station', durl),
('Select Thumb', surl), ])
burl = "%s?%s" % (_base, urllib.urlencode({ 'play' : s['token'] }))
xbmcplugin.addDirectoryItem(int(handle), burl, li)
xbmcplugin.endOfDirectory(int(handle), cacheToDisc = False)
Log("Dir OK %4s" % handle)
It gives me a list of Pandora radio stations. If I use the context menu to delete a station, it runs the code to delete the station below.
Code:
def Delete(self, token):
if (self.station) and (self.station['token'] == token): self.station = None
self.Stations()
station = self.pithos.delete_station(token)
Log('Delete ', station, xbmc.LOGNOTICE)
xbmc.executebuiltin("Container.Refresh")
However, after deleting the station, the list doesn't refresh and show without the deleted station unless I close and open the window to trigger a reload of the content.
I would think that the "xbmc.executebuiltin("Container.Refresh")" on the last line would refresh the list after deleting but it doesn't. I have tried adding a button on the window with an onclick coded from python...
Code:
def onClick(self, controlID):
if controlID == 559:
xbmc.executebuiltin("Container.Update(plugin://plugin://plugin.audio.pandoki/)")
#also tried...
xbmc.executebuiltin("Container.Update(plugin://plugin://plugin.audio.pandoki/),replace")
xbmc.executebuiltin("Container.Refresh(plugin://plugin://plugin.audio.pandoki/)")
But nothing I try works. Anybody know how I can accomplish how to trigger a list refresh after deleting a station? Thanks.