pyb2d3 0.7.2__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/.pre-commit-config.yaml +3 -3
  2. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/PKG-INFO +1 -1
  3. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox/pyb2d3_sandbox/sample_base.py +5 -1
  4. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox/pyproject.toml +2 -2
  5. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_ipycanvas/pyb2d3_sandbox_ipycanvas/ipycanvas_frontend.py +11 -2
  6. {pyb2d3-0.7.2/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter → pyb2d3-0.8.0/companion_packages/pyb2d3_sandbox_ipycanvas/pyb2d3_sandbox_ipycanvas}/ui.py +19 -5
  7. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_ipycanvas/pyproject.toml +4 -4
  8. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyproject.toml +3 -3
  9. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyproject.toml +4 -4
  10. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_pygame/pyproject.toml +3 -3
  11. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/doc_tools/__init__.py +3 -0
  12. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/__init__.py +6 -2
  13. pyb2d3-0.8.0/examples/pyb2d3_samples/angry_shapes.py +112 -0
  14. pyb2d3-0.7.2/examples/pyb2d3_samples/billard.py → pyb2d3-0.8.0/examples/pyb2d3_samples/billiard.py +2 -2
  15. pyb2d3-0.8.0/examples/pyb2d3_samples/examples_common/__init__.py +35 -0
  16. pyb2d3-0.8.0/examples/pyb2d3_samples/examples_common/math.py +20 -0
  17. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/examples_common/text.py +0 -1
  18. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/goo_game.py +0 -8
  19. pyb2d3-0.8.0/examples/pyb2d3_samples/minigolf.py +125 -0
  20. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/ragdoll.py +2 -9
  21. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/text.py +2 -15
  22. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/tumbler.py +0 -10
  23. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/pyproject.toml +1 -1
  24. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/scripts/build_emscripten_forge_pkg.sh +1 -1
  25. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/scripts/build_lite_env.sh +5 -3
  26. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/scripts/build_lite_page.sh +1 -0
  27. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/scripts/examples_to_notebooks.sh +1 -1
  28. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/tests/test_samples.py +4 -0
  29. pyb2d3-0.7.2/examples/pyb2d3_samples/examples_common/__init__.py +0 -2
  30. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/.clang-format +0 -0
  31. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/.github/workflows/conda.yaml +0 -0
  32. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/.github/workflows/docs.yaml +0 -0
  33. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/.github/workflows/emscripten.yaml +0 -0
  34. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/.github/workflows/publish.yaml +0 -0
  35. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/.gitignore +0 -0
  36. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/CMakeLists.txt +0 -0
  37. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/LICENSE +0 -0
  38. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/README.md +0 -0
  39. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/build_pkg.sh +0 -0
  40. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox/pyb2d3_sandbox/__init__.py +0 -0
  41. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox/pyb2d3_sandbox/default_frontend.py +0 -0
  42. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox/pyb2d3_sandbox/frontend_base.py +0 -0
  43. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox/pyb2d3_sandbox/widgets.py +0 -0
  44. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_ipycanvas/pyb2d3_sandbox_ipycanvas/__init__.py +0 -0
  45. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_ipycanvas/pyb2d3_sandbox_ipycanvas/debug_draw_offscreen.py +0 -0
  46. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_ipycanvas/pyb2d3_sandbox_ipycanvas/debug_draw_vanilla.py +0 -0
  47. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_ipycanvas/pyb2d3_sandbox_ipycanvas/init.js +0 -0
  48. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_ipycanvas/pyb2d3_sandbox_ipycanvas/render_loop.py +0 -0
  49. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter/__init__.py +0 -0
  50. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter/canvas_widget.css +0 -0
  51. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter/canvas_widget.js +0 -0
  52. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter/canvas_widget.py +0 -0
  53. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter/exp.ipynb +0 -0
  54. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter/jupyter_debug_draw.py +0 -0
  55. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter/jupyter_frontend.py +0 -0
  56. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter/render_loop.py +0 -0
  57. {pyb2d3-0.7.2/companion_packages/pyb2d3_sandbox_ipycanvas/pyb2d3_sandbox_ipycanvas → pyb2d3-0.8.0/companion_packages/pyb2d3_sandbox_jupyter/pyb2d3_sandbox_jupyter}/ui.py +0 -0
  58. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/LICENSE-Box2D +0 -0
  59. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/LICENSE-box2d-py +0 -0
  60. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/__init__.py +0 -0
  61. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/debug_draw_gl.py +0 -0
  62. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/draw.py +0 -0
  63. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/opengl_frontend.py +0 -0
  64. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shader.py +0 -0
  65. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/background.fs +0 -0
  66. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/background.vs +0 -0
  67. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/circle.fs +0 -0
  68. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/circle.vs +0 -0
  69. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/solid_capsule.fs +0 -0
  70. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/solid_capsule.vs +0 -0
  71. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/solid_circle.fs +0 -0
  72. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/solid_circle.vs +0 -0
  73. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/solid_polygon.fs +0 -0
  74. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/solid_polygon.vs +0 -0
  75. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_opengl/pyb2d3_sandbox_opengl/shaders/solid_polygon_debug.vs +0 -0
  76. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_pygame/pyb2d3_sandbox_pygame/__init__.py +0 -0
  77. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_pygame/pyb2d3_sandbox_pygame/pygame_frontend.py +0 -0
  78. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/companion_packages/pyb2d3_sandbox_pygame/pyb2d3_sandbox_pygame/sample_to_video.py +0 -0
  79. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/dev-environment.yaml +0 -0
  80. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/.gitignore +0 -0
  81. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/Makefile +0 -0
  82. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/conf.py +0 -0
  83. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/index.rst +0 -0
  84. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/src/about_the_docs.rst +0 -0
  85. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/src/api.rst +0 -0
  86. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/src/differences.rst +0 -0
  87. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/src/installation.rst +0 -0
  88. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/docs/src/samples/index.rst +0 -0
  89. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/emscripten_forge/recipe/build_pkg.sh +0 -0
  90. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/emscripten_forge/recipe/recipe.yaml.template +0 -0
  91. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/emscripten_forge/recipe/test_pyb2d3.py +0 -0
  92. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/cast_ray_callback.py +0 -0
  93. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/chain_builder.py +0 -0
  94. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/coupled_minigolf.py +0 -0
  95. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/examples_common/ragdoll.py +0 -0
  96. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/joints.py +0 -0
  97. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/jump.py +0 -0
  98. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/meteor.py +0 -0
  99. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/mirror.py +0 -0
  100. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/newtons_cradle.py +0 -0
  101. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/raycast.py +0 -0
  102. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/shapes.py +0 -0
  103. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/examples/pyb2d3_samples/soft_bodies.py +0 -0
  104. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/extra_licenses/LICENSE_BOX2D +0 -0
  105. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/extra_licenses/LICENSE_NANOBIND +0 -0
  106. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/extra_licenses/README +0 -0
  107. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/batch_api/batch_exporters.hpp +0 -0
  108. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/batch_api/ndarray_traits.hpp +0 -0
  109. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/batch_api.hpp +0 -0
  110. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/debug_draw.hpp +0 -0
  111. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/numpy_utils.hpp +0 -0
  112. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/py_chain_def.hpp +0 -0
  113. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/py_converter.hpp +0 -0
  114. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/threadpool.hpp +0 -0
  115. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/world_to_canvas.hpp +0 -0
  116. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/include/pyb2d3/wrapper_structs.hpp +0 -0
  117. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/scripts/README.md +0 -0
  118. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/export_batch_api.cpp +0 -0
  119. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/export_box2d_types.cpp +0 -0
  120. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/export_box2d_wrapper_structs.cpp +0 -0
  121. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/export_collision.cpp +0 -0
  122. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/export_extras.cpp +0 -0
  123. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/export_math_functions.cpp +0 -0
  124. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/export_threadpool.cpp +0 -0
  125. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/export_world_to_canvas.cpp +0 -0
  126. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/main.cpp +0 -0
  127. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/module/pyb2d3/__init__.py +0 -0
  128. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/py_debug_draw.cpp +0 -0
  129. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/src/py_debug_draw.hpp +0 -0
  130. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/tests/__init__.py +0 -0
  131. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/tests/conftest.py +0 -0
  132. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/tests/headless_test_frontend.py +0 -0
  133. {pyb2d3-0.7.2 → pyb2d3-0.8.0}/tests/test_pyb2d3.py +0 -0
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v5.0.0
3
+ rev: v6.0.0
4
4
  hooks:
5
5
  - id: check-yaml
6
6
  - id: end-of-file-fixer
@@ -8,7 +8,7 @@ repos:
8
8
 
9
9
  - repo: https://github.com/astral-sh/ruff-pre-commit
10
10
  # Ruff version.
11
- rev: v0.12.7
11
+ rev: v0.14.7
12
12
  hooks:
13
13
  # Run the linter.
14
14
  - id: ruff-check
@@ -17,7 +17,7 @@ repos:
17
17
  - id: ruff-format
18
18
 
19
19
  - repo: https://github.com/pre-commit/mirrors-clang-format
20
- rev: v20.1.8
20
+ rev: v21.1.6
21
21
  hooks:
22
22
  - id: clang-format
23
23
  exclude_types: [javascript, json, python, yaml]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyb2d3
3
- Version: 0.7.2
3
+ Version: 0.8.0
4
4
  Summary: python box2d bindings for box2d >= 3.1
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -26,7 +26,11 @@ class SampleBase(object):
26
26
  sample_settings = cls.Settings()
27
27
  if frontend_class is None:
28
28
  frontend_class = get_default_frontend()
29
- if frontend_settings is None:
29
+
30
+ if isinstance(frontend_settings, dict):
31
+ print("Creating frontend settings from dict")
32
+ frontend_settings = frontend_class.Settings(**frontend_settings)
33
+ elif frontend_settings is None:
30
34
  frontend_settings = frontend_class.Settings()
31
35
 
32
36
  frontend = frontend_class(settings=frontend_settings)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyb2d3-sandbox"
3
- version = "0.7.2"
3
+ version = "0.8.0"
4
4
  description = "sandbox for pyb2d3"
5
5
  authors = [
6
6
  { name = "Dr. Thorsten Beier", email = "derthorstenbeier@gmail.com" }
@@ -10,7 +10,7 @@ requires-python = ">=3.9"
10
10
  license = { text = "MIT" }
11
11
 
12
12
  dependencies = [
13
- "pyb2d3>=0.7.2"
13
+ "pyb2d3>=0.7.4"
14
14
  ]
15
15
 
16
16
 
@@ -25,6 +25,9 @@ import traceback
25
25
 
26
26
  from ipycanvas.compat import Canvas
27
27
 
28
+ # dataclass
29
+ from dataclasses import dataclass
30
+
28
31
 
29
32
  def html_color(color):
30
33
  """Convert a color to a hex string"""
@@ -57,8 +60,14 @@ else:
57
60
  last_frontend = [None]
58
61
 
59
62
 
63
+ @dataclass
64
+ class IpycanvasFrontendSettings(FrontendBase.Settings):
65
+ layout_scale: float = 1.0
66
+ hide_controls: bool = False
67
+
68
+
60
69
  class IpycanvasFrontend(FrontendBase):
61
- Settings = FrontendBase.Settings
70
+ Settings = IpycanvasFrontendSettings
62
71
 
63
72
  def __del__(self):
64
73
  if self.cancel_loop is not None:
@@ -85,7 +94,7 @@ class IpycanvasFrontend(FrontendBase):
85
94
  self.canvas = Canvas(
86
95
  width=self.settings.canvas_shape[0],
87
96
  height=self.settings.canvas_shape[1],
88
- # layout=Layout(width='100%')
97
+ layout=dict(width="100%"),
89
98
  )
90
99
  # if a cell is re-executed, we need to cancel the previous loop,
91
100
  # otherwise we will have multiple loops running
@@ -13,17 +13,31 @@ class TestbedUI:
13
13
 
14
14
  self._header = self._make_header()
15
15
  self._right_sidebar = self._make_right_sidebar()
16
- self._left_sidebar = self._make_left_sidebar()
17
16
  self._footer = self._make_footer()
18
17
 
18
+ if frontend.settings.hide_controls:
19
+ pane_widths = [
20
+ 0,
21
+ f"{100.0 * frontend.settings.layout_scale}%",
22
+ 0,
23
+ ]
24
+ right_sidebar = None
25
+ else:
26
+ pane_widths = [
27
+ 0,
28
+ f"{70.0 * frontend.settings.layout_scale}%",
29
+ f"{30.0 * frontend.settings.layout_scale}%",
30
+ ]
31
+ right_sidebar = self._right_sidebar
32
+
19
33
  self.app_layout = ipywidgets.AppLayout(
20
34
  header=self._header,
21
35
  center=self._canvas,
22
- right_sidebar=self._right_sidebar,
23
- left_sidebar=self._left_sidebar,
36
+ right_sidebar=right_sidebar,
37
+ left_sidebar=None,
24
38
  footer=self._footer,
25
39
  pane_heights=["60px", 5, "60px"],
26
- pane_widths=[0, f"{self._canvas.width}px", 1],
40
+ pane_widths=pane_widths,
27
41
  )
28
42
 
29
43
  def _make_header(self):
@@ -216,7 +230,7 @@ class TestbedUI:
216
230
  self._debug_draw_accordion,
217
231
  self._sample_settings_accordion,
218
232
  ],
219
- layout=Layout(display="flex", justify_content="flex-start", width="400px"),
233
+ layout=Layout(display="flex", justify_content="flex-start", width="100%"),
220
234
  )
221
235
 
222
236
  def _make_left_sidebar(self):
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyb2d3-sandbox-ipycanvas"
3
- version = "0.7.2"
3
+ version = "0.8.0"
4
4
  description = "run the pyb2d3 sandbox with ipycanvas"
5
5
  authors = [
6
6
  { name = "Dr. Thorsten Beier", email = "derthorstenbeier@gmail.com" }
@@ -10,9 +10,9 @@ requires-python = ">=3.8"
10
10
  license = { text = "MIT" }
11
11
 
12
12
  dependencies = [
13
- "pyb2d3>=0.7.2",
14
- "pyb2d3-sandbox>=0.7.2",
15
- "ipycanvas>=0.14.1",
13
+ "pyb2d3>=0.7.4",
14
+ "pyb2d3-sandbox>=0.7.4",
15
+ "ipycanvas>=0.14.2",
16
16
  "ipyevents",
17
17
  ]
18
18
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyb2d3-sandbox-jupyter"
3
- version = "0.7.2"
3
+ version = "0.8.0"
4
4
  description = "run the pyb2d3 sandbox with jupyter"
5
5
  authors = [
6
6
  { name = "Dr. Thorsten Beier", email = "derthorstenbeier@gmail.com" }
@@ -10,8 +10,8 @@ requires-python = ">=3.8"
10
10
  license = { text = "MIT" }
11
11
 
12
12
  dependencies = [
13
- "pyb2d3>=0.7.2",
14
- "pyb2d3-sandbox>=0.7.2",
13
+ "pyb2d3>=0.7.4",
14
+ "pyb2d3-sandbox>=0.7.4",
15
15
  "anywidget",
16
16
  "ipywidgets>=8.0.0",
17
17
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyb2d3-sandbox-opengl"
3
- version = "0.7.2"
3
+ version = "0.8.0"
4
4
  description = "run the pyb2d3 sandbox with opengl"
5
5
  authors = [
6
6
  { name = "Your Name", email = "you@example.com" }
@@ -10,10 +10,10 @@ requires-python = ">=3.8"
10
10
  license = { text = "MIT" }
11
11
 
12
12
  dependencies = [
13
- "pyb2d3>=0.7.2",
14
- "pyb2d3-sandbox>=0.7.2",
13
+ "pyb2d3>=0.7.4",
14
+ "pyb2d3-sandbox>=0.7.4",
15
15
  "PyOpenGL>=3.1.0",
16
- "PyOpenGL_accelerate>=3.1.0",
16
+ # "PyOpenGL_accelerate>=3.1.0",
17
17
  "imgui-bundle>=1.92.0",
18
18
  ]
19
19
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyb2d3-sandbox-pygame"
3
- version = "0.7.2"
3
+ version = "0.8.0"
4
4
  description = "run the pyb2d3 sandbox with pygame"
5
5
  authors = [
6
6
  { name = "Dr. Thorsten Beier", email = "derthorstenbeier@gmail.com" }
@@ -10,8 +10,8 @@ requires-python = ">=3.8"
10
10
  license = { text = "MIT" }
11
11
 
12
12
  dependencies = [
13
- "pyb2d3>=0.7.2",
14
- "pyb2d3-sandbox>=0.7.2",
13
+ "pyb2d3>=0.7.4",
14
+ "pyb2d3-sandbox>=0.7.4",
15
15
  "pygame>=2.0.0"
16
16
  ]
17
17
 
@@ -10,9 +10,12 @@ docs_root = this_dir.parent
10
10
  html_static_path = docs_root / "_static"
11
11
  repo_root = docs_root.parent
12
12
  examples_dir = repo_root / "examples"
13
+ samples_dir = examples_dir / "pyb2d3_samples"
13
14
  companion_packages = repo_root / "companion_packages"
14
15
 
16
+
15
17
  # add to sys.path
18
+ sys.path.insert(0, str(samples_dir))
16
19
  sys.path.insert(0, str(companion_packages / "pyb2d3_sandbox"))
17
20
  sys.path.insert(0, str(companion_packages / "pyb2d3_sandbox_pygame"))
18
21
 
@@ -9,11 +9,13 @@ from .coupled_minigolf import CoupledMinigolf
9
9
  from .joints import Joints
10
10
  from .goo_game import Level1 as GooGameLevel1
11
11
  from .chain_builder import ChainBuilder
12
- from .billard import Billard
12
+ from .billiard import Billiard
13
13
  from .meteor import Meteor
14
14
  from .ragdoll import Ragdoll
15
15
  from .cast_ray_callback import CastRayCallback
16
16
  from .text import Text
17
+ from .minigolf import Minigolf
18
+ from .angry_shapes import AngryShapes
17
19
 
18
20
  all_examples = [
19
21
  Ragdoll,
@@ -29,7 +31,9 @@ all_examples = [
29
31
  Joints,
30
32
  GooGameLevel1,
31
33
  ChainBuilder,
32
- Billard,
34
+ Billiard,
33
35
  CastRayCallback,
34
36
  Text,
37
+ Minigolf,
38
+ AngryShapes,
35
39
  ]
@@ -0,0 +1,112 @@
1
+ # +
2
+ import pyb2d3 as b2d
3
+ from pyb2d3_sandbox import SampleBase
4
+ from examples_common import stacked_blocks
5
+
6
+
7
+ class AngryShapes(SampleBase):
8
+ def __init__(self, frontend, settings):
9
+ super().__init__(frontend, settings.set_gravity((0, -10)))
10
+
11
+ self.floor_size = 27.5
12
+
13
+ self.anchor_body.create_shape(
14
+ b2d.shape_def(material=b2d.surface_material(restitution=0.5)),
15
+ b2d.segment(
16
+ (-1, 0),
17
+ (28, 0),
18
+ ),
19
+ )
20
+
21
+ stacked_blocks(self.world, num_blocks_base=10, box_shape=[0.5, 3.0], start=(0, 0))
22
+
23
+ self.projectile_radius = 1.0
24
+ self.projectile_anchor_pos = b2d.Vec2(-30, 2)
25
+ self.projectile_pos = b2d.Vec2(self.projectile_anchor_pos)
26
+ self.projectile_body = None
27
+ self.projectile_state = "wait_for_movement"
28
+
29
+ def on_mouse_down(self, event):
30
+ print("state:", self.projectile_state)
31
+ if self.projectile_state == "wait_for_movement":
32
+ # inside projectile ?
33
+ d = b2d.distance(event.world_position, self.projectile_pos)
34
+ if d <= self.projectile_radius:
35
+ self.projectile_state = "dragging"
36
+
37
+ def on_mouse_move(self, event):
38
+ if self.projectile_state == "dragging":
39
+ # move projectile position to mouse position
40
+ self.projectile_pos = b2d.Vec2(event.world_position)
41
+
42
+ def on_mouse_up(self, event):
43
+ if self.projectile_state == "dragging":
44
+ # launch projectile by a force proportional to the distance from anchor
45
+ dir_vec = self.projectile_anchor_pos - event.world_position
46
+ force = dir_vec * 50
47
+
48
+ # create projectile body
49
+ self.projectile_body = self.world.create_dynamic_body(position=self.projectile_pos)
50
+
51
+ shape = self.projectile_body.create_shape(
52
+ b2d.shape_def(density=1, material=b2d.surface_material(restitution=0.5)),
53
+ b2d.circle(radius=self.projectile_radius),
54
+ )
55
+ shape.contact_events_enabled = True
56
+ shape.user_data = 1
57
+
58
+ self.projectile_body.apply_linear_impulse_to_center(force)
59
+ self.projectile_state = "launched"
60
+
61
+ def post_debug_draw(self):
62
+ if self.projectile_state == "dragging":
63
+ # draw a line from anchor to projectile position
64
+ self.debug_draw.draw_segment(
65
+ p1=self.projectile_anchor_pos,
66
+ p2=self.projectile_pos,
67
+ color=b2d.hex_color(200, 50, 50),
68
+ )
69
+ # draw the projectile (either as a circle at the position or the body if launched)
70
+ if self.projectile_body is None:
71
+ # draw circle at position
72
+ self.debug_draw.draw_solid_circle(
73
+ transform=b2d.transform(p=self.projectile_pos),
74
+ radius=self.projectile_radius,
75
+ color=b2d.hex_color(200, 50, 50),
76
+ )
77
+
78
+ def pre_update(self, dt):
79
+ events = self.world.get_contact_events()
80
+ for begin_event in events.begin_events():
81
+ last_projectile_pos = self.projectile_body.position
82
+ self.projectile_body.destroy()
83
+ self.projectile_body = None
84
+ self.projectile_pos = b2d.Vec2(self.projectile_anchor_pos)
85
+ self.projectile_state = "wait_for_movement"
86
+ # create an explosion
87
+ self.world.explode(position=last_projectile_pos, radius=5, impulse_per_length=5)
88
+ break
89
+
90
+ if self.projectile_body is not None:
91
+ # check if projectile is out of bounds
92
+ if (
93
+ self.projectile_body.position.y < -50
94
+ or self.projectile_body.position.x > self.floor_size + 100
95
+ ):
96
+ self.projectile_body.destroy()
97
+ self.projectile_body = None
98
+ self.projectile_pos = b2d.Vec2(self.projectile_anchor_pos)
99
+ self.projectile_state = "wait_for_movement"
100
+
101
+ def post_update(self, dt):
102
+ pass
103
+
104
+ def aabb(self):
105
+ return b2d.aabb(
106
+ lower_bound=(-50, -10),
107
+ upper_bound=(35, 60),
108
+ )
109
+
110
+
111
+ if __name__ == "__main__":
112
+ AngryShapes.run()
@@ -28,7 +28,7 @@ class GameState(enum.Enum):
28
28
  WAITING_FOR_BALLS_TO_REST = enum.auto()
29
29
 
30
30
 
31
- class Billard(SampleBase):
31
+ class Billiard(SampleBase):
32
32
  def __init__(self, frontend, settings):
33
33
  super().__init__(frontend, settings.set_gravity((0, 0)))
34
34
 
@@ -300,4 +300,4 @@ class Billard(SampleBase):
300
300
 
301
301
 
302
302
  if __name__ == "__main__":
303
- Billard.run()
303
+ Billiard.run()
@@ -0,0 +1,35 @@
1
+ from .ragdoll import Ragdoll # noqa: F401
2
+ from .text import create_boxes_from_text # noqa: F401
3
+ from .math import truncated_vector_diff, interpolate_color # noqa: F401
4
+
5
+ import pyb2d3 as b2d
6
+
7
+
8
+ def stacked_blocks(world, num_blocks_base, box_shape, start):
9
+ start_x = start[0]
10
+ start_y = start[1]
11
+ distance_x = box_shape[1]
12
+
13
+ for outer in range(num_blocks_base):
14
+ start_y_inner = start_y + outer * (box_shape[1] + box_shape[0])
15
+ for i in range(num_blocks_base - outer):
16
+ x = start_x + (i + outer / 2) * distance_x
17
+ y = start_y_inner + box_shape[1] / 2
18
+ body = world.create_dynamic_body(position=(x, y))
19
+ body.create_shape(
20
+ b2d.shape_def(density=1, material=b2d.surface_material(restitution=0.5)),
21
+ b2d.box(hx=box_shape[0] / 2, hy=box_shape[1] / 2),
22
+ )
23
+
24
+ if i + 1 < num_blocks_base - outer:
25
+ # create a second block on top
26
+ body = world.create_dynamic_body(
27
+ position=(
28
+ x + box_shape[1] / 2,
29
+ start_y_inner + box_shape[1] + box_shape[0] / 2,
30
+ )
31
+ )
32
+ body.create_shape(
33
+ b2d.shape_def(density=1, material=b2d.surface_material(restitution=0.5)),
34
+ b2d.box(hx=box_shape[1] / 2, hy=box_shape[0] / 2),
35
+ )
@@ -0,0 +1,20 @@
1
+ import numpy as np
2
+
3
+
4
+ def truncated_vector_diff(vec_a, vec_b, max_length):
5
+ """Returns the vector difference vec_b - vec_a, truncated to max_length."""
6
+
7
+ diff = np.array(vec_b) - np.array(vec_a)
8
+ length = np.linalg.norm(diff)
9
+ if length > max_length:
10
+ diff = (diff / length) * max_length
11
+ return diff
12
+
13
+
14
+ def interpolate_color(color_a, color_b, t):
15
+ """Interpolate between two colors given as (r, g, b) tuples with t in [0, 1]."""
16
+ return (
17
+ int(color_a[0] + (color_b[0] - color_a[0]) * t),
18
+ int(color_a[1] + (color_b[1] - color_a[1]) * t),
19
+ int(color_a[2] + (color_b[2] - color_a[2]) * t),
20
+ )
@@ -38,7 +38,6 @@ def create_boxes_from_text(world, text, position, height, font_size=20):
38
38
  y = (y) * scaling + 0.5 * scaling
39
39
  return position[0] + x, position[1] + y
40
40
 
41
- print(arr.shape, scaling)
42
41
  pixel_width = scaling
43
42
  pixel_height = scaling
44
43
 
@@ -13,14 +13,6 @@ FORCE_VECTOR_DRAW_WIDTH = 0.05
13
13
  MAX_FORCE_VECTOR_LENGTH = 2
14
14
 
15
15
 
16
- @dataclass
17
- class LevelData:
18
- pass
19
-
20
-
21
- Levels = [LevelData(), LevelData()]
22
-
23
-
24
16
  class UserDataStore(object):
25
17
  def __init__(self):
26
18
  self.id = 0
@@ -0,0 +1,125 @@
1
+ # +
2
+ import pyb2d3 as b2d
3
+ import numpy as np
4
+ from enum import Enum
5
+ from pyb2d3_sandbox import SampleBase
6
+ from examples_common.math import truncated_vector_diff, interpolate_color
7
+
8
+
9
+ class GolfState(Enum):
10
+ WAITING_FOR_BALL_CLICK = 0 # we are waiting for the user to click on a ball
11
+ SET_DRAG_FORCE = 1 # user is setting the force via mouse drag/move
12
+ WAITING_FOR_REST = 2 # we are waiting for the ball to come to rest
13
+ BALL_IS_IN_HOLE = 3 # the ball is in the hole, we can reset the level
14
+
15
+
16
+ class Minigolf(SampleBase):
17
+ def __init__(self, frontend, settings):
18
+ super().__init__(frontend, settings.set_gravity((0, 0)))
19
+
20
+ # create the minigolf course
21
+ builder = b2d.PathBuilder((0, 0))
22
+ builder.line_to(right=4)
23
+ self.hole_position = builder.arc_to(
24
+ up=2, radius=1.5, clockwise=False, segments=60, major_arc=True
25
+ )
26
+ builder.line_to(left=4)
27
+ builder.line_to(down=2)
28
+ self.anchor_body.create_chain(builder.chain_def(is_loop=True, reverse=True))
29
+ points = np.array(builder.points)
30
+ self.bounds = (points.min(axis=0), points.max(axis=0))
31
+
32
+ # create a ball
33
+ self.ball_radius = 0.1
34
+ self.ball = self.world.create_dynamic_body(
35
+ position=(0.5, 1), linear_damping=0.5, fixed_rotation=True
36
+ )
37
+ self.ball.create_shape(
38
+ b2d.shape_def(density=1, material=b2d.surface_material(restitution=1.0, friction=0.5)),
39
+ b2d.circle(radius=self.ball_radius),
40
+ )
41
+
42
+ self.hole_radius = 0.2
43
+ self.drag_pos = None
44
+ self.hole_anchor_body = self.world.create_static_body(position=self.hole_position)
45
+ self.game_state = GolfState.WAITING_FOR_BALL_CLICK
46
+ self.drag_start_pos = None
47
+
48
+ def on_mouse_down(self, event):
49
+ if self.game_state == GolfState.WAITING_FOR_BALL_CLICK and self.ball.shapes[0].test_point(
50
+ event.world_position
51
+ ):
52
+ self.game_state = GolfState.SET_DRAG_FORCE
53
+ self.drag_start_pos = b2d.Vec2(event.world_position)
54
+
55
+ def on_mouse_move(self, event):
56
+ if self.game_state == GolfState.SET_DRAG_FORCE:
57
+ raw_drag_pos = event.world_position
58
+ drag_vector = truncated_vector_diff(self.ball.position, raw_drag_pos, max_length=1.0)
59
+ self.drag_pos = np.array(self.ball.position) + drag_vector
60
+
61
+ def on_mouse_up(self, event):
62
+ if self.game_state == GolfState.SET_DRAG_FORCE:
63
+ # we are setting the force, so we apply it now
64
+ force_vector = np.array(self.drag_pos) - np.array(self.ball.position)
65
+ force_vector *= -15
66
+ self.ball.apply_force_to_center(force_vector, True)
67
+ self.game_state = GolfState.WAITING_FOR_REST
68
+ self.drag_pos = None
69
+
70
+ def post_update(self, dt):
71
+ if self.game_state == GolfState.WAITING_FOR_REST:
72
+ dist_to_hole = np.linalg.norm(
73
+ np.array(self.ball.position) - np.array(self.hole_position)
74
+ )
75
+ if dist_to_hole < (self.hole_radius - self.ball_radius):
76
+ self.game_state = GolfState.BALL_IS_IN_HOLE
77
+
78
+ # connect ball to hole with a distance joint.
79
+ # this gives a very nice effect of the ball rotating into the hole
80
+ self.world.create_distance_joint(
81
+ body_a=self.ball,
82
+ body_b=self.hole_anchor_body,
83
+ length=self.hole_radius / 3.0, # make sure ball is inside hole
84
+ enable_spring=True,
85
+ hertz=100,
86
+ damping_ratio=1.0,
87
+ )
88
+ return
89
+
90
+ if (
91
+ self.game_state == GolfState.BALL_IS_IN_HOLE
92
+ or self.game_state == GolfState.WAITING_FOR_REST
93
+ ):
94
+ speed = np.linalg.norm(self.ball.linear_velocity)
95
+ if speed < 0.01:
96
+ if self.game_state == GolfState.BALL_IS_IN_HOLE:
97
+ self.frontend.set_sample(self.__class__, self.settings)
98
+ else:
99
+ self.game_state = GolfState.WAITING_FOR_BALL_CLICK
100
+
101
+ def aabb(self):
102
+ lower_bound = (self.bounds[0][0] - 3, self.bounds[0][1] - 1)
103
+ upper_bound = (self.bounds[1][0] + 3, self.bounds[1][1] + 1)
104
+
105
+ return b2d.aabb(lower_bound=lower_bound, upper_bound=upper_bound)
106
+
107
+ def pre_debug_draw(self):
108
+ self.debug_draw.draw_solid_circle(
109
+ transform=b2d.transform(self.hole_position),
110
+ radius=self.hole_radius,
111
+ color=b2d.hex_color(0, 0, 0),
112
+ )
113
+
114
+ if self.game_state == GolfState.SET_DRAG_FORCE and self.drag_pos is not None:
115
+ drag_vector_length = np.linalg.norm(self.drag_pos - self.ball.position)
116
+ color = interpolate_color((255, 255, 0), (255, 0, 0), drag_vector_length)
117
+ self.debug_draw.draw_segment(
118
+ self.ball.position,
119
+ self.drag_pos,
120
+ color=b2d.hex_color(*color),
121
+ )
122
+
123
+
124
+ if __name__ == "__main__":
125
+ Minigolf.run()
@@ -3,14 +3,7 @@ import pyb2d3 as b2d
3
3
  from pyb2d3_sandbox import SampleBase
4
4
  import random
5
5
 
6
- try:
7
- import examples_common # noqa: F401, E402
8
- except ImportError:
9
- import os
10
- import sys
11
-
12
- sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
13
- import examples_common # noqa: F401, E402
6
+ from examples_common import Ragdoll as RagdollComposit
14
7
 
15
8
 
16
9
  class Ragdoll(SampleBase):
@@ -31,7 +24,7 @@ class Ragdoll(SampleBase):
31
24
  num_bodies = 15
32
25
  for _ in range(num_bodies):
33
26
  # ragdoll at the center
34
- self.ragdoll = examples_common.Ragdoll(
27
+ self.ragdoll = RagdollComposit(
35
28
  scale=7.0,
36
29
  world=self.world,
37
30
  position=rand_pos(),
@@ -1,18 +1,7 @@
1
1
  # +
2
2
  import pyb2d3 as b2d
3
3
  from pyb2d3_sandbox import SampleBase
4
-
5
- # from PIL import Image, ImageDraw, ImageFont
6
-
7
-
8
- try:
9
- import examples_common # noqa: F401, E402
10
- except ImportError:
11
- import os
12
- import sys
13
-
14
- sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
15
- import examples_common # noqa: F401, E402
4
+ from examples_common import create_boxes_from_text
16
5
 
17
6
 
18
7
  class Text(SampleBase):
@@ -28,9 +17,7 @@ class Text(SampleBase):
28
17
  b2d.chain_box(center=(0, 0), hx=self.box_radius, hy=self.box_radius)
29
18
  )
30
19
 
31
- examples_common.create_boxes_from_text(
32
- world=self.world, text="pyb2d3", height=3, position=(-3, 0)
33
- )
20
+ create_boxes_from_text(world=self.world, text="notebook link", height=3, position=(-12, 0))
34
21
 
35
22
  def aabb(self):
36
23
  return b2d.aabb(
@@ -4,16 +4,6 @@ from pyb2d3_sandbox.sample_base import SampleBase
4
4
  import random
5
5
 
6
6
 
7
- try:
8
- import examples_common # noqa: F401, E402
9
- except ImportError:
10
- import os
11
- import sys
12
-
13
- sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
14
- import examples_common # noqa: F401, E402
15
-
16
-
17
7
  class Tumbler(SampleBase):
18
8
  def __init__(self, frontend, settings):
19
9
  super().__init__(frontend, settings)
@@ -13,7 +13,7 @@ classifiers = [
13
13
  description = "python box2d bindings for box2d >= 3.1"
14
14
  name = "pyb2d3"
15
15
  requires-python = ">=3.9"
16
- version = "0.7.2"
16
+ version = "0.8.0"
17
17
 
18
18
  license = "MIT"
19
19
  license-files = [
@@ -21,7 +21,7 @@ cp -r "$REPO_ROOT/extra_licenses" "$RECIPE_SRC_DIR/extra_licenses"
21
21
  cp -r "$REPO_ROOT/companion_packages" "$RECIPE_SRC_DIR/companion_packages"
22
22
  cp "$REPO_ROOT/CMakeLists.txt" "$RECIPE_SRC_DIR/"
23
23
  cp "$REPO_ROOT/LICENSE" "$RECIPE_SRC_DIR/"
24
- cp "$REPO_ROOT/pyproject.toml" "$RECIPE_SRC_DIR/"
24
+ cp "$REPO_ROOT/pyproject.toml" "$RECIPE_SRC_DIR/"
25
25
 
26
26
 
27
27
  # replace PATH_PLACEHOLDER_TO_BE_REPLACED in the recipe.yaml.template with the actual path
@@ -32,14 +32,16 @@ if true ; then
32
32
  micromamba create -n $WASM_ENV_NAME \
33
33
  --platform=emscripten-wasm32 \
34
34
  -c $OUTPUT_DIR \
35
+ -c conda-forge \
35
36
  -c https://repo.prefix.dev/emscripten-forge-dev \
36
37
  --yes \
38
+ "ipycanvas>=0.14.2" \
37
39
  "python>=3.13" \
38
40
  xeus-python \
39
41
  ipywidgets \
40
- "ipycanvas>=0.14.1" \
42
+ "ipycanvas>=0.14.2" \
41
43
  "pyb2d3>=0.5.6" \
42
- "pyb2d3-sandbox>=0.5.6" \
43
- "pyb2d3-sandbox-ipycanvas>=0.5.6" \
44
44
  "pillow"
45
+ # "pyb2d3-sandbox>=0.5.6" \
46
+ # "pyb2d3-sandbox-ipycanvas>=0.5.6" \
45
47
  fi
@@ -31,6 +31,7 @@ if false ; then
31
31
 
32
32
  micromamba create -n $WASM_ENV_NAME \
33
33
  --platform=emscripten-wasm32 \
34
+ -c conda-forge \
34
35
  -c $OUTPUT_DIR \
35
36
  -c https://repo.prefix.dev/emscripten-forge-dev \
36
37
  --yes \
@@ -15,7 +15,7 @@ for file in pyb2d3_samples/*.py; do
15
15
  continue
16
16
  fi
17
17
  base="${filename%.py}"
18
- jupytext "$file" --to notebook --output "notebooks/${base}.ipynb" --update-metadata '{"kernelspec": {"name": "xpython"}}'
18
+ jupytext "$file" --to notebook --output "notebooks/${base}.ipynb" --update-metadata '{"kernelspec": {"name": "xpython", "display_name": "Python 3.13 (XPython)","language": "python"}}'
19
19
  done
20
20
 
21
21
  cp -r pyb2d3_samples/examples_common/ notebooks/examples_common
@@ -7,6 +7,10 @@ from .headless_test_frontend import run_in_headless_test_frontend
7
7
  this_dir = Path(__file__).parent
8
8
  pyb2d_dir = this_dir.parent
9
9
  examples_dir = pyb2d_dir / "examples"
10
+ samples_dir = examples_dir / "pyb2d3_samples"
11
+
12
+ # add samples directory to the path
13
+ sys.path.append(str(samples_dir))
10
14
 
11
15
  # add examples directory to the path
12
16
  sys.path.append(str(examples_dir))
@@ -1,2 +0,0 @@
1
- from .ragdoll import Ragdoll # noqa: F401
2
- from .text import create_boxes_from_text # noqa: F401
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes