startuptostandy: check if not already a standby screen is visible, set appropriate...
[enigma2-plugins.git] / startuptostandby / src / plugin.py
1 # -*- coding: iso-8859-1 -*-
2 from Plugins.Plugin import PluginDescriptor
3 from Components.config import config, ConfigSubsection, ConfigEnableDisable
4 import Screens.Standby
5 from StartupToStandbyConfiguration import StartupToStandbyConfiguration
6 from Tools import Notifications
7
8 config.plugins.startuptostandby = ConfigSubsection()
9 config.plugins.startuptostandby.enabled = ConfigEnableDisable(default = False)
10
11 def main(session, **kwargs):
12         print "[StartupToStandby] Open Config Screen"
13         session.open(StartupToStandbyConfiguration)
14
15 # sessionstart
16 def sessionstart(reason, session = None):
17         print "[StartupToStandby] autostart"
18         if config.plugins.startuptostandby.enabled.value and reason == 0 and not Screens.Standby.inStandby:
19                 Notifications.AddNotification(Screens.Standby, id="Standby")
20
21 def Plugins(path, **kwargs):
22         return [PluginDescriptor(name="StartupToStandby", description="Startup To Standby", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main, needsRestart = False),
23                         PluginDescriptor(name="StartupToStandby", description = "Startup To Standby", where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart, needsRestart = False, weight = -1)]
24