Kamaelia

Nuts & Bolts | Components | Tools | Cookbook | Systems
wiki:( guest738811, Dev Console, Index, Recent, Edit )


Home, News
Dev Console

How, Why
Project Blog
Summer of Code

Documentation
Download
SVN (web)
Sourceforge page

Project Admin
License

Contact Us

  Page Tags

No tags are defined for this page yet - how would you classify/think of this page? Add your notes below!

Cookbook : Pipelines and Graphlines

Discussion Please discuss this on the discussion page for this page
Fairly early on you'll want a quick an easy way to link your components together. To actually build a useful system you need to set up linkages to get data from one component's outbox to another component's inbox. Pipelines and Graphlines are the two simplest and most common ways of doing this.

Find out more about using Pipelines here
Pipeline and Graphline are, themselves, components. Pipeline wires components together in a long chain. For example:
from Kamaelia.Chassis.Pipeline import Pipeline

from Kamaelia.Internet.Multicast_transceiver import Multicast_transceiver
from Kamaelia.Protocol.SimpleReliableMulticast import SRM_Sender
from Kamaelia.Protocol.Packetise import MaxSizePacketiser

Pipeline( RateControlledFileReader("myaudio.mp3",readmode="bytes",rate=128000/8),
SRM_Sender(),
MaxSizePacketiser(),
Multicast_transceiver("0.0.0.0", 0, "224.168.2.9", 1600),
).run()
Find out more about Graphlines here
Whereas a Graphline wires components together in any way you want - you specify each individual link. For example:
from Kamaelia.UI.Pygame.Button import Button
from Kamaelia.UI.Pygame.Image import Image

from Kamaelia.Util.Chooser import Chooser

from Kamaelia.Chassis.Graphline import Graphline

files = [ "slide1.gif", "slide2.gif", .... "slide99.gif" ]

Graphline(
CHOOSER = Chooser(files),
IMAGE = Image(size=(800,600), position=(8,48)),
NEXT = Button(caption="Next", msg="NEXT", position=(72,8) ),
PREVIOUS = Button(caption="Previous", msg="PREV" ,position=(8,8) ),
FIRST = Button(caption="First", msg="FIRST",position=(256,8) ),
LAST = Button(caption="Last", msg="LAST" ,position=(320,8) ),
linkages = {
("NEXT", "outbox") : ("CHOOSER", "inbox"),
("PREVIOUS", "outbox") : ("CHOOSER", "inbox"),
("FIRST", "outbox") : ("CHOOSER", "inbox"),
("LAST", "outbox") : ("CHOOSER", "inbox"),

("CHOOSER", "outbox") : ("IMAGE", "inbox"),
}
).run()

-- 17 Dec 2006 - Matt Hammond



Your tags for this page: If you had set UserPreferences (name & email) and validated them (simple single click in your email), you would be able to define personal tags

Versions: current , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9


(C) 2005 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved,
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC.