def setview(self): '''sets the selected viewmode for the container''' xbmc.executebuiltin("ActivateWindow(busydialog)") content_type = get_current_content_type() if not content_type: content_type = "files" current_view = xbmc.getInfoLabel("Container.Viewmode").decode("utf-8") view_id, view_label = self.selectview(content_type, current_view) current_forced_view = xbmc.getInfoLabel("Skin.String(SkinHelper.ForcedViews.%s)" % content_type) if view_id is not None: # also store forced view if (content_type and current_forced_view and current_forced_view != "None" and getCondVisibility("Skin.HasSetting(SkinHelper.ForcedViews.Enabled)")): xbmc.executebuiltin("Skin.SetString(SkinHelper.ForcedViews.%s,%s)" % (content_type, view_id)) xbmc.executebuiltin("Skin.SetString(SkinHelper.ForcedViews.%s.label,%s)" % (content_type, view_label)) self.win.setProperty("SkinHelper.ForcedView", view_id) if not getCondVisibility("Control.HasFocus(%s)" % current_forced_view): xbmc.sleep(100) xbmc.executebuiltin("Container.SetViewMode(%s)" % view_id) xbmc.executebuiltin("SetFocus(%s)" % view_id) else: self.win.clearProperty("SkinHelper.ForcedView") # set view xbmc.executebuiltin("Container.SetViewMode(%s)" % view_id)
def setview(self): '''sets the selected viewmode for the container''' xbmc.executebuiltin("ActivateWindow(busydialog)") content_type = get_current_content_type() if not content_type: content_type = "files" current_view = xbmc.getInfoLabel("Container.Viewmode").decode("utf-8") view_id, view_label = self.selectview(content_type, current_view) current_forced_view = xbmc.getInfoLabel("Skin.String(SkinHelper.ForcedViews.%s)" % content_type) if view_id is not None: # also store forced view if (content_type and current_forced_view and current_forced_view != "None" and xbmc.getCondVisibility("Skin.HasSetting(SkinHelper.ForcedViews.Enabled)")): xbmc.executebuiltin("Skin.SetString(SkinHelper.ForcedViews.%s,%s)" % (content_type, view_id)) xbmc.executebuiltin("Skin.SetString(SkinHelper.ForcedViews.%s.label,%s)" % (content_type, view_label)) self.win.setProperty("SkinHelper.ForcedView", view_id) if not xbmc.getCondVisibility("Control.HasFocus(%s)" % current_forced_view): xbmc.sleep(100) xbmc.executebuiltin("Container.SetViewMode(%s)" % view_id) xbmc.executebuiltin("SetFocus(%s)" % view_id) else: self.win.clearProperty("SkinHelper.ForcedView") # set view xbmc.executebuiltin("Container.SetViewMode(%s)" % view_id)
def get_cur_listitem(cont_prefix): '''gets the current selected listitem details''' if getCondVisibility("Window.IsActive(busydialog)"): xbmc.executebuiltin("Dialog.Close(busydialog)") xbmc.sleep(500) dbid = xbmc.getInfoLabel("%sListItem.DBID" % cont_prefix).decode('utf-8') if not dbid or dbid == "-1": dbid = xbmc.getInfoLabel("%sListItem.Property(DBID)" % cont_prefix).decode('utf-8') if dbid == "-1": dbid = "" dbtype = xbmc.getInfoLabel("%sListItem.DBTYPE" % cont_prefix).decode('utf-8') if not dbtype: dbtype = xbmc.getInfoLabel("%sListItem.Property(DBTYPE)" % cont_prefix).decode('utf-8') if not dbtype: dbtype = get_current_content_type(cont_prefix) return (dbid, dbtype)
def get_cur_listitem(cont_prefix): '''gets the current selected listitem details''' if xbmc.getCondVisibility("Window.IsActive(busydialog)"): xbmc.executebuiltin("Dialog.Close(busydialog)") xbmc.sleep(1000) dbid = xbmc.getInfoLabel("%sListItem.DBID" % cont_prefix).decode('utf-8') if not dbid or dbid == "-1": dbid = xbmc.getInfoLabel("%sListItem.Property(DBID)" % cont_prefix).decode('utf-8') if dbid == "-1": dbid = "" dbtype = xbmc.getInfoLabel("%sListItem.DBTYPE" % cont_prefix).decode('utf-8') if not dbtype: dbtype = xbmc.getInfoLabel("%sListItem.Property(DBTYPE)" % cont_prefix).decode('utf-8') if not dbtype: dbtype = get_current_content_type(cont_prefix) return (dbid, dbtype)
def get_content_type(self, cur_folder, li_label, cont_prefix): '''get contenttype for current folder''' content_type = "" if cur_folder in self.foldercontent: content_type = self.foldercontent[cur_folder] elif cur_folder and li_label: # always wait for the content_type because some listings can be slow for i in range(20): content_type = get_current_content_type(cont_prefix) if self.exit: return "" if content_type: break else: xbmc.sleep(250) self.foldercontent[cur_folder] = content_type self.win.setProperty("contenttype", content_type) return content_type