Exemplo n.º 1
0
Backplane("SCHEDULECONTROL").activate()
Backplane("PINGERCONTROL").activate()
Backplane("DEBUGIN").activate()

if "debug" in sys.argv:
    testing = True
else:
    testing = False

if testing:
    Pipeline(
        SubscribeTo("DEBUGIN"),
        PublishTo("USERRESPONSE"),
    ).activate()
    Pipeline(
        Textbox(position=(250,48), size=(500,150)),
        PublishTo("DEBUGIN"),
    ).activate()

    Pipeline(
        SubscribeTo("OUIJAOUT"),
        PureTransformer(lambda x: str(x)+"\n"),
        TextDisplayer(position=(250,220), size=(500,150)),
    ).activate()

Pipeline(
    ConsoleReader(">> "),
    PureTransformer(lambda x: x[:-1]),
    PublishTo("PROGRAMME"),
).activate()
Exemplo n.º 2
0
        Pipeline(
            ConsoleReader(),
            InterpreterTransformer(),
            ConsoleEchoer(),
        ).run()


#FILE: Server Embeddable
    if 0:
        from Kamaelia.Chassis.ConnectedServer import ServerCore
        from Kamaelia.Util.PureTransformer import PureTransformer

        def NetInterpreter(*args, **argv):
            return Pipeline(
                        PureTransformer(lambda x: str(x).rstrip()),
                        InterpreterTransformer(),
                        PureTransformer(lambda x: str(x)+"\r\n>>> "),
                   )

        ServerCore(protocol=NetInterpreter, port=1236).run()


#FILE: Pygame Embeddable
    if 1:
        from Kamaelia.UI.Pygame.Text import Textbox, TextDisplayer
        Pipeline(
            Textbox(size = (800, 300), position = (100,380)),
            InterpreterTransformer(),
            TextDisplayer(size = (800, 300), position = (100,40)),
        ).run()
Exemplo n.º 3
0
        DrawingCanvas(
            background=0xD0D0D0,  # Grey!
            surfacesize=(570, 650),
            surfaceposition=(430, 90)),
    ).activate()

    Pipeline(
        SubscribeTo("PARSEDINPUT"),
        Turtle(),
        PublishTo("PARSEDINPUT"),
    ).activate()

    Pipeline(
        Textbox(position=(20, 640),
                text_height=36,
                screen_width=400,
                screen_height=100,
                background_color=(130, 0, 70),
                text_color=(255, 255, 255)),
        PublishTo("RAWINPUT"),
    ).activate()

    Pipeline(
        SubscribeTo("DISPLAYCONSOLE"),
        TextDisplayer(position=(20, 90),
                      text_height=36,
                      screen_width=400,
                      screen_height=540,
                      background_color=(130, 0, 70),
                      text_color=(255, 255, 255))).run()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
#     http://www.kamaelia.org/AUTHORS - please extend this file,
#     not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------------
#
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.Util.Console import ConsoleEchoer
from Kamaelia.Util.PureTransformer import PureTransformer
from Kamaelia.UI.Pygame.Text import Textbox

Pipeline(Textbox(size=(800, 300), position=(0, 0)),
         PureTransformer(lambda x: x + "\n"), ConsoleEchoer()).run()
Exemplo n.º 5
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import time
from background import background
from Kamaelia.UI.Pygame.Text import Textbox
from LikeFile import LikeFile
background().start()

import Queue

TB = LikeFile(
    Textbox(position=(20, 340),
            text_height=36,
            screen_width=900,
            screen_height=400,
            background_color=(130, 0, 70),
            text_color=(255, 255, 255))).activate()

while 1:
    time.sleep(1)
    print "."
    try:
        print TB.get()
    except Queue.Empty:
        pass
Exemplo n.º 6
0
                D = self.recv("inbox")
                chans[0]._send((D, "control"))  # Pass through inbound
            yield 1


# --- End Support code ---------------------------------------------------------

if __name__ == "__main__":
    from Kamaelia.UI.Pygame.Text import TextDisplayer, Textbox

    if 0:
        from Kamaelia.Chassis.Pipeline import Pipeline
        ProcessGraphline(
            component_one=Textbox(position=(20, 340),
                                  text_height=36,
                                  screen_width=900,
                                  screen_height=200,
                                  background_color=(130, 0, 70),
                                  text_color=(255, 255, 255)),
            component_two=Pipeline(
                TextDisplayer(position=(20, 90),
                              text_height=36,
                              screen_width=900,
                              screen_height=200,
                              background_color=(130, 0, 70),
                              text_color=(255, 255, 255)),
                Textbox(position=(20, 340),
                        text_height=36,
                        screen_width=900,
                        screen_height=200,
                        background_color=(130, 0, 70),
                        text_color=(255, 255, 255)),
Exemplo n.º 7
0
from Kamaelia.UI.OpenGL.MatchedTranslationInteractor import MatchedTranslationInteractor
from Kamaelia.UI.PygameDisplay import PygameDisplay
from Kamaelia.UI.Pygame.Button import Button
from Kamaelia.UI.Pygame.Text import Textbox, TextDisplayer

from Kamaelia.UI.Pygame.VideoSurface import VideoSurface
from Kamaelia.Codec.Dirac import DiracDecoder
from Kamaelia.Util.RateFilter import MessageRateLimit
from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor
from Kamaelia.Video.PixFormatConversion import ToRGB_interleaved

# override pygame display service
ogl_display = OpenGLDisplay.getDisplayService(fullscreen=True)
PygameDisplay.setDisplayService(ogl_display[0])

READER = Textbox(size=(400, 300), text_height=30).activate()
WRITER = TextDisplayer(size=(400, 300), text_height=30).activate()

SCREEN = VideoSurface().activate()

Pipeline(
    ReadFileAdaptor("TestMaterial/TrainWindow.drc",
                    readmode="bitrate",
                    bitrate=1000000),
    DiracDecoder(),
    MessageRateLimit(10),
    ToRGB_interleaved(),
    SCREEN,
).activate()

R_ = PygameWrapper(wrap=READER, position=(-2, -2, -10),
Exemplo n.º 8
0
CANVAS  = Canvas( position=(0,40),
                   size=(800,320),
                   bgcolour = bgcolour,
                 ).activate()

CHALLENGE  = TextDisplayer(size = (390, 200),
                            position = (0,40),
                            bgcolour = bgcolour,
                            text_height=48,
                            transparent =1,
                           ).activate()

TEXT  = Textbox(size = (800, 100),
                       position = (0,260),
                       bgcolour = (255,180,255),
                       text_height=48,
                       transparent =1,
                      ).activate()
Image("/usr/local/share/kamaelia/kamaelia_logo_whitebg.png", position=(600,40)).activate()
Graphline(
           CHALLENGER  = Challenger(),
           CHALLENGE_SPLITTER = TwoWaySplitter(),
           CHALLENGE_CHECKER = Challenger_Checker(),
           SPEAKER  = PublishTo("SPEECH"),
                      
           CHALLENGE  = CHALLENGE,
           TEXT  = TEXT,
           CANVAS  = Canvas( position=(0,40),
                             size=(800,320),
                             bgcolour = bgcolour,
                           ),
Exemplo n.º 9
0
#!/usr/bin/python

from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.UI.Pygame.Text import Textbox, TextDisplayer
from Kamaelia.Internet.TCPClient import TCPClient

Pipeline(Textbox(size=(800, 300), position=(100, 380), text_height=32),
         TCPClient("127.0.0.1", 1501),
         TextDisplayer(size=(800, 300), position=(100, 40),
                       text_height=32)).run()
Exemplo n.º 10
0
        Pipeline(
            ReadFileAdaptor(file, readmode="bitrate", bitrate=300000 * 8 / 5),
            DiracDecoder(),
            MessageRateLimit(framerate),
            VideoOverlay(position=(260, 48), size=(200, 300)),
        ),
        Pipeline(
            ReadFileAdaptor(file, readmode="bitrate", bitrate=2280960 * 8),
            DiracDecoder(),
            #                      MessageRateLimit(framerate),
            ToRGB_interleaved(),
            VideoSurface(size=(200, 300), position=(600, 48)),
        ),
        Pipeline(
            PAR(
                Button(caption="Next", msg="NEXT", position=(72, 8)),
                Button(caption="Previous", msg="PREV", position=(8, 8)),
                Button(caption="First", msg="FIRST", position=(256, 8)),
                Button(caption="Last", msg="LAST", position=(320, 8)),
            ),
            Chooser(items=files),
            Image(size=(200, 300), position=(8, 48), maxpect=(200, 300)),
        ),
        Pipeline(
            Textbox(size=(200, 300), position=(8, 360)),
            TextDisplayer(size=(200, 300), position=(228, 360)),
        ),
        Ticker(size=(200, 300), position=(450, 360)),
    ),
).run()
Exemplo n.º 11
0
#!/usr/bin/python

from Kamaelia.UI.Pygame.Display import PygameDisplay
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.Util.Console import ConsoleEchoer
from Kamaelia.UI.Pygame.Text import Textbox, TextDisplayer

X = PygameDisplay(background_colour=(224, 224, 255), width=1000,
                  height=400).activate()
PygameDisplay.setDisplayService(X)

Pipeline(
    Textbox(size=(800, 150),
            position=(100, 230),
            font_file="/home/michaels/.fonts/MichaelHW.ttf",
            padding=20,
            border_size=10,
            border_colour=(128, 0, 0)),
    TextDisplayer(size=(800, 150),
                  position=(100, 40),
                  font_file="/home/michaels/.fonts/GillSans.ttf",
                  padding=20,
                  border_size=10,
                  border_colour=(0, 0, 128))).run()