from Screens.Screen import Screen
from Components.ActionMap import NumberActionMap
from Components.ConfigList import ConfigListScreen
from Components.Sources.StaticText import StaticText

try:
	from Screens.TimerEntry import TimerEntry
	print "[PowerMetrixFHD] 002 -OK-- TimerEntry"
except:
	print "[PowerMetrixFHD] 002 -NOK- TimerEntry"

#######################################################################################################################################################

def TimerEntry__init__(self, session, timer):
	Screen.__init__(self, session)
	self.timer = timer

	self.entryDate = None
	self.entryService = None

	self["key_red"] = StaticText(_("Cancel"))
	self["key_green"] = StaticText(_("OK"))

	self.createConfig()

	self["actions"] = NumberActionMap(["SetupActions", "GlobalActions", "PiPSetupActions"],
	{
		"ok": self.keySelect,
		"save": self.keyGo,
		"cancel": self.keyCancel,
		"volumeUp": self.incrementStart,
		"volumeDown": self.decrementStart,
		"size+": self.incrementEnd,
		"size-": self.decrementEnd
	}, -2)

	self.list = []
	ConfigListScreen.__init__(self, self.list, session=session)
	self.createSetup("config")

#######################################################################################################################################################

def doTimerEntryChange():
	try:
		TimerEntry.__init__ = TimerEntry__init__
		print "[PowerMetrixFHD] 002 -OK-- TimerEntry"
	except:
		print "[PowerMetrixFHD] 002 -NOK- TimerEntry"
