Example #1
0
def _shut_down():
    """\
		Code to be called last. The main loop is running and will
		be stopped when all events have progressed.
		"""
    try:
        process_event(shutdown_event)
    except Exception as e:
        fix_exception(e)
        process_failure(e)
Example #2
0
def _shut_down():
	"""\
		Code to be called last. The main loop is running and will
		be stopped when all events have progressed.
		"""
	try:
		process_event(shutdown_event)
	except Exception as e:
		fix_exception(e)
		process_failure(e)
Example #3
0
def start_up():
	"""\
		Code to be called first. The main loop is NOT running.
		"""
	register_worker(Shutdown_Worker("shutdown handler"))

	global running
	if not running:
		running = True
		try:
			process_event(startup_event)
		except Exception as e:
			fix_exception(e)
			process_failure(e)
Example #4
0
def start_up():
    """\
		Code to be called first. The main loop is NOT running.
		"""
    register_worker(Shutdown_Worker("shutdown handler"))

    global running
    if not running:
        running = True
        try:
            process_event(startup_event)
        except Exception as e:
            fix_exception(e)
            process_failure(e)
Example #5
0
	def run(self,ctx,**k):
		if self.loglevel is not None:
			ctx = ctx(loglevel=self.loglevel)
		event = self.params(ctx)
		if not event:
			raise SyntaxError("Events need at least one parameter")
		event.ctx = ctx._trim()

		for k,v in self.vars.items():
			if k[0] == '$':
				k = ctx[k[1:]]
			try:
				if v[0] == '$':
					v = ctx[v[1:]]
			except TypeError: # not a string
				pass
			if k is not None and v is not None:
				setattr(event.ctx, k,v)

		process_event(event)
Example #6
0
    def run(self, ctx, **k):
        if self.loglevel is not None:
            ctx = ctx(loglevel=self.loglevel)
        event = self.params(ctx)
        if not event:
            raise SyntaxError("Events need at least one parameter")
        event.ctx = ctx._trim()

        for k, v in self.vars.items():
            if k[0] == '$':
                k = ctx[k[1:]]
            try:
                if v[0] == '$':
                    v = ctx[v[1:]]
            except TypeError:  # not a string
                pass
            if k is not None and v is not None:
                setattr(event.ctx, k, v)

        process_event(event)
Example #7
0
def main():
	try:
		process_event(hello_ev)
		process_event(hello2_ev)
	finally:
		shut_down()