Пример #1
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"),
        },
    )
Пример #2
0
 left = 0
 colours_order = [ "black", "red", "orange", "yellow", "green", "turquoise", "blue", "purple", "darkgrey", "lightgrey" ]
 ogl_display = OpenGLDisplay(title="Kamaelia Whiteboard",width=width,height=height,background_colour=(255,255,255))
 ogl_display.activate()
 OpenGLDisplay.setDisplayService(ogl_display)
 
 ogl_display = OpenGLDisplay.getDisplayService()
 PygameDisplay.setDisplayService(ogl_display[0])
 
 if (0):
     #PygameDisplay.setDisplayService(ogl_display)
     CANVAS = Canvas( position=(left,top+32),size=(1200,(900-(32+15))),notepad="Test" ).activate() #(replace width with 'width' and height with 'height-(32+15)'
     PAINTER = Painter().activate()
     CANVAS_WRAPPER = PygameWrapper(wrap=CANVAS, position=(0,0,-10), rotation=(0,0,0)).activate() 
     ERASER  = Eraser(left,top).activate()
     PALETTE = buildPalette( cols=colours, order=colours_order, topleft=(left+64,top), size=32 ).activate()
     CLEAR = ClearPage(left+(64*5)+32*len(colours),top).activate()
     #PALETTE_WRAPPER = PygameWrapper(wrap=PALETTE, position=(4,1,-10), rotation=(-20,15,3)).activate()
 
     #PAINTER_WRAPPER = PygameWrapper(wrap=PAINTER, position=(4,1,-10), rotation=(-20,15,3)).activate()
     CANVAS.link( (PAINTER,"outbox"), (CANVAS, "inbox") )
     PAINTER.link( (CANVAS,"eventsOut"), (PAINTER, "inbox") )
     PAINTER.link( (PALETTE,"outbox"), (PAINTER, "colour") )
     PAINTER.link( (ERASER, "outbox"), (PAINTER, "erase") )
     PAINTER.link( (CLEAR, "outbox"), (CANVAS, "inbox") )
     
 CANVAS = Canvas( position=(left,top+32),size=(1200,(900-(32+15))),notepad="Test" ).activate() #(replace width with 'width' and height with 'height-(32+15)'
 PAINTER = Painter().activate()
 ERASER  = Eraser(left,top).activate()
 PALETTE = buildPalette( cols=colours, order=colours_order, topleft=(left+64,top), size=32 ).activate()
 CLEAR = ClearPage(left+(64*5)+32*len(colours),top).activate()    
Пример #3
0
def makeBasicSketcher(left=0, top=0, width=1024, height=768):
    CANVAS = Canvas(position=(left, top + 32), size=(width, (height - (32 + 15))), notepad=notepad)
    CANVAS_WRAPPER = PygameWrapper(wrap=CANVAS, position=(0, 0, -10), rotation=(0, 0, 0))
    return Graphline(
        CANVAS=CANVAS,
        CANVAS_WRAPPER=CANVAS_WRAPPER,
        # MOVER = MatchedTranslationInteractor(target=CANVAS_WRAPPER),
        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), top),
        SAVEDECK=SaveDeck(left + (64 * 8) + 32 * len(colours), top),
        LOADDECK=LoadDeck(left + (64 * 7) + 32 * len(colours), top),
        SMARTBOARD=SmartBoard(),
        # WEBCAM = Webcam(),
        CLOSEDECK=ClearScribbles(left + (64 * 9) + 32 * len(colours), top),
        DELETE=Delete(left + (64 * 6) + 32 * len(colours), top),
        QUIT=Quit(left + (64 * 10) + 32 * len(colours), top),
        PAGINGCONTROLS=PagingControls(left + 64 + 32 * len(colours), 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"),
            # ("WEBCAM", "outbox") : ("CANVAS", "inbox"),
            # ("WEBCAM", "networkout") : ("", "outbox"), # send to network
        },
    )
Пример #4
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"),
                          },
                    )
Пример #5
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"),
        },
    )