Пример #1
0
def BuildViewer(screensize = (800,600), fullscreen = False, transparency = None):
    laws = SimpleLaws(bondLength=100)
    return AxonVisualiser( screensize=screensize,
                           fullscreen=fullscreen,
                           caption = "The pipeline",
                           particleTypes = {"component":ComponentParticle},
#                           extraDrawing = ExtraWindowFurniture(),
                            laws = laws
                         )
Пример #2
0
ADD NODE %(nodeid)s.i.control "control" randompos inbox
ADD LINK %(nodeid)s %(nodeid)s.o.outbox
ADD LINK %(nodeid)s %(nodeid)s.o.signal
ADD LINK %(nodeid)s %(nodeid)s.i.inbox
ADD LINK %(nodeid)s %(nodeid)s.i.control
"""
Pipeline(
    ConsoleReader(),
    PublishTo("AXONVIS"),
).activate()

Pipeline(
    SubscribeTo("AXONVIS"),
    text_to_token_lists(),
    AxonVisualiser(caption="Axon / Kamaelia Visualiser",
                   screensize=(1024, 500),
                   position=(0, 0),
                   transparency=(255, 255, 255)),
    PublishTo("AXONEVENTS"),
).activate()


class NodeAdder(Axon.Component.component):
    Outboxes = {
        "outbox": "commands to the visualiser",
        "nodemanip": "commands to something that understands adding nodes",
    }

    def main(self):
        nodeid = 0
        while True:
            for message in self.Inbox("inbox"):
Пример #3
0
    if "help" in dictArgs:
        print(dictArgs["help"])
        sys.exit(0)

    resolution = dictArgs.get("screensize", (800, 600))
    doNavelgaze = dictArgs.pop("navelgaze", None)
    doIntrospect = dictArgs.pop("introspect", None)

    pgd = PygameDisplay(width=resolution[0], height=resolution[1]).activate()
    PygameDisplay.setDisplayService(pgd)

    if doIntrospect is not None:
        (server, port) = doIntrospect

        Pipeline(Introspector(), TCPClient(server, port)).activate()

    if doNavelgaze:
        if "serverPort" in dictArgs:
            raise ValueError(
                "Makes no sense to navelgaze and use --port option - they're mutually exclusive"
            )
        app = Pipeline(
            Introspector(), ConsoleEchoer(forwarder=True),
            text_to_token_lists(),
            AxonVisualiser(caption="Axon / Kamaelia Visualiser", **dictArgs))
    else:
        app = AxonVisualiserServer(caption="Axon / Kamaelia Visualiser",
                                   **dictArgs)

    app.run()
Пример #4
0
    def main(self):
        for item in iter(self.data):
            self.send(item, "outbox")
            yield 1


Pipeline(
    ConsoleReader(),
    Source([
        """\
ADD NODE Source Source randompos component
ADD NODE Source#inbox inbox randompos inbox
ADD NODE Source#outbox outbox randompos outbox
ADD LINK Source Source#inbox
ADD LINK Source Source#outbox
ADD NODE Sink Sink randompos component
ADD NODE Sink#inbox inbox randompos inbox
ADD NODE Sink#outbox outbox randompos outbox
ADD LINK Sink Sink#inbox
ADD LINK Sink Sink#outbox
ADD LINK Source#outbox Sink#inbox
ADD LINK Sink#outbox Source#inbox
"""
    ]),
    chunks_to_lines(),
    lines_to_tokenlists(),
    AxonVisualiser(),
    ConsoleEchoer(),
).run()