def place(self): libcontext.plugin("get_camera", plugin_supplier(self.get_camera)) libcontext.plugin(("blender", "camera"), plugin_supplier(self.get_camera)) libcontext.plugin("camera", plugin_supplier(self.get_camera_matrix)) libcontext.plugin(("camera", "Blender"), plugin_supplier(self.get_camera)) libcontext.plugin(("blender", "sceneloader"), plugin_single_required(self.load))
def place(self): socketclass = libcontext.socketclasses.socket_supplier libcontext.socket(("bee", "output", self.segmentname, self.type), socketclass(self.add_output)) pluginclass = libcontext.pluginclasses.plugin_single_required for connection in self._connection: libcontext.plugin(("bee", "segment", "connection", get_ident(connection.identifier)), pluginclass(self.output))
def place(self): libcontext.plugin(("canvas", "size"), plugin_supplier(self.canvas_size)) self.d_bgrid.place() self.d_str.place() self.d_mstr.place() self.d_image.place() canvasdrone._wrapped_hive.place(self)
def place(self): pluginclass = libcontext.pluginclasses.plugin_single_required socketclass = libcontext.socketclasses.socket_single_required libcontext.plugin(("bee", "segment", "connection", self.identifier), pluginclass(self.test)) for connection in self.connection_output: libcontext.socket(("bee", "segment", "connection", get_ident(connection.identifier)), socketclass(self.add_output))
def place(self): self.nextevent = ("on_next", self._beename, id(self)) listener = plugin_single_required(("match", self.trig_outp, self.nextevent)) libcontext.plugin(("evin", "listener"), listener) s = socket_single_required(self.set_event_next) libcontext.socket(("evin", "event", "next"), s)
def place(self): self.hives = {} self.eventfuncs = [] self.binder_instances = [] self.startupfunctions = [] handled_parameters = set() for binder in binders: inst = binder.getinstance() if inst is None: continue params = inst.parameter_name, inst.parameter_value, str( inst.binder_drone_instance.__beename__), tuple(inst.antenna_names) if params in handled_parameters: continue handled_parameters.add(params) self.binder_instances.append(inst) for binder in self.binder_instances: if getattr(self, binder.parameter_name) != binder.parameter_value: continue binder.place() init_plugin = libcontext.pluginclasses.plugin_single_required(self.init) libcontext.plugin("startupfunction", init_plugin)
def place(self): self.contextname = libcontext.get_curr_contextname() from libcontext.pluginclasses import plugin_supplier from libcontext.socketclasses import socket_container libcontext.socket(("evexc", "exception"), socket_container(self.add_target)) libcontext.plugin(("evexc", "read-exception"), plugin_supplier(self.read_exception))
def place(self): libcontext.socket(("process", "bound"), socket_single_optional(self.set_get_process_name)) libcontext.plugin(("bee", "init"), plugin_single_required(self.enable)) libcontext.socket(("evin", "add_listener"), socket_single_required(self.set_add_listener)) libcontext.socket(("message", "subscribe"), socket_single_required(self.set_subscribe)) libcontext.socket(("message", "unsubscribe"), socket_single_required(self.set_unsubscribe)) libcontext.plugin("cleanupfunction", plugin_single_required(self.on_cleanup))
def place(self): pluginclass = libcontext.pluginclasses.plugin_supplier self.antenna_push_plugin = pluginclass(self.input) libcontext.plugin(("bee", "antenna", self.segmentname, self.type), self.antenna_push_plugin) socketclass = libcontext.socketclasses.socket_single_required for connection in self._connection: libcontext.socket(("bee", "segment", "connection", get_ident(connection.identifier)), socketclass(self.add_connection))
def place(self): socketclass = libcontext.socketclasses.socket_single_optional libcontext.socket(("bee", "antenna", self.segmentname, self.type), socketclass(self.set_input)) pluginclass = libcontext.pluginclasses.plugin_single_required for connection in self._connection: libcontext.plugin(("bee", "segment", "connection", get_ident(connection.identifier)), pluginclass(self.input))
def place(self): pattern = ("leader", self.keypress, ("keyboard", "keypressed")) keylistener = plugin_single_required(pattern) libcontext.plugin(("evin", "listener"), keylistener) pattern = ("trigger", self.start, "start") startlistener = plugin_single_required(pattern) libcontext.plugin(("evin", "listener"), startlistener)
def place(self): libcontext.socket(("evin", "add_listener"), socket_single_required(self.set_add_listener)) libcontext.socket(("evin", "remove_listener"), socket_single_required(self.set_remove_listener)) self.listener = None if self.on: libcontext.plugin(("bee", "init"), plugin_single_required(self.m_start))
def place(self): #Grab the hive's function for adding listeners libcontext.socket(("evin", "add_listener"), socket_single_required(self.set_add_listener)) #Make sure we are enabled at startup libcontext.plugin(("bee", "init"), plugin_single_required(self.enable)) #Declare flag sockets, to declare that we require mouse support # If there is no mouse support, an error will now be raised when the hive is closed libcontext.socket(("evin", ("input", "mouse")), socket_flag())
def place(self): s = socket_single_required(self.set_turn) libcontext.socket(("game", "turn"), s) s = socket_container(self.add_moveprocessor) libcontext.socket(("game", "process_move"), s) listener = plugin_single_required(("leader", self.move, "command")) libcontext.plugin(("evin", "listener"), listener)
def place(self): p = libcontext.pluginclasses.plugin_single_required(self.parent) libcontext.import_socket(self.parent.parent.context, ("pin", "run")) libcontext.import_socket(self.parent.parent.context, ("pin", "push_input")) libcontext.import_socket(self.parent.parent.context, ("pin", "pull_input")) libcontext.import_socket(self.parent.parent.context, ("pin", "push_output")) libcontext.import_socket(self.parent.parent.context, ("pin", "pull_output")) libcontext.plugin(("pin", "run"), p)
def place(self): plugin = plugin_supplier(self.do_bind) libcontext.plugin(("process", "launch"), plugin) socket = socket_single_required(self.set_register_hive) libcontext.socket("register_hive", socket) socket = socket_single_required(self.set_get_hive) libcontext.socket("get_hive", socket)
def bind(self, binderworker, bindname): try: self._get_actor(bindname) except KeyError: pass else: libcontext.plugin("actor", plugin_supplier(lambda: self._get_actor(bindname))) libcontext.plugin("get_actor", plugin_supplier(self._get_actor))
def place(self): pluginclass = libcontext.pluginclasses.plugin_supplier self.output_pull_plugin = pluginclass(self.output) libcontext.plugin(("bee", "output", self.segmentname, self.type), self.output_pull_plugin) socketclass = libcontext.socketclasses.socket_single_required connection = self._connection[0] libcontext.socket(("bee", "segment", "connection", get_ident(connection.identifier)), socketclass(self.set_input))
def place(self): if panda3d is None: raise ImportError("Cannot locate Panda3D") libcontext.plugin("startupfunction", plugin_single_required(self.init)) libcontext.socket(("panda", "noderoot", "render"), socket_single_required(self._set_render)) libcontext.socket(("panda", "noderoot", "loader"), socket_single_required(self._set_loader)) libcontext.socket(("panda", "actor-register"), socket_single_required(self._set_actor_register)) libcontext.socket(("panda", "entity-register"), socket_single_required(self._set_entity_register)) libcontext.socket(("panda", "actorclass-register"), socket_single_required(self._set_actorclass_register)) libcontext.socket(("panda", "entityclass-register"), socket_single_required(self._set_entityclass_register))
def place0(self): self.connector.place() self.connector.parent = self for k in self.connector.context.plugins.keys(): if k[1] == self.inout[:-1]: p = ("bee", k[1], self.hivename, self.ttype) libcontext.plugin(p, self.connector.context.plugins[k][0]) for k in self.connector.context.sockets.keys(): if k[1] == self.inout[:-1]: s = ("bee", k[1], self.hivename, self.ttype) libcontext.socket(s, self.connector.context.sockets[k][0])
def place(self): libcontext.plugin("startupfunction", plugin_single_required((self.load, 1))) libcontext.socket(("blender", "scene"), socket_single_required(self.set_scene)) libcontext.socket(("blender", "sceneloader"), socket_container(self.add_sceneloader)) libcontext.socket(("blender", "objectloader"), socket_container(self.add_objectloader)) libcontext.plugin(("blender", "noderoot", "render2d"), plugin_supplier(lambda: self.render2d)) libcontext.plugin(("blender", "noderoot", "aspect2d"), plugin_supplier(lambda: self.aspect2d)) libcontext.plugin(("blender", "noderoot", "pixel2d"), plugin_supplier(lambda: self.pixel2d)) libcontext.plugin("textureloader", plugin_supplier(self._textureloader))
def place(self): pluginclass = libcontext.pluginclasses.plugin_single_required socketclass = libcontext.socketclasses.socket_single_required for onr, connection in enumerate(self._outputs): func = functools.partial(self.set_output, onr) ident = self.identifier if ident is None: ident = str(id(self)) identifier = ident + ":" + str(onr + 1) libcontext.socket(("bee", "segment", "connection", identifier), socketclass(func)) for connection in self.connection_input: libcontext.plugin(("bee", "segment", "connection", get_ident(connection.identifier)), pluginclass(self.output))
def place(self): pluginclass = libcontext.pluginclasses.plugin_single_required socketclass = libcontext.socketclasses.socket_single_required ident = self.identifier if ident is None: ident = str(id(self)) identifier = ident + ":1" libcontext.plugin(("bee", "segment", "connection", identifier), pluginclass(self.get_input1)) identifier = ident + ":2" libcontext.plugin(("bee", "segment", "connection", identifier), pluginclass(self.get_input2)) for connection in self.connection_output: libcontext.socket(("bee", "segment", "connection", get_ident(connection.identifier)), socketclass(self.add_output))
def place(self): pintypes = ("push_input", "pull_input", "push_output", "pull_output") for pintype in pintypes: f = functools.partial(self.add_pin, pintype) libcontext.socket(("pin", pintype), socket_container(f)) libcontext.socket(("pin", "run"), socket_container(self.add_pinworker)) libcontext.plugin(("pin", "mediator"), plugin_supplier(self)) p = plugin_single_required(("trigger", self.run, "tick", 0)) libcontext.plugin(("evin", "listener"), p) libcontext.socket(("evexc", "exception"), socket_container(self.add_catch_target))
def place(self): #Grab the hive's function for adding listeners libcontext.socket(("evin", "add_listener"), socket_single_required(self.set_add_listener)) #Make sure we are enabled at startup libcontext.plugin(("bee", "init"), plugin_single_required(self.enable)) #Declare flag sockets, to declare that we require keyboard support # If there is no keyboard support, an error will now be raised when the hive is closed libcontext.socket(("evin", ("input", "keyboard")), socket_flag()) # If we are listening for non-ASCII keys, we need support for those keys too # TODO might we also need non ASCII here? if self.keycode != "Any" and self.keycode not in asciilist: libcontext.socket(("evin", ("input", "keyboard", "extended")), socket_flag())
def place(self): s = socket_single_required(self.set_animplayfunc) libcontext.socket(("animation", "play"), s) s = socket_single_required(self.set_soundplayfunc) libcontext.socket(("sound", "play"), s) s = socket_single_required(self.set_addanimfunc) libcontext.socket(("animation", "add"), s) s = socket_single_required(self.set_addsoundfunc) libcontext.socket(("sound", "add"), s) p = plugin_single_required(self._init) libcontext.plugin(("bee", "init"), p)
def place(self): if not hasattr(self, "parent"): return # KLUDGE p = libcontext.pluginclasses.plugin_single_required(self.parent) libcontext.import_plugin(self.parent.parent.context, ("pin", "mediator")) libcontext.import_socket(self.parent.parent.context, ("pin", "run")) libcontext.import_socket(self.parent.parent.context, ("pin", "push_input")) libcontext.import_socket(self.parent.parent.context, ("pin", "pull_input")) libcontext.import_socket(self.parent.parent.context, ("pin", "push_output")) libcontext.import_socket(self.parent.parent.context, ("pin", "pull_output")) libcontext.plugin(("pin", "run"), p) s = libcontext.socketclasses.socket_single_required(self._set_mediator) libcontext.socket(("pin", "mediator"), s)
def place(self): pluginclass = libcontext.pluginclasses.plugin_single_required cb = getattr(self, "callback")[0] if self.intuple: r = self.runtuple else: r = self.runsingle p = pluginclass(functools.partial(r, cb)) for connection in self._connection_input: libcontext.plugin(("bee", "segment", "connection", get_ident(connection.identifier)), p) socketclass = libcontext.socketclasses.socket_single_required for connection in self._connection_output: libcontext.socket(("bee", "segment", "connection", get_ident(connection.identifier)), socketclass(self.add_target))
def place(self): # plugins received from the managers s = socket_single_required(self.set_animplayfunc) libcontext.socket(("animation", "play"), s) s = socket_single_required(self.set_soundplayfunc) libcontext.socket(("sound", "play"), s) s = socket_single_required(self.set_addanimfunc) libcontext.socket(("animation", "add"), s) s = socket_single_required(self.set_addsoundfunc) libcontext.socket(("sound", "add"), s) #plugins provided to the main drone p = plugin_supplier(self) libcontext.plugin("action3", p)
def place(self): p = plugin_supplier(self.make_move) libcontext.plugin(("game", "make_move"), p) s = socket_single_required(self.set_turn) libcontext.socket(("game", "turn"), s) s = socket_container(self.add_moveprocessor) libcontext.socket(("game", "process_move"), s) libcontext.socket(("eventhandler", "lock"), socket_single_required(self.set_eventhandler_lock)) libcontext.socket(("eventhandler", "unlock"), socket_single_required(self.set_eventhandler_unlock))
def bind(self, binderworker, bindname): libcontext.plugin(("entity", "matrix"), plugin_supplier(self._get_matrix)) libcontext.plugin(("entity", "matrix", "Blender"), plugin_supplier(self._get_matrix_blender)) libcontext.plugin(("entity", "matrix", "NodePath"), plugin_supplier(self._get_matrix_nodepath)) libcontext.plugin(("entity", "matrix", "AxisSystem"), plugin_supplier(self._get_matrix_axissystem))
def place(self): libcontext.socket(("evout", "scheduler"), socket_container(self.add_target)) libcontext.plugin(("evout", ("input", "keyboard")), plugin_flag()) libcontext.plugin(("evout", ("input", "keyboard", "extended")), plugin_flag()) libcontext.plugin("startupfunction", plugin_single_required(self.startup)) libcontext.plugin("cleanupfunction", plugin_single_required(self.restore_terminal))
def place(self): s = socket_single_required(self.set_is_finished) libcontext.socket(("game", "finished"), s) s = socket_single_required(self.set_format_move) libcontext.socket(("game", "format_move"), s) s = socket_single_required(self.set_exit) libcontext.socket("exit", s) s = socket_container(self.add_make_move) libcontext.socket(("game", "make_move"), s) p = plugin_supplier(self.process_move) libcontext.plugin(("game", "process_move"), p) p = plugin_supplier(lambda: getattr(self, "turn")) libcontext.plugin(("game", "turn"), p)
def place(self): if not has_bgl: raise ImportError("Cannot import bgl") libcontext.socket(("blender", "noderoot", "pixel2d"), socket_single_required(self._set_pixel2d)) libcontext.socket(("blender", "noderoot", "render2d"), socket_single_required(self._set_render2d)) libcontext.socket(("blender", "noderoot", "aspect2d"), socket_single_required(self._set_aspect2d)) libcontext.socket(("canvas", "size"), socket_single_required(self.get_canvas_size)) if drawshow == "draw": libcontext.plugin(("canvas", "draw", drawshowtype), plugin_supplier(self._draw)) libcontext.plugin(("canvas", "update", drawshowtype), plugin_supplier(self._update_draw)) else: libcontext.plugin(("canvas", "show", drawshowtype), plugin_supplier(self._show)) libcontext.plugin(("canvas", "update", drawshowtype), plugin_supplier(self._update_show)) libcontext.plugin(("canvas", "remove", drawshowtype), plugin_supplier(self._remove0)) if hasattr(baseklass, "place") and callable(baseklass.place): baseklass.place(self)
def place(self): libcontext.plugin(("message", "subscribe"), plugin_supplier(self.subscribe)) libcontext.plugin(("message", "unsubscribe"), plugin_supplier(self.unsubscribe)) libcontext.plugin(("message", "publish"), plugin_supplier(self.publish)) #Make sure we are enabled at startup libcontext.socket(("evin", "add_listener"), socket_single_required(self.set_add_listener)) libcontext.plugin(("bee", "init"), plugin_single_required(self.enable))
def place(self): socket = socket_single_required(self.set_get_entity_names) libcontext.socket(("entity", "names"), socket) listener = plugin_single_required( ("trigger", self.on_start, "start", 9)) libcontext.plugin(("evin", "listener"), listener) # Get hive name socket = socket_single_required(self.set_get_hivemap) libcontext.socket(("entity", "hivemap"), socket) socket = socket_single_required(self.set_launch_hive) libcontext.socket(("process", "launch"), socket) # We might need to register some hives on startup socket = socket_single_required(self.set_register_hive) libcontext.socket("register_hive", socket) socket = socket_single_required(self.set_get_hive) libcontext.socket("get_hive", socket)
def bind(self, binderworker, bindname): matrix_forward_mixins.bind(self, binderworker, bindname) libcontext.plugin(("entity", "bound", "matrix"), plugin_supplier(lambda: self._get_matrix(bindname))) libcontext.plugin( ("entity", "bound", "matrix", "NodePath"), plugin_supplier(lambda: self._get_matrix_nodepath(bindname))) libcontext.plugin( ("entity", "bound", "matrix", "AxisSystem"), plugin_supplier(lambda: self._get_matrix_axissystem(bindname))) libcontext.plugin( ("entity", "bound", "matrix", "Blender"), plugin_supplier(lambda: self._get_matrix_blender(bindname)))
def declare_subtree(catch, spydertypetree, getter, attriblist): for mname, mtypetree in spydertypetree.members: mtypename = mtypetree.typename if hasattr(mtypetree, "arraycount"): for c in range(mtypetree.arraycount): mtypename += "Array" mtype = getattr(Spyder, mtypename) catchf = functools.partial(catch, mname) i = ("bee", "output", mname, mtypename) p = functools.partial(getter, attriblist + [mname]) pp = tryfunc(catchf, p) libcontext.plugin(i, plugin_supplier(pp)) if hasattr(mtypetree, "arraycount") and mtypetree.arraycount: continue nested = (hasattr(mtypetree, "members") and mtypetree.members is not None) if nested: c = libcontext.context(mname) libcontext.push(mname) declare_subtree(catch, mtypetree, getter, attriblist + [mname]) libcontext.pop()
def place(self): if panda3d is None: raise ImportError("Cannot locate Panda3D") libcontext.plugin(("canvas", "draw", "mstr"), plugin_supplier(self.draw_mstr)) libcontext.plugin(("canvas", "update", "mstr"), plugin_supplier(self.update_mstr)) libcontext.plugin(("canvas", "remove", "mstr"), plugin_supplier(self.remove_mstr))
def place(self): libcontext.plugin(("collision", "contact_test"), plugin_supplier(self.contact_test)) libcontext.plugin(("collision", "create_node", "sphere"), plugin_supplier(self.create_sphere)) libcontext.socket(("entity", "names"), socket_single_required(self.set_get_entity_names)) libcontext.socket(("entity", "matrix"), socket_single_required(self.set_get_entity_matrix)) # Add a high-priority deactivate() listener on every tick libcontext.socket(("evin", "add_listener"), socket_single_required(self.set_add_listener)) libcontext.plugin(("bee", "init"), plugin_single_required(self.enable))
def place(self): p = plugin_supplier(lambda: getattr(self.keeper, "finished")) libcontext.plugin(("game", "finished"), p) p = plugin_supplier(self.keeper.format_move) libcontext.plugin(("game", "format_move"), p) p = plugin_supplier(self.keeper.make_move) libcontext.plugin(("game", "make_move"), p)
def place(self): if panda3d is None: raise ImportError("Cannot locate Panda3D") libcontext.socket(("panda", "noderoot", "loader"), socket_single_required(self._set_loader)) libcontext.plugin(("canvas", "draw", ("object", "image")), plugin_supplier(self.draw_image)) libcontext.plugin(("canvas", "update", ("object", "image")), plugin_supplier(self.update_image)) libcontext.plugin(("canvas", "remove", ("object", "image")), plugin_supplier(self.remove_image))
def place(self): p = plugin_supplier(self.make_move) libcontext.plugin(("game", "make_move"), p) s = socket_single_required(self.set_turn) libcontext.socket(("game", "turn"), s) s = socket_container(self.add_moveprocessor) libcontext.socket(("game", "process_move"), s) s = socket_single_required(self.set_event_next) libcontext.socket(("evin", "event", "next_tick"), s) listener = plugin_single_required( ("match", self.move, ("game", "engine", id(self.UCIengine), "get_move"))) libcontext.plugin(("evin", "listener"), listener) listener = plugin_single_required(("trigger", self.start, "start")) libcontext.plugin(("evin", "listener"), listener)
def place(self): p = plugin_single_required(self.trig_model) libcontext.plugin(("bee", "init"), p) if spydertypetree is not None: declare_subtree(self.catchfunc, spydertypetree, self.do_get, [])
def place(self): self.refresh = refresh p = libcontext.pluginclasses.plugin_single_required(self, self.parent) libcontext.plugin(("pin", "push_input"), p)
def place(self): p = libcontext.pluginclasses.plugin_single_required( ("match_leader", self.listener, self.leader)) libcontext.plugin(("evin", "listener"), p)
def place(self): s = libcontext.socketclasses.socket_single_required( self.set_pinconnect) libcontext.socket(("pin", "connect"), s) p = libcontext.pluginclasses.plugin_supplier(self) libcontext.plugin(("pin", "disconnect"), p)
def place(self): p = libcontext.pluginclasses.plugin_supplier(self.get_hive) libcontext.plugin("get_hive", p) p = libcontext.pluginclasses.plugin_supplier(self.register_hive) libcontext.plugin("register_hive", p)
def place(self): p = plugin_supplier(self) libcontext.plugin("action2", p)
def place(self): simplescheduler.place.im_func(self) libcontext.socket("pacemaker", socket_single_required(self.set_pacemaker)) libcontext.plugin(("evin", "scheduler", "complex"), plugin_flag())
def place(self): libcontext.plugin(("command", "new_command"), plugin_supplier(self.new_command)) libcontext.socket("startupfunction", socket_container(self.addstartupfunction)) libcontext.socket("cleanupfunction", socket_container(self.addcleanupfunction)) libcontext.plugin("exit", plugin_supplier(self.exit)) libcontext.plugin("stop", plugin_supplier(self.exit)) libcontext.plugin("display", plugin_supplier(self.display)) libcontext.plugin("watch", plugin_supplier(self.watch)) libcontext.socket("pacemaker", socket_single_required(self.set_pacemaker)) libcontext.socket(("evin", "event"), socket_container(self.add_eventreader)) libcontext.plugin("doexit", plugin_supplier(lambda: self.doexit))
def place(self): p = libcontext.pluginclasses.plugin_supplier(self) libcontext.plugin(("pin", "connect"), p)