From ca0d4778f3b584ed14b01105e09e31d560e6383f Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sat, 30 Nov 2024 16:23:32 +0100 Subject: [PATCH] Include BaseKeys in docs #126 --- docs/reference/context/base.rst | 5 +++++ make.py | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/docs/reference/context/base.rst b/docs/reference/context/base.rst index 8e616f2..839e4d2 100644 --- a/docs/reference/context/base.rst +++ b/docs/reference/context/base.rst @@ -13,3 +13,8 @@ :members: :inherited-members: :show-inheritance: + + +.. autoclass:: moderngl_window.context.base.BaseKeys + :members: + :undoc-members: diff --git a/make.py b/make.py index 8d97120..5a52174 100644 --- a/make.py +++ b/make.py @@ -5,6 +5,8 @@ import sys import shutil import subprocess +import threading +import webbrowser def docs(): @@ -31,24 +33,50 @@ def test(): subprocess.run("pytest tests/", shell=True) +def serve(): + """Serve the documentation""" + print("Serving documentation...") + + def start_server(): + subprocess.run("python -m http.server --directory build/docs", shell=True) + + server_thread = threading.Thread(target=start_server) + server_thread.start() + + webbrowser.open("http://localhost:8000") + print("Press Ctrl+C to stop the server") + server_thread.join() + + def run(args: list[str]): commands = { "html": docs, "lint": lint, "clean": clean, "test": test, + "serve": serve, } if len(args) == 0: - print("Usage: make.py ") + print_help() return func = commands.get(args[0]) if func is None: - print(f"Unknown command: {args[0]}") + print_help() return func() +def print_help(): + print("Usage: make.py ") + print("Commands:") + print(" html: Build the documentation") + print(" lint: Run pylint") + print(" clean: Clean up docs and build artifacts") + print(" test: Run tests") + print(" serve: Serve the documentation") + + if __name__ == "__main__": run(sys.argv[1:])