How to set default view type in XBMC lists?
Domanda
I am currently programming in python for XBMC, I found that an end user can change the view type of the list by using the left arrow and switching through the different available options. Is there a way I can specify in the source code which should be the default list view type?
Soluzione
You can switch the view type with this code:
import xbmc
xbmc.executebuiltin('Container.SetViewMode(%d)' % view_mode_id)
where view_mode_id needs to be the integer ID of the desired view type. For a thumbnail-like view in most of skins you need to use 500.
You should execute this command after adding ListItems and before calling endOfDirectory().
Altri suggerimenti
I assume you talk about a list shown in the GUI where an user could choose between various list items. Setting a default value is done by defining a default value in the specific part of the UI xml definitions.
An example:
<setting label="31100"
id="ui_monitor"
type="labelenum"
lvalues="31110|31120"
default="31110" />
In this case the list contains two entries, 31110 and 31120, while 31110 is the default and preselected value for that specific list.