Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade docs dependencies + tweaks #204

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 10 additions & 10 deletions docs/reference/context/windowconfig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 47 additions & 0 deletions make.py
Original file line number Diff line number Diff line change
@@ -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 <command>")
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:])
7 changes: 4 additions & 3 deletions moderngl_window/context/base/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"]
Expand Down Expand Up @@ -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",
Expand Down