diff --git a/plugin.video.alfa/channels/side_menu.py b/plugin.video.alfa/channels/side_menu.py index ad7faf7c..8f3db2ac 100644 --- a/plugin.video.alfa/channels/side_menu.py +++ b/plugin.video.alfa/channels/side_menu.py @@ -47,25 +47,32 @@ def check_user_home(item): item = Item().fromurl(menu_node['user_home']) else: item = Item(channel="channelselector", action="getmainlist", viewmode="movie") - + from platformcode import platformtools + undefined_start = platformtools.dialog_ok('Inicio Personalizado', 'No has definido ninguna seccion para mostrar ' + 'en tu inicio', 'Utiliza el menu contextual para definir una') return item -def set_home(item): +def set_custom_start(item): logger.info() if os.path.exists(menu_settings_path): menu_node = jsontools.get_node_from_file('menu_settings_data.json', 'menu') + else: + menu_node={} parent_item= Item().fromurl(item.parent) - logger.debug(item) - logger.debug(parent_item) - menu_node['user_home']=item.parent + parent_item.start=True + config.set_setting("custom_start",True) + if config.get_setting("news_start"): + config.set_setting("news_start", False) + menu_node['user_home']=parent_item.tourl() jsontools.update_node(menu_node, 'menu_settings_data.json', "menu") def get_start_page(): logger.info() category = config.get_setting('category').lower() - - if category != 'definido': + custom_start= config.get_setting("custom_start") + #if category != 'definido': + if custom_start == False: item = Item(channel="news", action="novedades", extra=category, mode='silent') else: from channels import side_menu @@ -99,12 +106,13 @@ class Main(xbmcgui.WindowXMLDialog): textcolor = "0xffffd700" shadow = "0xFF000000" offsetx = 30 + offsety = 0 font = 'font32_title' label = 'MenĂº Clasico' self.button_alfa = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, - textOffsetY=-3) + textOffsetY=offsety) self.addControl(self.button_alfa) self.buttons.append(self.button_alfa) @@ -113,7 +121,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_start = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path + selected, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, - textOffsetY=-3) + textOffsetY=offsety) self.addControl(self.button_start) self.buttons.append(self.button_start) @@ -122,7 +130,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_peliculas = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, - shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) + shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety) self.addControl(self.button_peliculas) self.buttons.append(self.button_peliculas) posy += space @@ -130,7 +138,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_series = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, - shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) + shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety) self.addControl(self.button_series) self.buttons.append(self.button_series) posy += space @@ -138,7 +146,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_anime = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, - textOffsetY=-3) + textOffsetY=offsety) self.addControl(self.button_anime) self.buttons.append(self.button_anime) posy += space @@ -146,7 +154,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_infantil = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, - shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) + shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety) self.addControl(self.button_infantil) self.buttons.append(self.button_infantil) posy += space @@ -154,7 +162,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_docu = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path + selected, textColor=textcolor, - shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) + shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety) self.addControl(self.button_docu) self.buttons.append(self.button_docu) posy += space @@ -163,7 +171,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_terror = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, - shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) + shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety) self.addControl(self.button_terror) self.buttons.append(self.button_terror) @@ -172,7 +180,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_lat = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, - textOffsetY=-3) + textOffsetY=offsety) self.addControl(self.button_lat) self.buttons.append(self.button_lat) posy += space @@ -180,7 +188,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_cast = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path + selected, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, - textOffsetY=-3) + textOffsetY=offsety) self.addControl(self.button_cast) self.buttons.append(self.button_cast) posy += space @@ -188,7 +196,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_torrent = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, - shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) + shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety) self.addControl(self.button_torrent) self.buttons.append(self.button_torrent) posy += space @@ -196,7 +204,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_config = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path+selected, textColor=textcolor, - shadowColor=shadow, textOffsetX=offsetx, textOffsetY=-3) + shadowColor=shadow, textOffsetX=offsetx, textOffsetY=offsety) self.addControl(self.button_config) self.buttons.append(self.button_config) @@ -205,7 +213,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_buscar = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path + selected, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, - textOffsetY=-3) + textOffsetY=offsety) self.addControl(self.button_buscar) self.buttons.append(self.button_buscar) posy += space @@ -213,7 +221,7 @@ class Main(xbmcgui.WindowXMLDialog): self.button_actor = xbmcgui.ControlButton(posx, posy, width, height, label, font=font, alignment=0x00000000, noFocusTexture='', focusTexture=media_path + selected, textColor=textcolor, shadowColor=shadow, textOffsetX=offsetx, - textOffsetY=-3) + textOffsetY=offsety) self.addControl(self.button_actor) self.buttons.append(self.button_actor) @@ -261,11 +269,11 @@ class Main(xbmcgui.WindowXMLDialog): search={'url': 'search/person', 'language': 'es', 'page': 1}, star=True) elif control == '': self.close() - if new_item !='' and new_item !='definido': + if new_item !='': self.run_action(new_item) - elif new_item == 'definido': - self.run_action(new_item) - + # elif new_item == 'definido': + # self.run_action(new_item) + def onAction(self, action): if action == ACTION_PREVIOUS_MENU or action == ACTION_GESTURE_SWIPE_LEFT or action == 110 or action == 92: diff --git a/plugin.video.alfa/platformcode/launcher.py b/plugin.video.alfa/platformcode/launcher.py old mode 100755 new mode 100644 index 140c1a56..fc8abc1b --- a/plugin.video.alfa/platformcode/launcher.py +++ b/plugin.video.alfa/platformcode/launcher.py @@ -14,6 +14,7 @@ from core import videolibrarytools from core.item import Item from platformcode import config, logger from platformcode import platformtools +from channelselector import get_thumb @@ -38,17 +39,20 @@ def run(item=None): # If no item, this is mainlist else: - if config.get_setting("custom_menu") == True: - category = config.get_setting("category").lower() - if category != 'definido': + if config.get_setting("start_page"): + + if not config.get_setting("custom_start"): + #if category != 'definido': + category = config.get_setting("category").lower() item = Item(channel="news", action="novedades", extra=category, mode = 'silent') else: from channels import side_menu item= Item() item = side_menu.check_user_home(item) + item.start = True; else: item = Item(channel="channelselector", action="getmainlist", viewmode="movie") - #logger.info(item.tostring()) + logger.info(item.tostring()) try: # If item has no action, stops here @@ -273,6 +277,11 @@ def run(item=None): else: logger.info("Executing channel '%s' method" % item.action) itemlist = getattr(channel, item.action)(item) + # if item.start: + # menu_icon = get_thumb('menu.png') + # menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon, + # title='Menu') + # itemlist.insert(0, menu) platformtools.render_items(itemlist, item) except urllib2.URLError, e: diff --git a/plugin.video.alfa/platformcode/platformtools.py b/plugin.video.alfa/platformcode/platformtools.py index cc67662e..d587183a 100644 --- a/plugin.video.alfa/platformcode/platformtools.py +++ b/plugin.video.alfa/platformcode/platformtools.py @@ -18,6 +18,7 @@ import xbmcgui import xbmcplugin from core.item import Item from platformcode import logger +from channelselector import get_thumb def dialog_ok(heading, line1, line2="", line3=""): @@ -98,6 +99,12 @@ def render_items(itemlist, parent_item): return + if parent_item.start: + menu_icon = get_thumb('menu.png') + menu = Item(channel="channelselector", action="getmainlist", viewmode="movie", thumbnail=menu_icon, + title='Menu') + itemlist.insert(0, menu) + # Si no hay ningun item, mostramos un aviso if not len(itemlist): itemlist.append(Item(title="No hay elementos que mostrar")) @@ -409,12 +416,12 @@ def set_context_commands(item, parent_item): from_channel=item.channel, contextual=True).tourl()))) - + #Definir como Pagina de inicio if item.action not in ['findvideos', 'play']: - context_commands.insert(0, ("[COLOR 0xffccff00]Definir como Inicio[/COLOR]", + context_commands.insert(0, ("[COLOR 0xffccff00]Definir como pagina de inicio[/COLOR]", "XBMC.RunPlugin(%s?%s)" % ( sys.argv[0], Item(channel='side_menu', - action="set_home", + action="set_custom_start", parent=item.tourl()).tourl()))) if item.channel != "videolibrary": diff --git a/plugin.video.alfa/resources/settings.xml b/plugin.video.alfa/resources/settings.xml old mode 100755 new mode 100644 index 7012e369..ae5a6696 --- a/plugin.video.alfa/resources/settings.xml +++ b/plugin.video.alfa/resources/settings.xml @@ -38,11 +38,15 @@ - - - + + + + +