Verified Commit ea81574b authored by Jakob Moser's avatar Jakob Moser
Browse files

Make package executable

parent 9eef193b
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
import argparse

from poolpay.display.Display import Display
from pathlib import Path

from poolpay.display.get_test_picture import get_test_picture


def action_test(display: Display) -> None:
    test_picture = get_test_picture(display.width, display.height)
    display.show(test_picture)


ACTIONS = {"test": action_test}


def parse_args() -> argparse.Namespace:
    parser = argparse.ArgumentParser(
        prog="poolpay.display",
        description="Experimental util to interface with a Framebuffer display",
    )
    parser.add_argument(
        "action",
        choices=["test"],
        help="the action to be done (currently, must always be 'test')",
    )

    return parser.parse_args()


# Parse the command line arguments
args = parse_args()

display = Display(Path("/dev/fb0"), width=480, height=320)

# Call the selected action
ACTIONS[args.action](display)