PDA

View Full Version : Refreshing lists in a plugin?


sw1tch
2008-09-23, 02:13
Is it possible to load/reload a list without adding history to it? Basically I want:

1) Load a list containing x items
http://img228.imageshack.us/img228/5950/screen1al9.png

2)On clicking an item be shown some actions
http://img204.imageshack.us/img204/3753/screen2sf7.png

3) Upon pressing the action reload the original list.

I've tried having #3 load the plugin (Using RunScript()) with the correct arguments and use the previous handle (from #1), but that does not work due to an 'invalid handle' (I'm probably misunderstanding the purpose of the handle).

What I'm most concerned about is not adding history to the view, so doing 4 deletes would not mean I would need to go back 4 times to get to the main screen.

Can anyone help? If you need code you can see item_list.py and sabnzbd_add.py here (http://sabnzbd.org/switch/misc/SABnzbd-XBMC-Plugin-1.3a.zip)

jmarshall
2008-09-23, 02:27
You can call a built in function Container.Refresh (I think it is) to refresh the list - this may be what you want?

EDIT: Or see the docs:


PyDoc_STRVAR(endOfDirectory__doc__,
"endOfDirectory(handle[, succeeded, updateListing, cacheToDisc]) -- Callback function to tell XBMC that the end of the directory listing in a virtualPythonFolder module is reached.\n"
"\n"
"handle : integer - handle the plugin was started with.\n"
"succeeded : [opt] bool - True=script completed successfully(Default)/False=Script did not.\n"
"updateListing : [opt] bool - True=this folder should update the current listing/False=Folder is a subfolder(Default).\n"
"cacheToDisc : [opt] bool - True=Folder will cache if extended time(default)/False=this folder will never cache to disc.\n"
"\n"
"*Note, You can use the above as keywords for arguments and skip certain optional arguments.\n"
" Once you use a keyword, all following arguments require the keyword.\n"
"\n"
"example:\n"
" - xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False)\n");


Cheers,
Jonathan

sw1tch
2008-09-23, 04:03
Thanks for responding Jonathan.

I couldn't get updateListings to work due to 'handle' issues, however Container.Refresh worked perfectly :D. I didn't see it listed in the wiki but should have had a look at the actual source.