from enigma import getDesktop, eTimer
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
from Screens.Screen import Screen
from Tools import Notifications
from Screens.MessageBox import MessageBox
from Plugins.Plugin import PluginDescriptor
screenWidth = getDesktop(0).size().width()
skin_hd = """
<screen position="40,40" size="72,72" zPosition="-6" flags="wfNoBorder">
<ePixmap position="0,0" size="72,72" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/BlockButton2/block_hd.png" />
</screen>"""
skin_fhd = """
<screen position="60,60" size="108,108" zPosition="-6" flags="wfNoBorder">
<ePixmap position="0,0" size="108,108" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/BlockButton2/block_fhd.png" />
</screen>"""
class BlockButton2(Screen):
def __init__(self, session):
Screen.__init__(self, session)
if screenWidth and screenWidth == 1280:
self.skin = skin_hd
if screenWidth and screenWidth == 1920:
self.skin = skin_fhd
self["actions"] = ActionMap(["WizardActions", "ColorActions", "OkCancelActions", "DirectionActions", "ChannelSelectEPGActions", "ButtonSetupActions", "GlobalActions", "SetupActions"],
{
"power": self.close,
"text": self.close,
"subtitle": self.close,
"1": self.close,
"2": self.close,
"3": self.close,
"4": self.close,
"5": self.close,
"6": self.close,
"7": self.close,
"8": self.close,
"9": self.close,
"previous": self.close,
"0": self.close,
"next": self.close,
"back": self.close,
"red": self.close,
"green": self.close,
"yellow": self.close,
"blue": self.close,
"left": self.close,
"up": self.close,
"right": self.close,
"down": self.close,
"ok": self.close,
"channelup": self.close,
"channeldown": self.close,
"cancel": self.close,
"epg": self.close,
"volumeUp": self.close,
"volumeDown": self.close,
"menu": self.close,
"list": self.close,
"audio": self.close,
"info": self.close,
"rewind": self.close,
"play": self.close,
"playpause": self.close,
"fastforward": self.close,
"showTv": self.close,
"rec": self.close,
"stop": self.close,
"radio": self.close,
}, -2)
self.hide_time = eTimer()
self.hide_time.callback.append(self.setHide)
self.hide_time.startLongTimer(2) # Pause in seconds
def setHide(self):
self.hide_time.stop()
self.close()
def sessionstart(reason, **kwargs):
if reason == 0:
#Notifications.AddPopup(text=_('AutoStart Work 100%'), type=MessageBox.TYPE_INFO, timeout=10, id='BlockButton2')
#Notifications.AddPopup(text=_('AutoStart Work 100%'), type=MessageBox.TYPE_INFO, timeout=1, id='BlockButton2')
#Notifications.AddPopup(text=_('AutoStart Work 100%'), type=MessageBox.TYPE_INFO, timeout=0, id='BlockButton2') # Pri "timeout=0" - okno pokazyvaetsya postoyanno
#self.close()
print 'BlockButton'
return
def main(session, **kwargs):
session.open(BlockButton2)
def Plugins(**kwargs):
list = [PluginDescriptor(where=[PluginDescriptor.WHERE_SESSIONSTART], fnc=sessionstart)]
list.append(PluginDescriptor(name=_('BlockButton2'), description=_("Do Not Show the 'BlockButton2' on the screen"), where=PluginDescriptor.WHERE_PLUGINMENU, icon='plugin.png', fnc=main))
return list
Comments