diff --git a/README.md b/README.md index 860b653..5b0ed31 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ pytest ```bash pip install -e .[dev] -sphinx-build -b html docs docs/_build +sphinx-build -b html docs build/docs ``` ## Contributing diff --git a/docs/conf.py b/docs/conf.py index 0cec1b9..72c6b97 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -74,6 +74,8 @@ def __getattr__(cls: Any, name: Any) -> MagicMock: "sphinx.ext.coverage", "sphinx.ext.viewcode", "sphinx.ext.napoleon", + "sphinx_rtd_theme", # Read the Docs theme + # "sphinx_rtd_dark_mode", # Dark mode for the RTD theme ] # Add any paths that contain templates here, relative to this directory. diff --git a/docs/reference/context/windowconfig.rst b/docs/reference/context/windowconfig.rst index f2e654b..c513a74 100644 --- a/docs/reference/context/windowconfig.rst +++ b/docs/reference/context/windowconfig.rst @@ -12,17 +12,17 @@ Methods .. automethod:: WindowConfig.__init__ .. automethod:: WindowConfig.run -.. automethod:: WindowConfig.render -.. automethod:: WindowConfig.resize -.. automethod:: WindowConfig.close .. automethod:: WindowConfig.add_arguments -.. automethod:: WindowConfig.key_event -.. automethod:: WindowConfig.mouse_position_event -.. automethod:: WindowConfig.mouse_press_event -.. automethod:: WindowConfig.mouse_release_event -.. automethod:: WindowConfig.mouse_drag_event -.. automethod:: WindowConfig.mouse_scroll_event -.. automethod:: WindowConfig.unicode_char_entered +.. automethod:: WindowConfig.on_render +.. automethod:: WindowConfig.on_resize +.. automethod:: WindowConfig.on_close +.. automethod:: WindowConfig.on_key_event +.. automethod:: WindowConfig.on_mouse_position_event +.. automethod:: WindowConfig.on_mouse_press_event +.. automethod:: WindowConfig.on_mouse_release_event +.. automethod:: WindowConfig.on_mouse_drag_event +.. automethod:: WindowConfig.on_mouse_scroll_event +.. automethod:: WindowConfig.on_unicode_char_entered .. automethod:: WindowConfig.load_texture_2d .. automethod:: WindowConfig.load_texture_array .. automethod:: WindowConfig.load_texture_cube diff --git a/make.py b/make.py new file mode 100644 index 0000000..9042f48 --- /dev/null +++ b/make.py @@ -0,0 +1,47 @@ +""" +FIXME: Improve this later. mypy also needs to be included in the linting. +""" + +import sys +import shutil +import subprocess + + +def docs(): + """Sphinx documentation""" + print("Building documentation...") + subprocess.run("sphinx-build docs build/docs", shell=True) + + +def clean(): + """Clean up docs and build artifacts""" + print("Cleaning up...") + shutil.rmtree("build", ignore_errors=True) + + +def lint(): + """Run pylint""" + print("Running pylint...") + subprocess.run("ruff check", shell=True) + + +def run(args: list[str]): + commands = { + "html": docs, + "lint": lint, + "clean": clean, + } + if len(args) == 0: + print("Usage: make.py ") + return + + func = commands.get(args[0]) + if func is None: + print(f"Unknown command: {args[0]}") + return + + func() + + +if __name__ == "__main__": + run(sys.argv[1:]) diff --git a/moderngl_window/context/base/window.py b/moderngl_window/context/base/window.py index 67da5cb..166f50a 100644 --- a/moderngl_window/context/base/window.py +++ b/moderngl_window/context/base/window.py @@ -688,14 +688,15 @@ def convert_window_coordinates( Convert window coordinates to top-left coordinate space. The default origin is the top left corner of the window. - Args : + - If you are converting from bottom origin coordinates use x_flipped=True + - If you are converting from right origin coordinates use y_flipped=True + + Args: x_flipped (bool) - if the input x origin is flipped y_flipped (bool) - if the input y origin is flipped Returns: tuple (x, y) of converted window coordinates - If you are converting from bottom origin coordinates use x_flipped=True - If you are converting from right origin coordinates use y_flipped=True """ if not y_flipped and not x_flipped: return (x, y) diff --git a/pyproject.toml b/pyproject.toml index 053d50a..56afdbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,6 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -# zip-safe = false dependencies = [ "moderngl<6", "pyglet>=2.0.0", @@ -43,7 +42,12 @@ dev = [ "build", "ruff", ] -docs = ["Sphinx~=7.2.6 ", "sphinx-rtd-theme~=1.3.0 ", "doc8"] +docs = [ + "Sphinx~=8.1.3 ", + "sphinx-rtd-theme~=3.0.1", + "sphinx-rtd-dark-mode==1.3.0", + "doc8", +] imgui = ["imgui-bundle"] # 1.6.0 originally pygame = ["pygame>=2.0.1"] pygame-ce = ["pygame-ce>=2.0.1"] @@ -72,6 +76,7 @@ build-backend = "setuptools.build_meta" exclude = [ "docs", "tests", + # These are a complete mess to lint "moderngl_window/context/tk/keys.py", "moderngl_window/context/sdl2/keys.py", "moderngl_window/context/pyside2/keys.py",