Ejemplo n.º 1
0
def main(screen, scene):
    config = Config(os.getcwd() + '\murphyzahl.cfg')
    game = Game(config)
    splashScene = Scene([Background(screen),
                         SplashScreenFrame(screen, game)],
                        -1,
                        name="Splash")
    gameScene = Scene(
        [Background(screen), GameScreenFrame(screen, game)], -1, name="Game")
    scenes = [splashScene, gameScene]

    screen.play(scenes, stop_on_resize=True, start_scene=splashScene)
Ejemplo n.º 2
0
def run_frame_callback(screen, scene, frame_type, frame_data):
    if frame_type is FrameType.FIRST:
        main_frame = CommonSettingsFrame(screen, frame_type, frame_data)
    elif frame_type is FrameType.REGULAR:
        main_frame = EditFrame(screen, frame_type, frame_data)
    elif frame_type is FrameType.LAST:
        main_frame = FinishFrame(screen, frame_type, frame_data)
    scenes = [Scene([Background(screen), main_frame], -1)]
    screen.play(scenes, stop_on_resize=True, start_scene=scene, allow_int=True)
Ejemplo n.º 3
0
def play_scenes(screen, scene, inventory):
    if sys.platform.startswith("win"):
        background_color = 0
    else:
        background_color = 234  # To match vscode gray

    screen.play(
        [Scene([Background(screen, bg=background_color), MainFrame(screen, inventory)], -1)],
        stop_on_resize=True,
        start_scene=scene,
        allow_int=True,
        unhandled_input=global_shortcuts,
    )
Ejemplo n.º 4
0
def demo(screen, scene):
    screen.play(
        [Scene([Background(screen), DemoFrame(screen)], -1)],
        stop_on_resize=True,
        start_scene=scene,
        allow_int=True)
Ejemplo n.º 5
0
def contest_screen(screen, scene, contest):
    screen.play([Scene(
        [Background(screen), DemoFrame(screen, contest)], -1)],
                stop_on_resize=True,
                start_scene=scene)
Ejemplo n.º 6
0
def _credits(screen):
    scenes = []

    effects = [
        Matrix(screen, stop_frame=200),
        Print(screen,
              FigletText("Catch Me", "banner3"),
              screen.height - 31,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=50,
              stop_frame=200),
        Print(screen,
              FigletText("(On Time)", "banner3"),
              screen.height - 21,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=75,
              stop_frame=200),
        Print(screen,
              FigletText("If You Can", "banner3"),
              screen.height - 11,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=100,
              stop_frame=200)
    ]
    scenes.append(Scene(effects, 250, clear=False))

    effects = [
        Background(screen, bg=Screen.COLOUR_BLACK),
        Print(screen,
              FigletText("Understanding the", "banner"),
              screen.height - 31,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=0,
              stop_frame=200),
        Print(screen,
              FigletText("Effectiveness of", "banner"),
              screen.height - 21,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=25,
              stop_frame=200),
        Print(screen,
              FigletText("Twitter URL Blacklist", "banner"),
              screen.height - 11,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=50,
              stop_frame=200)
    ]
    scenes.append(Scene(effects, 250, clear=False))

    effects = [
        Background(screen, bg=Screen.COLOUR_BLACK),
        Print(screen,
              FigletText("Authors:", "banner"),
              screen.height - 21,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=0,
              stop_frame=50,
              clear=1),
        Print(screen,
              FigletText("Simon Bell", "banner"),
              screen.height - 21,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=50,
              stop_frame=100,
              clear=1),
        Print(screen,
              FigletText("Lorenzo Cavallaro", "banner"),
              screen.height - 21,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              clear=1,
              start_frame=100,
              stop_frame=150),
        Print(screen,
              FigletText("Kenny Paterson", "banner"),
              screen.height - 21,
              colour=Screen.COLOUR_WHITE,
              bg=Screen.COLOUR_WHITE,
              speed=1,
              start_frame=150,
              stop_frame=200),
    ]
    scenes.append(Scene(effects))

    effects = [
        Background(screen, bg=Screen.COLOUR_BLACK),
        BannerText(
            screen,
            FigletText("Live  measurement  experiments  in  progress",
                       font='banner3',
                       width=400),
            #screen.height // 2 - 3,
            screen.height - 21,
            Screen.COLOUR_GREEN)
    ]
    scenes.append(Scene(effects))

    screen.play(scenes, stop_on_resize=True)
Ejemplo n.º 7
0
    def __init__(self, *args, **kwargs):
        dkwargsForSelf = {
            'title': "Ascui App",
            'data': {},
            'name': None,
            'exitCode': 0,
            'theme': None,
            'autoExampleWidgets': True,
            'quitLabel': 'Quit',
            'quitIsAtTop': False,
            'parent': None,
            'quitAskMsg': 'Quit? Are you sure?',
        }
        Easy.DictOfDefaultsOntoObj(self, dkwargsForSelf, kwargs)

        #self.lastReturnInfo = None

        self.initChainable()

        #self.returns = []

        if self.name is None:
            self.name = self.title.replace(' ', '')

        self.screen = Screen.open()

        self.frameWidth = int(self.screen.width * 9 // 10)
        self.frameHeight = int(self.screen.height * 9 // 10)

        ## AscuiFrame is subclass of frame but auto exits on esc
        self.frame = AscuiFrame(
            self.screen,
            self.frameHeight,
            self.frameWidth,
            ## frame can auto create its data dict, but it's
            ## better to pass our own in
            parent=self,
            data=self.data,
            has_shadow=False,  #was self.hasShadowRef,
            name=self.name,
            quitAskMsg=self.quitAskMsg,
        )
        self.data = self.frame.data  ## this is kinda redundant now
        if self.theme is not None:
            self.frame.set_theme(self.theme)

        self.background = Background(self.screen)

        #self.widgets={}
        #self.layouts = {}
        #self.layouts['default'] =

        #self.layout = self.frame.layouts["DefaultLayout"]
        #Layout(  self.layoutColumnWidths ) #[1, 18, 1])

        self.frame.createWidget("Label", "AppTitle", self.title)
        if self.quitIsAtTop == True:
            self.frame.createQuitButton(label=self.quitLabel, inFooter=True)
            self.frame.createWidget("Divider", "Divider01", "", height=3)

        self.initWidgets()

        if self.quitIsAtTop == False:
            #self.frame.createWidget( "Spacer", height=1, inFooter=True)
            self.frame.createWidget("Divider",
                                    "Divider01",
                                    "",
                                    height=3,
                                    inFooter=True)
            self.frame.createQuitButton(label=self.quitLabel, inFooter=True)

        ## Frame is a subclass of Effect, and Scenes are collections of effects
        self.scene = Scene([
            self.background,
            self.frame,
        ], -1)  ## what is the -1 for? investigate