2011-11-17, 20:09
Well I took a look in Dragonwin's context menu stuff, and I have questions.. hopefully he shows up again!
I'm probably not going to be able to explain this properly.. but I'll give it a go
In his helper function used to create a contextmenu list object, what is done limits what kind of menu items you can create, I'm also confused on the purpose of 'newlist'
If newlist=True then you are creating a menu item with a function of 'XBMC.Container.Update' ... I'm not sure what this does or the use, I assumed it refreshed your current list (?)
If newlist=False then you create one with a xbmc.RunPlugin which so far for me is the most common type I've been using... eg. calling mine or another addon with a set of query strings (see my test meta addon how I do meta refresh and watched status)
Going in I would have assumed that newlist meant that the menu items will replace the standard menu items xbmc gives... but doesn't seem to be the case and I don't see a way in his code to turn that option on - very good chance that I'm missing something
To replace the context menu you do this:
But.. what if I want to do a different function that is not XBMC.RunPluggin or xbmc.Container.Update? Doesn't look like I can..
eg. In Icefilms to add an item to display the Info screen:
So.. it would be nice if Dragonwin could come back to help out on this, if not then I think it might be best to drop the helper function and just let a list item get passed into add_directory() and add_video_item() along with a boolean for replaceitems
Contextmenu support should be on any directory or video/music item
eg.
I'm probably not going to be able to explain this properly.. but I'll give it a go
In his helper function used to create a contextmenu list object, what is done limits what kind of menu items you can create, I'm also confused on the purpose of 'newlist'
Code:
def create_contextmenu(self, menuname, scriptargs,
newlist=False, contextmenuobj=''):
...
...
if not contextmenuobj:
contextmenuobj = []
if newlist:
contextmenuobj.append((menuname, u'XBMC.Container.Update(%s?%s)' %
(self.url, scriptargs)))
else:
contextmenuobj.append((menuname, u'XBMC.RunPlugin(%s?%s)' %
(self.url, scriptargs)))
return contextmenuobj
If newlist=True then you are creating a menu item with a function of 'XBMC.Container.Update' ... I'm not sure what this does or the use, I assumed it refreshed your current list (?)
If newlist=False then you create one with a xbmc.RunPlugin which so far for me is the most common type I've been using... eg. calling mine or another addon with a set of query strings (see my test meta addon how I do meta refresh and watched status)
Going in I would have assumed that newlist meant that the menu items will replace the standard menu items xbmc gives... but doesn't seem to be the case and I don't see a way in his code to turn that option on - very good chance that I'm missing something
To replace the context menu you do this:
Code:
listitem.addContextMenuItems(contextmenuobj, replaceItems=True)
But.. what if I want to do a different function that is not XBMC.RunPluggin or xbmc.Container.Update? Doesn't look like I can..
eg. In Icefilms to add an item to display the Info screen:
Code:
contextMenuItems.append(('Show Information', 'XBMC.Action(Info)'))
So.. it would be nice if Dragonwin could come back to help out on this, if not then I think it might be best to drop the helper function and just let a list item get passed into add_directory() and add_video_item() along with a boolean for replaceitems
Contextmenu support should be on any directory or video/music item
eg.
Code:
def add_directory(self, queries, title, img='', fanart='',
total_items=0, is_folder=True, contextmenuobj='', contextreplace=False):
...
...
if contextmenuobj:
listitem.addContextMenuItems(contextmenuobj, replaceItems=contextreplace)