def CompositeBulletinBoardProtocol(**argd): ConnectionInfo = {} ConnectionInfo.update(argd) return Seq( Authenticator(State=ConnectionInfo), UserRetriever(State=ConnectionInfo), StateSaverLogout(State=ConnectionInfo), )
def CompositeBulletinBoardProtocol(**argd): ConnectionInfo = {} ConnectionInfo.update(argd) return Pipeline( LineOrientedInputBuffer(), Seq( Authenticator(State=ConnectionInfo), UserRetriever(State=ConnectionInfo), MessageBoardUI(State=ConnectionInfo), StateSaverLogout(State=ConnectionInfo), ))
def main(self): pgd = PygameDisplay(width=self.width, height=self.height).activate() PygameDisplay.setDisplayService(pgd) yield 1 if __name__ == "__main__": from pygame.locals import * from ToolBox import ToolBox from Axon.experimental.Process import ProcessGraphline from Kamaelia.Chassis.Graphline import Graphline from Kamaelia.Chassis.Pipeline import Pipeline from Kamaelia.Chassis.Seq import Seq ProcessGraphline(COLOURS=Seq( DisplayConfig(width=285, height=600), ToolBox(size=(270, 600)), ), WINDOW1=Seq( DisplayConfig(width=555, height=520), Paint(bgcolour=(100, 100, 172), position=(10, 10), size=(500, 500), transparent=False), ), WINDOW2=Seq( DisplayConfig(width=555, height=520), Paint(bgcolour=(100, 100, 172), position=(10, 10), size=(500, 500), transparent=False), ),
if __name__ == "__main__": import time from Kamaelia.Util.Console import ConsoleEchoer from Kamaelia.Util.DataSource import DataSource from Kamaelia.Util.PureTransformer import PureTransformer from Kamaelia.Chassis.Pipeline import Pipeline from Kamaelia.Chassis.Graphline import Graphline from Kamaelia.Chassis.Seq import Seq class Pauser(Axon.ThreadedComponent.threadedcomponent): def main(self): time.sleep(1) Graphline(DATASOURCE=Seq(Pauser(), DataSource([1, 2, 3, 4, 5, 6])), PROCESSOR=TaggingPluggableProcessor(), PROCESSORSOURCE=DataSource([ ("EVEN", lambda x: x % 2 == 0, PureTransformer(lambda x: "Even ! " + str(x))), ("ODD", lambda x: x % 2 == 1, PureTransformer(lambda x: "Odd ! " + str(x))), ("THREE", lambda x: x % 3 == 0, PureTransformer(lambda x: "Divisible by 3 ! " + str(x))), ("FOUR", lambda x: x % 4 == 0, PureTransformer(lambda x: "Divisible by 3 ! " + str(x))), ]), CONSOLE=Pipeline(PureTransformer(lambda x: repr(x) + "\n"), ConsoleEchoer()), linkages={ ("DATASOURCE", "outbox"): ("PROCESSOR", "inbox"),
Seq( "Decoding & separating frames...", Graphline( MAXF = DetermineMaxFrameNumber(edlfile), DO = Carousel( lambda maxframe : DecodeAndSeparateFrames(inFileName, tmpFilePath, edlfile,maxframe), ), STOP = TriggeredOneShot(""), linkages = { ("MAXF","outbox"):("DO","next"), ("DO","outbox"):("","outbox"), ("DO","requestNext"):("STOP","inbox"), ("STOP","signal"):("DO","control"), ("DO","signal"):("","signal"), }, ), "Processing edits...", Graphline( REFRAMING = ReframeVideo(edlfile, tmpFilePath, output_width, output_height), SOUND = PassThroughAudio(edlfile, tmpFilePath), ENCODING = ReEncode(outFileName), linkages = { ("REFRAMING","outbox") : ("ENCODING","video"), ("SOUND","outbox") : ("ENCODING","audio"), ("SOUND","audioformat") : ("ENCODING","audioformat"), ("REFRAMING","signal") : ("SOUND","control"), ("SOUND","signal") : ("ENCODING", "control"), }, boxsizes = { ("ENCODING","video") : 2, ("ENCODING","audio") : 2, }, ), "Cleaning up...", StopSelector(), ).run()
def CompositeBulletinBoardProtocol(**argd): ConnectionInfo = {} ConnectionInfo.update(argd) return Seq(Authenticator(State=ConnectionInfo), )
if 0: # Server ServerCore( protocol=Echo, port=2345, socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1), ).run() if 0: # Client from Kamaelia.Chassis.Graphline import Graphline Graphline( CLIENT_PROTOCOL=Seq( # Pause(delay=0.1), OneShot("Hello1\r\n"), OneShot("Hello2\r\n"), OneShot("Hello3\r\n"), OneShot("Hello4\r\n"), OneShot("Hello5\r\n"), OneShot("Hello6\r\n"), OneShot("Hello7\r\n"), OneShot("Hello8\r\n"), ), CLIENT=TCPClient("127.0.0.1", 2345), SANITY_CHECK=ConsoleEchoer(), linkages={ ("CLIENT_PROTOCOL", "outbox"): ("CLIENT", "inbox"), ("CLIENT", "outbox"): ("SANITY_CHECK", "inbox"), }).run() if 0: # Client doesn't get data back, because of producerFinished message Pipeline( Seq(