from Tools.Profile import profile 

from Plugins.PowerSat.PowerMetrixFHD.modules.EpgListMOD						import doEpgListChange
from Plugins.PowerSat.PowerMetrixFHD.modules.OscamStatusMOD					import doOscamStatusChange
from Plugins.PowerSat.PowerMetrixFHD.modules.TimerEntryMOD					import doTimerEntryChange
from Plugins.PowerSat.PowerMetrixFHD.modules.EpgSelectionMOD				import doEpgSelectionChange
from Plugins.PowerSat.PowerMetrixFHD.modules.CrashlogAutoSubmitMOD			import doCrashlogAutoSubmitChange
from Plugins.PowerSat.PowerMetrixFHD.modules.StreamServerMOD				import doStreamServerChange
from Plugins.PowerSat.PowerMetrixFHD.modules.AudioSyncMOD					import doAudioSyncChange
from Plugins.PowerSat.PowerMetrixFHD.modules.MovieSelectionMOD				import doMovieSelectionChange
from Plugins.PowerSat.PowerMetrixFHD.modules.BarryAllenMOD					import doBarryAllenChange
from Plugins.PowerSat.PowerMetrixFHD.modules.NetworkManagerMOD				import doNetworkManagerChange
from Plugins.PowerSat.PowerMetrixFHD.modules.SoftwareManagerMOD				import doSoftwareManagerChange
from Plugins.PowerSat.PowerMetrixFHD.modules.EventViewMOD					import doEventViewChange
from Plugins.PowerSat.PowerMetrixFHD.modules.MediaDatabaseManagerMOD		import doMediaDatabaseManagerChange
from Plugins.PowerSat.PowerMetrixFHD.modules.LocationBoxMOD					import doLocationBoxChange
from Plugins.PowerSat.PowerMetrixFHD.modules.ChoiceBoxMOD					import doChoiceBoxChange
from Plugins.PowerSat.PowerMetrixFHD.modules.ServiceInfoMOD					import doServiceInfoChange
from Plugins.PowerSat.PowerMetrixFHD.modules.TimerEditMOD					import doTimerEditChange
from Plugins.PowerSat.PowerMetrixFHD.modules.HelpMenuListMOD				import doHelpMenuListChange
from Plugins.PowerSat.PowerMetrixFHD.modules.StartWizardMOD					import doStartWizardChange
from Plugins.PowerSat.PowerMetrixFHD.modules.ServiceScanMOD					import doServiceScanChange
from Plugins.PowerSat.PowerMetrixFHD.modules.GraphMultiEPGMOD				import doGraphMultiEPGChange
from Plugins.PowerSat.PowerMetrixFHD.modules.TeleTextMOD					import doTeleTextChange
from Plugins.PowerSat.PowerMetrixFHD.modules.MessageBoxMOD					import doMessageBoxChange
from Plugins.PowerSat.PowerMetrixFHD.modules.AboutMOD						import doAboutChange
from Plugins.PowerSat.PowerMetrixFHD.modules.HarddiskSetupMOD				import doHarddiskSetupChange
from Plugins.PowerSat.PowerMetrixFHD.modules.NotificationQueueViewerMOD		import doNotificationQueueViewerChange
from Plugins.PowerSat.PowerMetrixFHD.modules.ToastMOD						import doToastChange
from Plugins.PowerSat.PowerMetrixFHD.modules.VirtualKeyBoardMOD				import doVirtualKeyBoardChange
from Plugins.PowerSat.PowerMetrixFHD.modules.VolumeMOD						import doVolumeChange
from Plugins.PowerSat.PowerMetrixFHD.modules.SkinSelectorMOD				import doSkinSelectorChange
from Plugins.PowerSat.PowerMetrixFHD.modules.AutoTimerMOD					import doAutoTimerChange

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

changesDict = {	"EpgList":					("000",	doEpgListChange),
				"OscamStatus":				("001",	doOscamStatusChange),
				"TimerEntry":				("002",	doTimerEntryChange),
				"EpgSelection":				("003",	doEpgSelectionChange),
				"CrashlogAutoSubmit":		("004",	doCrashlogAutoSubmitChange),
				"StreamServer":				("005",	doStreamServerChange),
				"AudioSync":				("006",	doAudioSyncChange),
				"MovieSelection":			("007",	doMovieSelectionChange),
				"BarryAllen":				("008",	doBarryAllenChange),
				"NetworkManager":			("009",	doNetworkManagerChange),
				"SoftwareManager":			("010",	doSoftwareManagerChange),
				"EventView":				("011",	doEventViewChange),
				"MediaDatabaseManager":		("012",	doMediaDatabaseManagerChange),
				"LocationBox":				("013",	doLocationBoxChange),
				"ChoiceBox":				("014",	doChoiceBoxChange),
				"ServiceInfo":				("015",	doServiceInfoChange),
				"TimerEdit":				("016",	doTimerEditChange),
				"HelpMenuList":				("017",	doHelpMenuListChange),
				"StartWizard":				("018",	doStartWizardChange),
				"ServiceScan":				("019",	doServiceScanChange),
				"GraphMultiEPG":			("020",	doGraphMultiEPGChange),
				"TeleText":					("021",	doTeleTextChange),
				"MessageBox":				("022",	doMessageBoxChange),
				"About":					("023",	doAboutChange),
				"HarddiskSetup":			("024",	doHarddiskSetupChange),
				"NotificationQueueViewer":	("025",	doNotificationQueueViewerChange),
				"Toast":					("026",	doToastChange),
				"VirtualKeyBoard":			("027",	doVirtualKeyBoardChange),
				"Volume":					("028",	doVolumeChange),
				"SkinSelector":				("029",	doSkinSelectorChange),
				"AutoTimer":				("030",	doAutoTimerChange),

				}

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

def changeModules(reason, session = None, **kwargs):
	if reason == 0:
		print "[PowerMetrixFHD] Try changes"
		profile("LOAD:Patches")
		for key, item in changesDict.items():
			print "[PowerMetrixFHD] %s -TRY- %s" %(item[0], key)
			item[1]()
		profile("LoadPatchesDone")
		print "[PowerMetrixFHD] End changes"
	else:
		print "[PowerMetrixFHD] Enigma2 restart"
