add possibility to set the view_mode via "plugin.add_items(items, view_mode)" #7

Merged
merged 1 commit into from Apr 11, 2012
Jump to file or symbol
Failed to load files and symbols.
+3 −1
Split
View
@@ -190,7 +190,7 @@ def _make_listitem(self, label, label2='', iconImage='', thumbnail='',
#return li
return options['url'], li, options.get('is_folder', True)
- def add_items(self, iterable):
+ def add_items(self, iterable, view_mode=None):
# If we are in debug mode, do not make the call to xbmc
# for each item
# if in debug mode, print it to command line
@@ -217,6 +217,8 @@ def add_items(self, iterable):
if self._mode is 'xbmc':
if not xbmcplugin.addDirectoryItems(self.handle, items, len(items)):
raise Exception, 'problem?'
+ if view_mode:
+ xbmc.executebuiltin('Container.SetViewMode(%s)' % view_mode)
xbmcplugin.endOfDirectory(self.handle)
return urls