def _seq(self, screen, scene): scenes = [] banner_pos = (screen.width - 100) // 2 + 20 static_image = [ Print(screen, ColourImageFile(screen, op.join(DIRNAME, "assets", "images", "ibm1620.jpg"), screen.height, uni=screen.unicode_aware), y=0, speed=1, stop_frame=(21 + screen.height) * 2), Print(screen, FigletText("PyPadberg", "banner"), screen.height - 8, x=banner_pos, colour=Screen.COLOUR_BLACK, bg=Screen.COLOUR_BLACK, speed=1), Print(screen, FigletText("PyPadberg", "banner"), screen.height - 9, x=(banner_pos + 1), colour=Screen.COLOUR_WHITE, bg=Screen.COLOUR_WHITE, speed=1), ] scenes.append(Scene(static_image, name="intro2")) scenes.append(Scene([TextFormFrame(screen)], -1, name="text_entry")) scenes.append( Scene([ProcessingFrame(screen)], -1, name="display_processing")) final_frame = [Julia(screen), FinalFrame(screen)] scenes.append(Scene(final_frame, -1, name="end_menu")) screen.play(scenes, stop_on_resize=True, start_scene=scene)
def demo(screen): scenes = [] effects = [ Julia(screen), ] scenes.append(Scene(effects, -1)) screen.play(scenes, stop_on_resize=True)
def yolo_mode_effect(screen): effects = [ Print(screen, FigletText('YOLOOOO', font='big'), screen.height // 2 - 8), Julia(screen) ] screen.play([Scene(effects, 50)], repeat=False)
def test_julia(self): """ Check that Julia works. """ # Check that Julia updates every frame. screen = MagicMock(spec=Screen, colours=8, unicode_aware=False) canvas = Canvas(screen, 10, 40, 0, 0) effect = Julia(canvas) effect.reset() self.assert_blank(canvas) my_buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(20): effect.update(i) self.assertEqual(self.check_canvas( canvas, my_buffer, lambda value: self.assertIn(chr(value[0]), '@&9#GHh32As;:. ')), True) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0) # This effect should ignore events. event = object() self.assertEqual(event, effect.process_event(event))
def demo(screen, scene): global last_scene scenes = [] effects = [ Julia(screen), DemoFrame(screen) ] scenes.append(Scene(effects, -1)) screen.play(scenes, stop_on_resize=True, start_scene=scene)
def test_julia(self): """ Check that Julia works. """ # Check that Julia updates every frame. screen = MagicMock(spec=Screen, colours=8) canvas = Canvas(screen, 10, 40, 0, 0) effect = Julia(canvas) effect.reset() self.assert_blank(canvas) buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(20): effect.update(i) self.assertEqual(self.check_canvas( canvas, buffer, lambda value: self.assertIn(chr(value[0]), '@&9#GHh32As;:. ')), True) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0)
def demo(screen, scene): scenes = [] effects = [ Julia(screen), ClockFrame(screen, 0, 0), ClockFrame(screen, screen.width - 26, 0), ClockFrame(screen, 0, screen.height - 13), ClockFrame(screen, screen.width - 26, screen.height - 13), DemoFrame(screen), ] scenes.append(Scene(effects, -1)) screen.play(scenes, stop_on_resize=True, start_scene=scene)
def demo(screen, scene): scenes = [ Scene([Julia(screen), StartMenuView(screen)], -1, name="StartMenu"), Scene([Julia(screen), LoginView(screen, contacts)], -1, name="Login"), Scene( [Julia(screen), RegistrationView(screen, contacts)], -1, name="Registration"), Scene([Julia(screen), ChatsListView(screen, contacts)], -1, name="ChatsList"), Scene([Julia(screen), ChatView(screen, contacts)], -1, name="Chat"), Scene([Julia(screen), StartChatView(screen, contacts)], -1, name="StartChat") ] screen.play(scenes, stop_on_resize=True, start_scene=scene, allow_int=True)
def test_julia(self): """ Check that Julia works. """ # Check that Julia updates every frame. screen = MagicMock(spec=Screen, colours=8) canvas = Canvas(screen, 10, 40, 0, 0) effect = Julia(canvas) effect.reset() self.assert_blank(canvas) buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(20): effect.update(i) self.assertEqual( self.check_canvas( canvas, buffer, lambda value: self.assertIn( chr(value[0]), '@&9#GHh32As;:. ')), True) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0)
def julia(screen): effects = [Julia(screen)] screen.play([Scene(effects)], unhandled_input=stop_on_keypress)