Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
screen.height // 2 - 6,
speed=1,
start_frame=100))
effects.append(Print(screen,
Rainbow(screen, FigletText("NEW YEAR!")),
screen.height // 2 + 1,
speed=1,
start_frame=100))
scenes.append(Scene(effects, -1))
screen.play(scenes, stop_on_resize=True)
while True:
try:
Screen.wrapper(demo)
sys.exit(0)
except ResizeScreenError:
pass
def demo(screen):
effects = [
Cycle(
screen,
FigletText("ASCIIMATICS", font='big'),
screen.height // 2 - 8),
Cycle(
screen,
FigletText("ROCKS!", font='big'),
screen.height // 2 + 3),
Stars(screen, (screen.width + screen.height) // 2)
]
screen.play([Scene(effects, 500)])
Screen.wrapper(demo)
self._inject_mouse(screen, 0, 0, MouseEvent.RIGHT_CLICK)
ev = screen.get_event()
self.assertEqual(ev.x, 0)
self.assertEqual(ev.y, 0)
self.assertEqual(ev.buttons, MouseEvent.RIGHT_CLICK)
self.assertIsNone(screen.get_event())
# Check double click
self._inject_mouse(screen, 0, 0, MouseEvent.DOUBLE_CLICK)
ev = screen.get_event()
self.assertEqual(ev.x, 0)
self.assertEqual(ev.y, 0)
self.assertEqual(ev.buttons, MouseEvent.DOUBLE_CLICK)
self.assertIsNone(screen.get_event())
Screen.wrapper(internal_checks, height=15)
def main():
"""Summary
"""
while True:
try:
Screen.wrapper(status, catch_interrupt=True)
sys.exit(0)
except ResizeScreenError:
pass
def demo(screen, scene):
scenes = [
Scene([ListView(screen, contacts)], -1, name="Main"),
Scene([ContactView(screen, contacts)], -1, name="Edit Contact")
]
screen.play(scenes, stop_on_resize=True, start_scene=scene, allow_int=True)
contacts = ContactModel()
last_scene = None
while True:
try:
Screen.wrapper(demo, catch_interrupt=True, arguments=[last_scene])
sys.exit(0)
except ResizeScreenError as e:
last_scene = e.scene
def main():
while True:
try:
Screen.wrapper(yule_log)
sys.exit(0)
except ResizeScreenError:
pass
def init_app(reports, report):
tasks = TaskModel(reports, report)
last_scene = None
while True:
try:
Screen.wrapper(partial(task_report, tasks), catch_interrupt=False, arguments=[last_scene])
sys.exit(0)
except ResizeScreenError as e:
last_scene = e.scene
def party():
Screen.wrapper(main)
def draw(self):
"""Draws ASCII canvas on the screen."""
if sys.stdout.isatty(): # pragma: no cover
from asciimatics.screen import Screen
Screen.wrapper(self._do_draw)
else:
for line in self.canvas:
print("".join(line))