def initUIComponents(self):
        # listen to shutdown events
        ogl_display = OpenGLDisplay().getDisplayService()[0]
        self.link((ogl_display, "signal"), (self, "control"))

        # init mover
        self.mover = WheelMover(radius=15,
                                center=(0, 0, -25),
                                steps=500,
                                slots=40).activate()
        self.link((self, "mover_signal"), (self.mover, "notify"))
        self.link((self, "mover_switch"), (self.mover, "switch"))

        self.background = SkyGrassBackground(size=(5000, 5000, 0),
                                             position=(0, 0, -90)).activate()

        # create & link nav buttons
        self.up_button = ArrowButton(size=(1, 1, 0.3),
                                     position=(7, 5, -15),
                                     msg="UP").activate()
        self.down_button = ArrowButton(size=(1, 1, 0.3),
                                       position=(7, -5, -15),
                                       rotation=(0, 0, 180),
                                       msg="DOWN").activate()
        self.link((self.up_button, "outbox"), (self, "nav"))
        self.link((self.down_button, "outbox"), (self, "nav"))

        # init info display
        self.infoticker = Ticker(text_height=21,
                                 render_right=250,
                                 render_bottom=500,
                                 background_colour=(250, 250, 200),
                                 text_colour=(0, 0, 0),
                                 outline_colour=(255, 255, 255)).activate()
        self.tickerwrapper = PygameWrapper(wrap=self.infoticker,
                                           size=(2.4, 4.0, 0.3)).activate()
        self.hideinfo_button = Button(caption="Hide", fontsize=30).activate()

        infocontents = {
            self.tickerwrapper: {
                "position": (0, 0, 0)
            },
            self.hideinfo_button: {
                "position": (0, -2.4, 0)
            },
        }

        self.infocontainer = Container(contents=infocontents,
                                       position=(-10, 10, -16)).activate()
        infopath = LinearPath([(-10, 10, -16), (-3, 0, -8)], 100)

        self.infomover = PathMover(infopath, False).activate()

        self.link((self.infomover, "outbox"), (self.infocontainer, "position"))
        self.link((self, "infomover_commands"), (self.infomover, "inbox"))
        self.link((self, "torrent_info"), (self.infoticker, "inbox"))
        self.link((self.hideinfo_button, "outbox"), (self, "hide_info"))

        self.send("Stop", "infomover_commands")
def NiceTickerPrefab(**other_ticker_args):
    """Ticker that displays black text on a white background, and transforms
    any non-string arguments passed to it into strings.
    Do not pass in keywords text_height, line_spacing, background_colour,
    outline_colour, or text_colour."""
    return Pipeline(
        PureTransformer(lambda x: str(x)),
        Ticker(text_height=16,
               line_spacing=2,
               background_colour=(255, 255, 245),
               text_colour=(10, 10, 10),
               outline_colour=(0, 0, 0),
               **other_ticker_args))
Beispiel #3
0
def makeBasicSketcher(left=0, top=0, width=1024, height=768):
    return Graphline(
        CANVAS=Canvas(position=(left, top + 32 + 1),
                      size=(width - 192, (height - (32 + 15) - 1)),
                      bgcolour=(255, 255, 255),
                      notepad=notepad),
        PAINTER=Painter(),
        PALETTE=buildPalette(cols=colours,
                             order=colours_order,
                             topleft=(left + 64, top),
                             size=32),
        ERASER=Eraser(left, top),
        CLEAR=ClearPage(left + (64 * 5) + 32 * len(colours) + 1, top),
        SAVEDECK=SaveDeck(left + (64 * 8) + 32 * len(colours) + 1, top),
        LOADDECK=LoadDeck(left + (64 * 7) + 32 * len(colours) + 1, top),
        SMARTBOARD=SmartBoard(),
        DELETE=Delete(left + (64 * 6) + 32 * len(colours) + 1, top),
        CLOSEDECK=ClearScribbles(left + (64 * 9) + 32 * len(colours) + 1, top),
        QUIT=Quit(left + (64 * 10) + 32 * len(colours) + 1, top),
        PAGINGCONTROLS=PagingControls(left + 64 + 32 * len(colours) + 1, top),
        #LOCALPAGINGCONTROLS = LocalPagingControls(left+(64*6)+32*len(colours),top),
        LOCALPAGEEVENTS=LocalPageEventsFilter(),
        HISTORY=CheckpointSequencer(
            lambda X: [["LOAD", SLIDESPEC % (X, )]],
            lambda X: [["SAVE", SLIDESPEC % (X, )]],
            lambda X: [["CLEAR"]],
            initial=1,
            highest=num_pages,
            notepad=notepad,
        ),
        PAINT_SPLITTER=TwoWaySplitter(),
        #LOCALEVENT_SPLITTER = TwoWaySplitter(),
        DEBUG=ConsoleEchoer(),
        TICKER=Ticker(position=(left, top + height - 15),
                      background_colour=(220, 220, 220),
                      text_colour=(0, 0, 0),
                      text_height=(17),
                      render_right=(width),
                      render_bottom=(15)),
        linkages={
            ("CANVAS", "eventsOut"): ("PAINTER", "inbox"),
            ("PALETTE", "outbox"): ("PAINTER", "colour"),
            ("ERASER", "outbox"): ("PAINTER", "erase"),
            ("PAINTER", "outbox"): ("PAINT_SPLITTER", "inbox"),
            ("CLEAR", "outbox"): ("PAINT_SPLITTER", "inbox"),
            ("PAINT_SPLITTER", "outbox"): ("CANVAS", "inbox"),
            ("PAINT_SPLITTER", "outbox2"): ("", "outbox"),  # send to network
            ("SAVEDECK", "outbox"): ("CANVAS", "inbox"),
            ("LOADDECK", "outbox"): ("CANVAS", "inbox"),
            ("CLOSEDECK", "outbox"): ("CANVAS", "inbox"),
            ("DELETE", "outbox"): ("CANVAS", "inbox"),
            ("QUIT", "outbox"): ("CANVAS", "inbox"),

            #("LOCALPAGINGCONTROLS","outbox")  : ("LOCALEVENT_SPLITTER", "inbox"),
            #("LOCALEVENT_SPLITTER", "outbox2"): ("", "outbox"), # send to network
            #("LOCALEVENT_SPLITTER", "outbox") : ("LOCALPAGEEVENTS", "inbox"),
            ("", "inbox"): ("LOCALPAGEEVENTS", "inbox"),
            ("LOCALPAGEEVENTS", "false"): ("CANVAS", "inbox"),
            ("LOCALPAGEEVENTS", "true"): ("HISTORY", "inbox"),
            ("PAGINGCONTROLS", "outbox"): ("HISTORY", "inbox"),
            ("HISTORY", "outbox"): ("CANVAS", "inbox"),
            ("CANVAS", "outbox"): ("", "outbox"),
            ("CANVAS", "surfacechanged"): ("HISTORY", "inbox"),
            ("CANVAS", "toTicker"): ("TICKER", "inbox"),
            ("CANVAS", "toHistory"): ("HISTORY", "inbox"),
            ("SMARTBOARD", "colour"): ("PAINTER", "colour"),
            ("SMARTBOARD", "erase"): ("PAINTER", "erase"),
            ("SMARTBOARD", "toTicker"): ("TICKER", "inbox"),
        },
    )
Beispiel #4
0
            elif message.get("REMOVELISTENEVENT", None) is not None:
                self.eventswanted[message["REMOVELISTENEVENT"]] = False
                self.removeListenEvents([message["REMOVELISTENEVENT"]])


__kamaelia_components__ = (PygameWrapper,)

if __name__=='__main__':
    from Kamaelia.Util.Console import ConsoleReader
    from Kamaelia.UI.PygameDisplay import PygameDisplay
    from Kamaelia.UI.Pygame.Ticker import Ticker
    import sys;
    sys.path.append("../Pygame/")
    from MagnaDoodle import *
    
    # override pygame display service
    ogl_display = OpenGLDisplay.getDisplayService()
    PygameDisplay.setDisplayService(ogl_display[0])

    TICKER = Ticker(size = (150, 150)).activate()
    TICKER_WRAPPER = PygameWrapper(wrap=TICKER, position=(4, 1,-10), rotation=(-20,15,3)).activate()
    MAGNADOODLE = MagnaDoodle(size=(200,200)).activate()
    MAGNADOODLEWRAPPER = PygameWrapper(wrap=MAGNADOODLE, position=(-2, -2,-10), rotation=(20,10,0)).activate()
    READER = ConsoleReader().activate()
    
    READER.link( (READER,"outbox"), (TICKER, "inbox") )
    
    Axon.Scheduler.scheduler.run.runThreads()  
# Licensed to the BBC under a Contributor Agreement: THF
Beispiel #5
0
# (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.UI.Pygame.Ticker import Ticker
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor

Pipeline(
    ReadFileAdaptor("Ulysses", readmode="line", steptime=0.5),
    Ticker(
        background_colour=(128, 48, 128),
        render_left=1,
        render_top=1,
        render_right=600,
        render_bottom=200,
        position=(100, 300),
    )).run()
Beispiel #6
0
                             tex="Kamaelia.png",
                             name="1st Tex Plane"),
              BUTTON1=Button(caption="Press SPACE or click", key=K_SPACE),
              BUTTON2=Button(caption="Reverse colours",
                             fgcolour=(255, 255, 255),
                             bgcolour=(0, 0, 0)),
              BUTTON3=Button(caption="Mary...",
                             msg="Mary had a little lamb",
                             position=(200, 100)),
              ROTATOR=CubeRotator(),
              MOVER=CubeMover(),
              BUZZER=CubeBuzzer(),
              ECHO=consoleEchoer(),
              TICKER=Ticker(position=(400, 300),
                            render_left=0,
                            render_right=350,
                            render_top=0,
                            render_bottom=257),
              TEXT=datasource(),
              linkages={
                  ("PLANE", "outbox"): ("ECHO", "inbox"),
                  ("ROTATOR", "outbox"): ("PLANE", "control3d"),
                  ("BUTTON1", "outbox"): ("ECHO", "inbox"),
                  ("BUTTON2", "outbox"): ("ECHO", "inbox"),
                  ("BUTTON3", "outbox"): ("TICKER", "inbox"),
                  ("TEXT", "outbox"): ("TICKER", "inbox"),
                  ("MOVER", "outbox"): ("CUBE", "control3d"),
              }).run()

    Axon.Scheduler.scheduler.run.runThreads()
Beispiel #7
0
    from Kamaelia.Util.Graphline import Graphline
    from Kamaelia.UI.Pygame.Ticker import Ticker
    from Kamaelia.UI.Pygame.Button import Button
    from SimpleCube import *
    import sys
    sys.path.append("../pygame/")
    from MagnaDoodle import *
    sys.path.append("../../MPS/Systems/Paint/")
    from Paint import *

    Display3D.getDisplayService()[0].overridePygameDisplay()

    TEXT = datasource().activate()
    TICKER1 = Ticker(position=(400, 300),
                     render_left=0,
                     render_right=350,
                     render_top=0,
                     render_bottom=250).activate()
    TICKER1WRAPPER = PygameWrapperPlane(wrap=TICKER1,
                                        pos=Vector(-2, 1, -10),
                                        name="1st Wrapper Plane").activate()
    TICKER2 = Ticker(position=(400, 300),
                     render_left=0,
                     render_right=350,
                     render_top=0,
                     render_bottom=250).activate()
    TICKER2WRAPPER = PygameWrapperPlane(wrap=TICKER2,
                                        pos=Vector(2, 1, -10),
                                        name="2nd Wrapper Plane").activate()
    BUTTON = Button(caption="This button...",
                    msg="...can be moved AND activated!",
Beispiel #8
0
        #      self.link((clientProtocol,"outbox"), (client,"inbox"))
        #
        #      self.link((clientProtocol, "heard"), (self, "outbox"), passthrough=2)
        #      self.link((self, "inbox"), (clientProtocol, "talk"), passthrough=1)
        #      self.link((self, "topic"), (clientProtocol, "topic"), passthrough=1)
        #
        #      self.link((self, "control"), (clientProtocol, "control"), passthrough=1)
        #      self.link((clientProtocol, "signal"), (client, "control"))
        #      self.link((client, "signal"), (self, "signal"), passthrough=2)
        #
        self.addChildren(subsystem)
        yield _Axon.Ipc.newComponent(*(self.children))
        while 1:
            self.pause()
            yield 1


if __name__ == '__main__':
    from Axon.Scheduler import scheduler
    from Kamaelia.Util.Console import ConsoleReader
    from Kamaelia.UI.Pygame.Ticker import Ticker
    from Kamaelia.Util.PipelineComponent import pipeline

    pipeline(
        ConsoleReader(),
        SimpleIRCClient(host="127.0.0.1",
                        nick="kamaeliabot",
                        defaultChannel="#kamtest"),
        Ticker(render_right=800, render_bottom=600),
    ).run()
Beispiel #9
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()
Beispiel #10
0
    from Kamaelia.Util.ConsoleEcho import consoleEchoer
    from Kamaelia.Util.Graphline import Graphline
    from Kamaelia.UI.Pygame.Ticker import Ticker
    from Kamaelia.UI.Pygame.Button import Button
    from SimpleCube import *
    import sys
    sys.path.append("../../pygame/")
    from MagnaDoodle import *

    display3d = Display3D.getDisplayService()
    PygameDisplay.setDisplayService(display3d[0])

    TEXT = datasource().activate()
    TICKER1 = Ticker(size=(150, 150),
                     render_left=0,
                     render_right=350,
                     render_top=0,
                     render_bottom=250).activate()
    TICKER1WRAPPER = PygameWrapperPlane(wrap=TICKER1,
                                        pos=Vector(-4, 1, -15),
                                        name="1st Wrapper Plane").activate()
    TICKER2 = Ticker(size=(150, 150),
                     render_left=0,
                     render_right=350,
                     render_top=0,
                     render_bottom=250).activate()
    TICKER2WRAPPER = PygameWrapperPlane(wrap=TICKER2,
                                        pos=Vector(4, 1, -15),
                                        name="2nd Wrapper Plane").activate()
    BUTTON = Button(caption="This button...",
                    msg="...can be moved AND activated!",
Beispiel #11
0
def makeBasicSketcher(left=0, top=0, width=1024, height=768, is_client=False):
    if is_client:
        # This is a temporary addition to prevent slide synchronisation issues between server and client
        # This could be removed should full synchronisation of files between clients and servers be achieved
        CLEAR = nullSinkComponent()
        SAVEDECK = nullSinkComponent()
        LOADDECK = nullSinkComponent()
        DELETE = nullSinkComponent()
        CLOSEDECK = nullSinkComponent()
        PAGINGCONTROLS = nullSinkComponent()
    else:
        CLEAR = ClearPage(left + (64 * 5) + 32 * len(colours) + 1, top)
        SAVEDECK = SaveDeck(left + (64 * 8) + 32 * len(colours) + 1, top)
        LOADDECK = LoadDeck(left + (64 * 7) + 32 * len(colours) + 1, top)
        DELETE = Delete(left + (64 * 6) + 32 * len(colours) + 1, top)
        CLOSEDECK = ClearScribbles(left + (64 * 9) + 32 * len(colours) + 1,
                                   top)
        PAGINGCONTROLS = PagingControls(left + 64 + 32 * len(colours) + 1, top)
    return Graphline(
        CANVAS=Canvas(position=(left, top + 32 + 1),
                      size=(width - 192, (height - (32 + 15) - 1)),
                      bgcolour=(255, 255, 255)),
        PAINTER=Painter(),
        PALETTE=buildPalette(cols=colours,
                             order=colours_order,
                             topleft=(left + 64, top),
                             size=32),
        ERASER=Eraser(left, top),
        CLEAR=CLEAR,
        SAVEDECK=SAVEDECK,
        LOADDECK=LOADDECK,
        DECKMANAGER=Decks(config['directories']['scribbles'],
                          config['directories']['decks'], emailavailable),

        #                    SMARTBOARD = SmartBoard(),
        DELETE=DELETE,
        CLOSEDECK=CLOSEDECK,
        QUIT=Quit(left + (64 * 10) + 32 * len(colours) + 1, top),
        PAGINGCONTROLS=PAGINGCONTROLS,
        #LOCALPAGINGCONTROLS = LocalPagingControls(left+(64*6)+32*len(colours),top),
        LOCALPAGEEVENTS=LocalPageEventsFilter(),
        HISTORY=CheckpointSequencer(
            lambda X: [["LOAD", SLIDESPEC % (X, ), 'nopropogate']],
            lambda X: [["LOAD", SLIDESPEC % (X, )]],
            lambda X: [["SAVE", SLIDESPEC % (X, )]],
            lambda X: [["NEW"]],
            initial=1,
            last=num_pages,
        ),
        PAINT_SPLITTER=TwoWaySplitter(),
        #LOCALEVENT_SPLITTER = TwoWaySplitter(),
        DEBUG=ConsoleEchoer(),
        TICKER=Ticker(position=(left, top + height - 15),
                      background_colour=(220, 220, 220),
                      text_colour=(0, 0, 0),
                      text_height=(17),
                      render_right=(width),
                      render_bottom=(15)),
        EMAIL=Email(config['email']['server'], config['email']['port'],
                    config['email']['from'], config['email']['user'],
                    config['email']['pass']),
        linkages={
            ("CANVAS", "eventsOut"): ("PAINTER", "inbox"),
            ("PALETTE", "outbox"): ("PAINTER", "colour"),
            ("ERASER", "outbox"): ("PAINTER", "erase"),
            ("PAINTER", "outbox"): ("PAINT_SPLITTER", "inbox"),
            ("CLEAR", "outbox"): ("PAINT_SPLITTER", "inbox"),
            ("PAINT_SPLITTER", "outbox"): ("CANVAS", "inbox"),
            ("PAINT_SPLITTER", "outbox2"):
            ("self", "outbox"),  # send to network
            ("SAVEDECK", "outbox"): ("DECKMANAGER", "inbox"),
            ("LOADDECK", "outbox"): ("DECKMANAGER", "inbox"),
            ("CLOSEDECK", "outbox"): ("DECKMANAGER", "inbox"),
            ("DELETE", "outbox"): ("HISTORY", "inbox"),
            ("DECKMANAGER", "toTicker"): ("TICKER", "inbox"),
            ("DECKMANAGER", "toCanvas"): ("CANVAS", "inbox"),
            ("DECKMANAGER", "toSequencer"): ("HISTORY", "inbox"),
            ("QUIT", "outbox"): ("DECKMANAGER", "inbox"),

            #("LOCALPAGINGCONTROLS","outbox")  : ("LOCALEVENT_SPLITTER", "inbox"),
            #("LOCALEVENT_SPLITTER", "outbox2"): ("", "outbox"), # send to network
            #("LOCALEVENT_SPLITTER", "outbox") : ("LOCALPAGEEVENTS", "inbox"),
            ("self", "inbox"): ("LOCALPAGEEVENTS", "inbox"),
            ("LOCALPAGEEVENTS", "false"): ("CANVAS", "inbox"),
            ("LOCALPAGEEVENTS", "true"): ("HISTORY", "inbox"),
            ("PAGINGCONTROLS", "outbox"): ("HISTORY", "inbox"),
            ("HISTORY", "outbox"): ("CANVAS", "inbox"),
            ("HISTORY", "toDecks"): ("DECKMANAGER", "inbox"),
            ("CANVAS", "outbox"): ("self", "outbox"),
            ("CANVAS", "surfacechanged"): ("HISTORY", "inbox"),

            #                          ("SMARTBOARD", "colour") : ("PAINTER", "colour"),
            #                          ("SMARTBOARD", "erase") : ("PAINTER", "erase"),
            #                          ("SMARTBOARD", "toTicker") : ("TICKER", "inbox"),
            ("DECKMANAGER", "toEmail"): ("EMAIL", "inbox"),
            ("EMAIL", "outbox"): ("DECKMANAGER", "fromEmail"),
        },
    )