Exemple #1
0
def pager(line=""):
    global CURRENT_LINE
    global MAX_PAGE_LINES
    if CURRENT_LINE > MAX_PAGE_LINES - 3 and not args.no_page:
        print(PAGE_TEXT, end="")
        c = getch()
        print(CLEAR_TEXT, end="")
        CURRENT_LINE = 0
        MAX_PAGE_LINES = get_max_lines()
        if c == 'q' or c == 'Q' or ord(c) == 3:
            sys.exit(0)
    try:
        print(line)
    except UnicodeEncodeError:
        print(line.encode('ascii', 'replace'))
    if not args.no_page:
        CURRENT_LINE = CURRENT_LINE + 1
Exemple #2
0
        old = termios.tcgetattr(fd)
        try:
            tty.setraw(fd)
            return sys.stdin.read(1)
        finally:
            termios.tcsetattr(fd, termios.TCSADRAIN, old)

from vamp.in_a_world import get_max_lines, get_max_columns, ensure_path
from vamp.config import Config
from vamp.git import check_git
from vamp.bank import Bank
from vamp.package import PackageHandler
from vamp.manifest import Manifest

# UI setup
MAX_PAGE_LINES = get_max_lines()
MAX_PAGE_WIDTH = get_max_columns()
CURRENT_LINE = 0
PAGE_TEXT = Style.BRIGHT + \
    "Press any key to continue, Q to quit...\r" + Style.NORMAL
CLEAR_TEXT = ' ' * len(PAGE_TEXT) + "\r"
RESET_TEXT = Fore.RESET + Style.NORMAL
init()

# The pagination method
def pager(line=""):
    global CURRENT_LINE
    global MAX_PAGE_LINES
    if CURRENT_LINE > MAX_PAGE_LINES - 3 and not args.no_page:
        print(PAGE_TEXT, end="")
        c = getch()