def autostart(reason, **kwargs): global autopoller # Startup if reason == 0 and config.plugins.autotimer.autopoll.value: # Start Poller from AutoPoller import AutoPoller autopoller = AutoPoller() autopoller.start() # Install NPB, main is too late because the Browser is already running from Plugins.SystemPlugins.Toolkit import NotifiablePluginBrowser NotifiablePluginBrowser.install() # Shutdown elif reason == 1: # Stop Poller if autopoller is not None: autopoller.stop() autopoller = None # We re-read the config so we won't save wrong information try: autotimer.readXml() except Exception: # XXX: we should at least dump the error pass else: autotimer.writeXml()
def main(session, **kwargs): global autotimer global autopoller if autotimer is None: from AutoTimer import AutoTimer autotimer = AutoTimer() try: autotimer.readXml() except SyntaxError as se: session.open( MessageBox, _("Your config file is not well-formed:\n%s") % (str(se)), type = MessageBox.TYPE_ERROR, timeout = 10 ) return from Plugins.SystemPlugins.Toolkit import NotifiablePluginBrowser NotifiablePluginBrowser.install() # Do not run in background while editing, this might screw things up if autopoller is not None: autopoller.stop() from AutoTimerOverview import AutoTimerOverview session.openWithCallback( editCallback, AutoTimerOverview, autotimer )
def main(session, **kwargs): global autotimer global autopoller if autotimer is None: from AutoTimer import AutoTimer autotimer = AutoTimer() try: autotimer.readXml() except SyntaxError as se: session.open(MessageBox, _("Your config file is not well-formed:\n%s") % (str(se)), type=MessageBox.TYPE_ERROR, timeout=10) return from Plugins.SystemPlugins.Toolkit import NotifiablePluginBrowser NotifiablePluginBrowser.install() # Do not run in background while editing, this might screw things up if autopoller is not None: autopoller.stop() from AutoTimerOverview import AutoTimerOverview session.openWithCallback(editCallback, AutoTimerOverview, autotimer)