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

try:
	from Plugins.SystemPlugins.CrashlogAutoSubmit.plugin import CrashlogAutoSubmitConfiguration
	print "[PowerMetrixFHD] 004 -OK-- CrashlogAutoSubmit"
except:
	print "[PowerMetrixFHD] 004 -NOK- CrashlogAutoSubmit"

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

def CrashlogAutoSubmitConfiguration__init__(self, session):
	Screen.__init__(self, session)
	self.session = session
	self.MailEntry = None
	self.LogEntry = None
	self.addEmailEntry = None
	self.EmailEntry = None
	self.NameEntry = None
	self.AnonCrashlogEntry = None
	self.msgCrashlogMailer = False

	self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions" ],
	{
		"ok": self.keySave,
		"cancel": self.keyCancel,
		"red": self.keyCancel,
		"green": self.keySave,
	}, -2)

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

	self["key_red"] = StaticText(_("Cancel"))
	self["key_green"] = StaticText(_("OK"))
	self["status"] = StaticText()
	self["VKeyIcon"] = Pixmap()
	self["HelpWindow"] = Pixmap()

	self["VKeyIcon"].hide()
	self.onShown.append(self.setWindowTitle)
	self.onClose.append(self.msgCrashlogNotifier)

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

def doCrashlogAutoSubmitChange():
	try:
		CrashlogAutoSubmitConfiguration.__init__ = CrashlogAutoSubmitConfiguration__init__
		print "[PowerMetrixFHD] 004 -OK-- CrashlogAutoSubmit"
	except:
		print "[PowerMetrixFHD] 004 -NOK- CrashlogAutoSubmit"
