mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2025-01-12 12:28:13 +00:00
42 lines
724 B
Python
42 lines
724 B
Python
from contextlib import contextmanager
|
|
import sys
|
|
|
|
|
|
@contextmanager
|
|
def html():
|
|
sys.stdout.write('\x1bP;HTML|')
|
|
yield
|
|
sys.stdout.write('\x1bP')
|
|
sys.stdout.flush()
|
|
|
|
|
|
@contextmanager
|
|
def image(mime='image'):
|
|
sys.stdout.write('\x1bP;IMAGE|%s;' % mime)
|
|
yield
|
|
sys.stdout.write('\x1bP\n')
|
|
sys.stdout.flush()
|
|
|
|
|
|
@contextmanager
|
|
def prompt():
|
|
sys.stdout.write('\x1bP;PROMPT|')
|
|
yield
|
|
sys.stdout.write('\x1bP')
|
|
sys.stdout.flush()
|
|
|
|
|
|
@contextmanager
|
|
def text():
|
|
sys.stdout.write('\x1bP;TEXT|')
|
|
yield
|
|
sys.stdout.write('\x1bP')
|
|
sys.stdout.flush()
|
|
|
|
|
|
@contextmanager
|
|
def sass():
|
|
sys.stdout.write('\x1bP;SASS|')
|
|
yield
|
|
sys.stdout.write('\x1bP')
|
|
sys.stdout.flush()
|