Fix Menu Rapido

This commit is contained in:
Alhaziel01
2021-01-08 10:06:53 +01:00
parent 8cbb109c01
commit b492a2bd71
3 changed files with 56 additions and 50 deletions
+6 -5
View File
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from builtins import map from builtins import map
import sys, xbmc, xbmcaddon, xbmcgui, base64, json, os, re import xbmc, xbmcaddon, xbmcgui, os
from threading import Timer from threading import Timer
from platformcode import config, logger, platformtools, launcher from platformcode import config, logger, platformtools, launcher
from core import filetools
from core.item import Item from core.item import Item
import channelselector import channelselector
addon_icon = os.path.join( config.__settings__.getAddonInfo( "path" ),'resources', 'media', 'logo.png' ) addon_icon = filetools.join( config.__settings__.getAddonInfo( "path" ),'resources', 'media', 'logo.png' )
background = 'FF232323' background = 'FF232323'
text = 'FFFFFFFF' text = 'FFFFFFFF'
@@ -130,7 +131,7 @@ class Main(xbmcgui.WindowXMLDialog):
item.setProperty('channel', menuentry.channel) item.setProperty('channel', menuentry.channel)
item.setProperty('focus', '0') item.setProperty('focus', '0')
item.setProperty('thumbnail', menuentry.thumbnail) item.setProperty('thumbnail', menuentry.thumbnail)
if menuentry.channel in ['news', 'channelselector', 'search', 'videolibrary', 'favorites']: if menuentry.channel not in ['downloads', 'setting', 'help']:
item.setProperty('sub', 'true') item.setProperty('sub', 'true')
item.setProperty('run', menuentry.tourl()) item.setProperty('run', menuentry.tourl())
itemlist.append(item) itemlist.append(item)
@@ -141,7 +142,7 @@ class Main(xbmcgui.WindowXMLDialog):
if control_id in [1, 2]: if control_id in [1, 2]:
action = self.getControl(control_id).getSelectedItem().getProperty('run') action = self.getControl(control_id).getSelectedItem().getProperty('run')
self.close() self.close()
if self.getControl(control_id).getSelectedItem().getProperty('folder') == 'False': if Item().fromurl(action).folder == False:
xbmc.executebuiltin('RunPlugin("plugin://plugin.video.kod/?' + action + '")') xbmc.executebuiltin('RunPlugin("plugin://plugin.video.kod/?' + action + '")')
else: else:
xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.kod/?' + action + '")') xbmc.executebuiltin('ActivateWindow(10025, "plugin://plugin.video.kod/?' + action + '")')
@@ -180,7 +181,7 @@ class Main(xbmcgui.WindowXMLDialog):
if channel_name == 'channelselector': if channel_name == 'channelselector':
import channelselector import channelselector
itemlist = self.menulist(channelselector.getchanneltypes()) itemlist = self.menulist(channelselector.getchanneltypes())
elif channel_name in ['news', 'channelselector', 'search', 'videolibrary', 'favorites']: elif channel_name not in ['downloads', 'setting', 'help']:
channel = __import__('specials.%s' % channel_name, fromlist=["specials.%s" % channel_name]) channel = __import__('specials.%s' % channel_name, fromlist=["specials.%s" % channel_name])
itemlist = self.menulist(channel.mainlist(Item().fromurl(self.MENU.getSelectedItem().getProperty('run')))) itemlist = self.menulist(channel.mainlist(Item().fromurl(self.MENU.getSelectedItem().getProperty('run'))))
self.SUBMENU.reset() self.SUBMENU.reset()
+36 -25
View File
@@ -89,6 +89,18 @@
<aspectratio>keep</aspectratio> <aspectratio>keep</aspectratio>
<align>center</align> <align>center</align>
</control> </control>
<control type="textbox">
<description>Selected Item</description>
<left>0</left>
<top>180</top>
<width>100%</width>
<height>40</height>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Label]</label>
<align>center</align>
<aligny>center</aligny>
</control>
</focusedlayout> </focusedlayout>
</control> </control>
@@ -126,36 +138,35 @@
<aspectratio>keep</aspectratio> <aspectratio>keep</aspectratio>
<align>center</align> <align>center</align>
</control> </control>
<control type="textbox">
<description>Selected Item</description>
<left>0</left>
<top>180</top>
<width>100%</width>
<height>40</height>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Label]</label>
<align>center</align>
<aligny>center</aligny>
</control>
</focusedlayout> </focusedlayout>
</control> </control>
</control> </control>
<control type="textbox">
<description>Selected Item</description>
<left>0</left>
<top>280</top>
<width>100%</width>
<height>40</height>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Label]</label>
<align>center</align>
<aligny>center</aligny>
</control>
<control type="button" id='101'> <control type="button" id='101'>
<visible>!String.IsEmpty(Container(1).ListItem.Property(sub)) + !Control.HasFocus(2) + !Control.HasFocus(102)</visible> <visible>!String.IsEmpty(Container(1).ListItem.Property(sub)) + !Control.HasFocus(2) + !Control.HasFocus(102)</visible>
<animation effect="fade" start="0" end="100" time="200" reversible="true" condition="Control.IsVisible(101)">Conditional</animation> <animation effect="fade" start="0" end="100" time="200" reversible="true" condition="Control.IsVisible(101)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,0)">Conditional</animation> <!-- <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,0)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,1)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,1)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,2)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,2)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,3)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,3)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,4)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,4)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,5)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,5)">Conditional</animation> -->
<left>90</left> <left>520</left>
<top>180</top> <top>240</top>
<width>40</width> <width>60</width>
<height>40</height> <height>60</height>
<texturefocus colordiffuse="Container(1).ListItem.Property(text)">down.png</texturefocus> <texturefocus colordiffuse="Container(1).ListItem.Property(text)">down.png</texturefocus>
<texturenofocus colordiffuse="Container(1).ListItem.Property(text)">down.png</texturenofocus> <texturenofocus colordiffuse="Container(1).ListItem.Property(text)">down.png</texturenofocus>
<aspectratio>keep</aspectratio> <aspectratio>keep</aspectratio>
@@ -164,16 +175,16 @@
<control type="button" id='102'> <control type="button" id='102'>
<visible>!Control.HasFocus(1) + !Control.HasFocus(101)</visible> <visible>!Control.HasFocus(1) + !Control.HasFocus(101)</visible>
<animation effect="fade" start="0" end="100" time="200" reversible="true" condition="Control.IsVisible(102)">Conditional</animation> <animation effect="fade" start="0" end="100" time="200" reversible="true" condition="Control.IsVisible(102)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,0)">Conditional</animation> <!-- <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,0)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,1)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,1)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,2)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,2)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,3)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,3)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,4)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,4)">Conditional</animation>
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,5)">Conditional</animation> <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,5)">Conditional</animation> -->
<left>90</left> <left>520</left>
<top>0</top> <top>-80</top>
<width>40</width> <width>60</width>
<height>40</height> <height>60</height>
<texturefocus colordiffuse="Container(1).ListItem.Property(text)">up.png</texturefocus> <texturefocus colordiffuse="Container(1).ListItem.Property(text)">up.png</texturefocus>
<texturenofocus colordiffuse="Container(1).ListItem.Property(text)">up.png</texturenofocus> <texturenofocus colordiffuse="Container(1).ListItem.Property(text)">up.png</texturenofocus>
<aspectratio>keep</aspectratio> <aspectratio>keep</aspectratio>
+14 -20
View File
@@ -26,7 +26,7 @@ from datetime import datetime
from core.item import Item from core.item import Item
from platformcode import config, logger, platformtools from platformcode import config, logger, platformtools
from core import filetools, jsontools from core import filetools, jsontools, support
def fechahora_actual(): def fechahora_actual():
@@ -189,30 +189,24 @@ def mainlist(item):
for i_perfil, perfil in enumerate(alfav.user_favorites): for i_perfil, perfil in enumerate(alfav.user_favorites):
context = [] context = []
context.append({'title': config.get_localized_string(70533), 'channel': item.channel, 'action': 'editar_perfil_titulo', context.append({'title': config.get_localized_string(70533), 'channel': item.channel, 'action': 'editar_perfil_titulo', 'i_perfil': i_perfil})
'i_perfil': i_perfil}) context.append({'title': config.get_localized_string(70534), 'channel': item.channel, 'action': 'eliminar_perfil', 'i_perfil': i_perfil})
context.append({'title': config.get_localized_string(70534), 'channel': item.channel, 'action': 'eliminar_perfil',
'i_perfil': i_perfil})
if i_perfil > 0: if i_perfil > 0:
context.append({'title': config.get_localized_string(70535), 'channel': item.channel, 'action': 'mover_perfil', context.append({'title': config.get_localized_string(70535), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'top'})
'i_perfil': i_perfil, 'direccion': 'top'}) context.append({'title': config.get_localized_string(70536), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'arriba'})
context.append({'title': config.get_localized_string(70536), 'channel': item.channel, 'action': 'mover_perfil',
'i_perfil': i_perfil, 'direccion': 'arriba'})
if i_perfil < last_i: if i_perfil < last_i:
context.append({'title': config.get_localized_string(70537), 'channel': item.channel, 'action': 'mover_perfil', context.append({'title': config.get_localized_string(70537), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'abajo'})
'i_perfil': i_perfil, 'direccion': 'abajo'}) context.append({'title': config.get_localized_string(70538), 'channel': item.channel, 'action': 'mover_perfil', 'i_perfil': i_perfil, 'direccion': 'bottom'})
context.append({'title': config.get_localized_string(70538), 'channel': item.channel, 'action': 'mover_perfil',
'i_perfil': i_perfil, 'direccion': 'bottom'})
plot = str(len(perfil['items'])) + " " + config.get_localized_string(70723) plot = str(len(perfil['items'])) + " " + config.get_localized_string(70723)
itemlist.append(Item(channel=item.channel, action='mostrar_perfil', title=perfil['title'], plot=plot, i_perfil=i_perfil, context=context)) itemlist.append(Item(channel=item.channel, action='mostrar_perfil', title=perfil['title'], plot=plot, i_perfil=i_perfil, context=context, thumbnail=support.thumb('mylink.png')))
itemlist.append(item.clone(action='crear_perfil', title=config.get_localized_string(70542), folder=False)) itemlist.append(item.clone(action='crear_perfil', title=config.get_localized_string(70542), folder=False))
itemlist.append(item.clone(action='mainlist_listas', title=config.get_localized_string(70603))) itemlist.append(item.clone(action='mainlist_listas', title=config.get_localized_string(70603)))
return itemlist return support.thumb(itemlist)
def mostrar_perfil(item): def mostrar_perfil(item):
@@ -230,13 +224,13 @@ def mostrar_perfil(item):
for i_enlace, enlace in enumerate(alfav.user_favorites[i_perfil]['items']): for i_enlace, enlace in enumerate(alfav.user_favorites[i_perfil]['items']):
it = Item().fromurl(enlace) it = Item().fromurl(enlace)
it.context = [ {'title': '[COLOR blue]'+config.get_localized_string(70617)+'[/COLOR]', 'channel': item.channel, 'action': 'acciones_enlace', it.context = [ {'title': config.get_localized_string(70617), 'channel': item.channel, 'action': 'acciones_enlace',
'i_enlace': i_enlace, 'i_perfil': i_perfil} ] 'i_enlace': i_enlace, 'i_perfil': i_perfil} ]
it.plot += '[CR][CR][COLOR blue]' + config.get_localized_string(70724) + ':[/COLOR] ' + it.channel + ' [COLOR blue]' + config.get_localized_string(60266) + ':[/COLOR] ' + it.action it.plot += '[CR][CR]' + config.get_localized_string(70724) + ': ' + it.channel + ' ' + config.get_localized_string(60266) + ': ' + it.action
if it.extra != '': it.plot += ' [COLOR blue]Extra:[/COLOR] ' + it.extra if it.extra != '': it.plot += ' Extra: ' + it.extra
it.plot += '[CR][COLOR blue]Url:[/COLOR] ' + it.url if isinstance(it.url, str) else '...' it.plot += '[CR]Url: ' + it.url if isinstance(it.url, str) else '...'
if it.date_added != '': it.plot += '[CR][COLOR blue]' + config.get_localized_string(70469) + ':[/COLOR] ' + it.date_added if it.date_added != '': it.plot += '[CR]' + config.get_localized_string(70469) + ': ' + it.date_added
# If it is not a url, nor does it have the system path, convert the path since it will have been copied from another device. # If it is not a url, nor does it have the system path, convert the path since it will have been copied from another device.
# It would be more optimal if the conversion was done with an import menu, but at the moment it is controlled in run-time. # It would be more optimal if the conversion was done with an import menu, but at the moment it is controlled in run-time.