예제 #1
0
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
	)
예제 #2
0
def autostart(reason, **kwargs):
	global autotimer
	global autopoller

	# Startup
	if reason == 0 and config.plugins.autotimer.autopoll.value:
		# Initialize AutoTimer
		from AutoTimer import AutoTimer
		autotimer = AutoTimer()
		# Start Poller
		from AutoPoller import AutoPoller
		autopoller = AutoPoller()
		autopoller.start()
	# Shutdown
	elif reason == 1:
		# Stop Poller
		if autopoller is not None:
			autopoller.stop()
			autopoller = None

		if autotimer is not 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

			# Save xml
			autotimer.writeXml()

			# Remove AutoTimer
			autotimer = None
예제 #3
0
def autostart(reason, **kwargs):
	global autotimer
	global autopoller

	# Startup
	if config.plugins.autotimer.autopoll.value and reason == 0:
		# Initialize AutoTimer
		from AutoTimer import AutoTimer
		autotimer = AutoTimer()

		# Start Poller
		from AutoPoller import AutoPoller
		autopoller = AutoPoller()
		autopoller.start()
	# Shutdown
	elif reason == 1:
		# Stop Poller
		if autopoller is not None:
			autopoller.stop()
			autopoller = None

		if autotimer is not 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

			# Save xml
			autotimer.writeXml()

			# Remove AutoTimer
			autotimer = None
예제 #4
0
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 getAutoTimerInstance(self):
		if plugin.autotimer is None:
			self._remove = True
			autotimer = AutoTimer()
			try:
				autotimer.readXml()
			except Exception:
				# TODO: proper error handling
				pass
			return autotimer
		self._remove = False
		return plugin.autotimer
	def getAutoTimerInstance(self):
		if plugin.autotimer is None:
			self._remove = True
			autotimer = AutoTimer()
			try:
				autotimer.readXml()
			except Exception:
				# TODO: proper error handling
				pass
			return autotimer
		self._remove = False
		return plugin.autotimer
예제 #7
0
def main(session, **kwargs):
	global autotimer
	global autopoller

	if autotimer is None:
		from AutoTimer import AutoTimer
		autotimer = AutoTimer()

	try:
		autotimer.readXml()
	except SyntaxError, se:
		session.open(
			MessageBox,
			_("Your config file is not well-formed:\n%s") % (str(se)),
			type = MessageBox.TYPE_ERROR,
			timeout = 10
		)
		return