bdsim 1.2.0__tar.gz → 1.2.2__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 (302) hide show
  1. {bdsim-1.2.0 → bdsim-1.2.2}/PKG-INFO +3 -2
  2. {bdsim-1.2.0 → bdsim-1.2.2}/README.md +1 -1
  3. {bdsim-1.2.0 → bdsim-1.2.2}/pyproject.toml +2 -1
  4. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/bdedit.py +7 -0
  5. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_graphics_wire.py +19 -3
  6. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_importer.py +6 -2
  7. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_param_window.py +46 -16
  8. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_wire.py +25 -5
  9. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/grouping_box_graphics.py +18 -3
  10. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/interface.py +9 -0
  11. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/interface_manager.py +34 -0
  12. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/interface_scene.py +50 -4
  13. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/__init__.py +2 -1
  14. bdsim-1.2.2/src/bdsim/bin/bdrun.py +131 -0
  15. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/block.py +307 -91
  16. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/block_types.py +4 -4
  17. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blockdiagram.py +316 -28
  18. bdsim-1.2.2/src/bdsim/blocks/Icons/integrator_s.png +0 -0
  19. bdsim-1.2.2/src/bdsim/blocks/Icons/poseintegrator_s.png +0 -0
  20. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/continuous.py +12 -71
  21. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/displays.py +104 -18
  22. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/functions.py +8 -8
  23. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/sampled.py +24 -94
  24. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/spatial.py +150 -2
  25. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/components.py +5 -1
  26. bdsim-1.2.2/src/bdsim/display.py +289 -0
  27. bdsim-1.2.2/src/bdsim/notebook_patches.py +333 -0
  28. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/run_sim.py +483 -172
  29. {bdsim-1.2.0 → bdsim-1.2.2}/tests/blocks/test_blocks_continuous.py +18 -0
  30. {bdsim-1.2.0 → bdsim-1.2.2}/tests/blocks/test_blocks_functions.py +1 -1
  31. {bdsim-1.2.0 → bdsim-1.2.2}/tests/blocks/test_blocks_sampled.py +2 -0
  32. bdsim-1.2.2/tests/fixtures/has_integrator_s.bd +51 -0
  33. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_bdedit.py +191 -0
  34. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_bdrun.py +19 -15
  35. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_bdsim.py +24 -2
  36. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_blockdiagram.py +66 -2
  37. bdsim-1.2.2/tests/test_display_manager.py +228 -0
  38. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_graphics.py +99 -18
  39. bdsim-1.2.2/tests/test_notebook_patches.py +526 -0
  40. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_run_sim.py +42 -3
  41. bdsim-1.2.2/tests/test_sampled_continuous_output.py +258 -0
  42. bdsim-1.2.0/src/bdsim/bin/bdrun.py +0 -178
  43. bdsim-1.2.0/src/bdsim/blocks/IO/Firmata.py +0 -96
  44. bdsim-1.2.0/src/bdsim/blocks/IO/README.md +0 -19
  45. bdsim-1.2.0/src/bdsim/run_realtime.py +0 -552
  46. {bdsim-1.2.0 → bdsim-1.2.2}/.gitignore +0 -0
  47. {bdsim-1.2.0 → bdsim-1.2.2}/LICENSE +0 -0
  48. {bdsim-1.2.0 → bdsim-1.2.2}/examples/README.md +0 -0
  49. {bdsim-1.2.0 → bdsim-1.2.2}/examples/RVC2/README.md +0 -0
  50. {bdsim-1.2.0 → bdsim-1.2.2}/examples/RVC3/README.md +0 -0
  51. {bdsim-1.2.0 → bdsim-1.2.2}/src/README.md +0 -0
  52. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/abort.png +0 -0
  53. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/bdsim_icon.png +0 -0
  54. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/bdsim_icon2.png +0 -0
  55. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/bdsim_logo.png +0 -0
  56. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/bdsim_logo2.png +0 -0
  57. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/bold.png +0 -0
  58. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/center_align.png +0 -0
  59. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/clear_format.png +0 -0
  60. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/color_picker.png +0 -0
  61. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/error.png +0 -0
  62. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/export_as.png +0 -0
  63. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/help.png +0 -0
  64. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/italic.png +0 -0
  65. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/left_align.png +0 -0
  66. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/main.png +0 -0
  67. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/new_file.png +0 -0
  68. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/old/bold.png +0 -0
  69. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/old/center_align.png +0 -0
  70. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/old/clear_format.png +0 -0
  71. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/old/color_picker.png +0 -0
  72. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/old/italics.png +0 -0
  73. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/old/left_align.png +0 -0
  74. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/old/right_align.png +0 -0
  75. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/old/underline.png +0 -0
  76. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/open_folder.png +0 -0
  77. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/overlap.svg +0 -0
  78. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/quit.png +0 -0
  79. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/redo.png +0 -0
  80. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/remove.png +0 -0
  81. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/right_align.png +0 -0
  82. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/run.png +0 -0
  83. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/save.png +0 -0
  84. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/save_as.png +0 -0
  85. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/simTime.png +0 -0
  86. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/simTime2.png +0 -0
  87. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/success.png +0 -0
  88. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/underline.png +0 -0
  89. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons/undo.png +0 -0
  90. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons.py +0 -0
  91. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/Icons.qrc +0 -0
  92. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/LICENSE +0 -0
  93. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/README.md +0 -0
  94. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/TechReport.md +0 -0
  95. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/__init__.py +0 -0
  96. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/associate_bd_windows.py +0 -0
  97. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block.py +0 -0
  98. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_connector_block.py +0 -0
  99. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_graphics_block.py +0 -0
  100. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_graphics_socket.py +0 -0
  101. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_main_block.py +0 -0
  102. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/block_socket.py +0 -0
  103. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/.buildinfo +0 -0
  104. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_sources/bdedit.rst.txt +0 -0
  105. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_sources/index.rst.txt +0 -0
  106. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_sources/modules.rst.txt +0 -0
  107. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/alabaster.css +0 -0
  108. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/basic.css +0 -0
  109. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/badge_only.css +0 -0
  110. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/Roboto-Slab-Bold.woff +0 -0
  111. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
  112. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/Roboto-Slab-Regular.woff +0 -0
  113. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
  114. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/fontawesome-webfont.eot +0 -0
  115. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/fontawesome-webfont.svg +0 -0
  116. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/fontawesome-webfont.ttf +0 -0
  117. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/fontawesome-webfont.woff +0 -0
  118. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/fontawesome-webfont.woff2 +0 -0
  119. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/lato-bold-italic.woff +0 -0
  120. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/lato-bold-italic.woff2 +0 -0
  121. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/lato-bold.woff +0 -0
  122. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/lato-bold.woff2 +0 -0
  123. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/lato-normal-italic.woff +0 -0
  124. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/lato-normal-italic.woff2 +0 -0
  125. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/lato-normal.woff +0 -0
  126. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/fonts/lato-normal.woff2 +0 -0
  127. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/css/theme.css +0 -0
  128. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/custom.css +0 -0
  129. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/doctools.js +0 -0
  130. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/documentation_options.js +0 -0
  131. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/file.png +0 -0
  132. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Inconsolata-Bold.ttf +0 -0
  133. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Inconsolata-Regular.ttf +0 -0
  134. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Inconsolata.ttf +0 -0
  135. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-bold.eot +0 -0
  136. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-bold.ttf +0 -0
  137. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-bold.woff +0 -0
  138. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-bold.woff2 +0 -0
  139. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-bolditalic.eot +0 -0
  140. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-bolditalic.ttf +0 -0
  141. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-bolditalic.woff +0 -0
  142. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-bolditalic.woff2 +0 -0
  143. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-italic.eot +0 -0
  144. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-italic.ttf +0 -0
  145. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-italic.woff +0 -0
  146. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-italic.woff2 +0 -0
  147. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-regular.eot +0 -0
  148. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-regular.ttf +0 -0
  149. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-regular.woff +0 -0
  150. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato/lato-regular.woff2 +0 -0
  151. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato-Bold.ttf +0 -0
  152. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/Lato-Regular.ttf +0 -0
  153. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot +0 -0
  154. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf +0 -0
  155. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff +0 -0
  156. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 +0 -0
  157. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot +0 -0
  158. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf +0 -0
  159. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff +0 -0
  160. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 +0 -0
  161. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab-Bold.ttf +0 -0
  162. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/RobotoSlab-Regular.ttf +0 -0
  163. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/fontawesome-webfont.eot +0 -0
  164. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/fontawesome-webfont.svg +0 -0
  165. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/fontawesome-webfont.ttf +0 -0
  166. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/fontawesome-webfont.woff +0 -0
  167. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/fonts/fontawesome-webfont.woff2 +0 -0
  168. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/jquery-3.5.1.js +0 -0
  169. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/jquery.js +0 -0
  170. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/js/badge_only.js +0 -0
  171. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/js/html5shiv-printshiv.min.js +0 -0
  172. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/js/html5shiv.min.js +0 -0
  173. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/js/modernizr.min.js +0 -0
  174. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/js/theme.js +0 -0
  175. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/language_data.js +0 -0
  176. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/minus.png +0 -0
  177. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/plus.png +0 -0
  178. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/pygments.css +0 -0
  179. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/searchtools.js +0 -0
  180. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/underscore-1.13.1.js +0 -0
  181. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/_static/underscore.js +0 -0
  182. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/bdedit.html +0 -0
  183. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/genindex.html +0 -0
  184. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/index.html +0 -0
  185. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/modules.html +0 -0
  186. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/objects.inv +0 -0
  187. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/py-modindex.html +0 -0
  188. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/search.html +0 -0
  189. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docs/searchindex.js +0 -0
  190. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/docstring.md +0 -0
  191. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/APPENDIX_A-High_Level_Class_Architecture_Diagram.png +0 -0
  192. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/APPENDIX_B-Wire_logic_step_2.PNG +0 -0
  193. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/APPENDIX_B-Wire_logic_step_3.1.PNG +0 -0
  194. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/APPENDIX_B-Wire_logic_step_3.2.PNG +0 -0
  195. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_1.1-Example_of_System_as_a_Block_Diagram.png +0 -0
  196. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_1.2-Example_of_Block_Diagram_as_represented_in_bdedit.png +0 -0
  197. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.1-Bdedit_Graphical_User_Interface.png +0 -0
  198. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.10-User-Feedback_Messages.png +0 -0
  199. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.11-Background_Colour_Modes.png +0 -0
  200. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.2-Adding_Blocks_to_Canvas_and_Connecting_them.png +0 -0
  201. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.3-Examples_of_Blocks.png +0 -0
  202. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.4-Example_of_Flipping_Socket_Orientation.png +0 -0
  203. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.5-Block_and_Wire_Selected.png +0 -0
  204. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.6-Example_of_Dragging_Wire.png +0 -0
  205. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.7-Usage_of_Connector_Blocks.png +0 -0
  206. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.8-Toggling_Wire_Intersection_Detection_ON.png +0 -0
  207. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_2.9-Parameter_Window.png +0 -0
  208. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_3.1-BdEdit_Architecture_Diagram.png +0 -0
  209. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_4.1-Relevant_bdsim_File_Structure.png +0 -0
  210. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_4.2-Block_Type_Files.png +0 -0
  211. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Figure_4.3-QResource_File_Structure.png +0 -0
  212. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/GroupingBoxes.png +0 -0
  213. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/JSON_file_example_code_1.PNG +0 -0
  214. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/JSON_file_example_code_2.PNG +0 -0
  215. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/JSON_file_example_diagram.png +0 -0
  216. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/figs/Main.png +0 -0
  217. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/floating_label.py +0 -0
  218. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/floating_label_graphics.py +0 -0
  219. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/grouping_box.py +0 -0
  220. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/interface_graphics_scene.py +0 -0
  221. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/interface_graphics_view.py +0 -0
  222. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/interface_scene_history.py +0 -0
  223. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/interface_serialize.py +0 -0
  224. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/make_app.py +0 -0
  225. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdedit/tex2icon.py +0 -0
  226. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/_blockdiagram_mixin.py +0 -0
  227. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/_selftest.py +0 -0
  228. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/bin/stubgen.py +0 -0
  229. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/README.md +0 -0
  230. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/clip.png +0 -0
  231. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/cond.png +0 -0
  232. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/constant.png +0 -0
  233. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/demux.png +0 -0
  234. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/demux_flipped.png +0 -0
  235. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/deriv.png +0 -0
  236. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/det.png +0 -0
  237. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/dict.png +0 -0
  238. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/dintegrator.png +0 -0
  239. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/dposeintegrator.png +0 -0
  240. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/flatten.png +0 -0
  241. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/function.png +0 -0
  242. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/gain.png +0 -0
  243. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/gain_flipped.png +0 -0
  244. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/icons.sh +0 -0
  245. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/index.png +0 -0
  246. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/integrator.png +0 -0
  247. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/interpolate.png +0 -0
  248. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/inverse.png +0 -0
  249. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/item.png +0 -0
  250. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/log.png +0 -0
  251. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/log_flipped.png +0 -0
  252. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/lti_siso.png +0 -0
  253. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/lti_ss.png +0 -0
  254. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/mux.png +0 -0
  255. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/mux_flipped.png +0 -0
  256. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/norm.png +0 -0
  257. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/null.png +0 -0
  258. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/pid.png +0 -0
  259. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/piecewise.png +0 -0
  260. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/pose_inverse.png +0 -0
  261. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/pose_postmul.png +0 -0
  262. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/pose_premul.png +0 -0
  263. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/poseintegerator.png +0 -0
  264. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/pow.png +0 -0
  265. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/print.png +0 -0
  266. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/prod.png +0 -0
  267. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/ramp.png +0 -0
  268. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/scope.png +0 -0
  269. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/scopexy.png +0 -0
  270. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/scopexy1.png +0 -0
  271. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/slice1.png +0 -0
  272. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/slice2.png +0 -0
  273. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/step.png +0 -0
  274. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/stop.png +0 -0
  275. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/sum.png +0 -0
  276. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/time.png +0 -0
  277. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/transform_vector.png +0 -0
  278. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/transpose.png +0 -0
  279. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/watch.png +0 -0
  280. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/waveform.png +0 -0
  281. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/Icons/zoh.png +0 -0
  282. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/README.md +0 -0
  283. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/__init__.py +0 -0
  284. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/connections.py +0 -0
  285. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/linalg.py +0 -0
  286. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/sinks.py +0 -0
  287. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/sources.py +0 -0
  288. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/blocks/vision.py +0 -0
  289. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/connect.py +0 -0
  290. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/exceptions.py +0 -0
  291. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/graphics.py +0 -0
  292. {bdsim-1.2.0 → bdsim-1.2.2}/src/bdsim/run_context.py +0 -0
  293. {bdsim-1.2.0 → bdsim-1.2.2}/tests/__init__.py +0 -0
  294. {bdsim-1.2.0 → bdsim-1.2.2}/tests/blocks/test_blocks_connections.py +0 -0
  295. {bdsim-1.2.0 → bdsim-1.2.2}/tests/blocks/test_blocks_linalg.py +0 -0
  296. {bdsim-1.2.0 → bdsim-1.2.2}/tests/blocks/test_blocks_sinks.py +0 -0
  297. {bdsim-1.2.0 → bdsim-1.2.2}/tests/blocks/test_blocks_sources.py +0 -0
  298. {bdsim-1.2.0 → bdsim-1.2.2}/tests/blocks/test_blocks_spatial.py +0 -0
  299. {bdsim-1.2.0 → bdsim-1.2.2}/tests/conftest.py +0 -0
  300. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_components.py +0 -0
  301. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_examples_smoke.py +0 -0
  302. {bdsim-1.2.0 → bdsim-1.2.2}/tests/test_notebooks_smoke.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bdsim
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: Simulate dynamic systems expressed in block diagram form using Python
5
5
  Project-URL: homepage, https://github.com/petercorke/bdsim
6
6
  Project-URL: documentation, https://petercorke.github.io/bdsim/
@@ -53,6 +53,7 @@ Requires-Dist: uvicorn[standard]>=0.29; extra == 'bdweb'
53
53
  Provides-Extra: dev
54
54
  Requires-Dist: coverage; extra == 'dev'
55
55
  Requires-Dist: flake8; extra == 'dev'
56
+ Requires-Dist: ipython; extra == 'dev'
56
57
  Requires-Dist: pytest; extra == 'dev'
57
58
  Requires-Dist: pytest-qt; extra == 'dev'
58
59
  Requires-Dist: pytest-timeout; extra == 'dev'
@@ -165,7 +166,7 @@ In contrast to traditional graphical simulation tools, bdsim treats modelling as
165
166
 
166
167
  * Better Version Control: No more opaque binary blobs. Your models are searchable, diffable text.
167
168
 
168
- * Seamless Integration: Incorporate SciPy solvers, PyTorch models, or custom computer vision pipelines directly into your simulation loops.
169
+ * Seamless Integration: Incorporate SciPy solvers, PyTorch models, or custom robotic vision pipelines directly into your simulation loops.
169
170
 
170
171
  * Scalability: Programmatically generate massive block diagrams or run large-scale batch simulations on headless servers.
171
172
 
@@ -94,7 +94,7 @@ In contrast to traditional graphical simulation tools, bdsim treats modelling as
94
94
 
95
95
  * Better Version Control: No more opaque binary blobs. Your models are searchable, diffable text.
96
96
 
97
- * Seamless Integration: Incorporate SciPy solvers, PyTorch models, or custom computer vision pipelines directly into your simulation loops.
97
+ * Seamless Integration: Incorporate SciPy solvers, PyTorch models, or custom robotic vision pipelines directly into your simulation loops.
98
98
 
99
99
  * Scalability: Programmatically generate massive block diagrams or run large-scale batch simulations on headless servers.
100
100
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bdsim"
3
- version = "1.2.0"
3
+ version = "1.2.2"
4
4
  authors = [{ name = "Peter Corke", email = "rvc@petercorke.com" }]
5
5
 
6
6
  dependencies = [
@@ -38,6 +38,7 @@ dev = [
38
38
  "pytest-qt",
39
39
  "coverage",
40
40
  "flake8",
41
+ "ipython",
41
42
  ]
42
43
 
43
44
  docs = [
@@ -7,6 +7,7 @@ import ctypes
7
7
  import argparse
8
8
  import threading
9
9
  import traceback
10
+ import faulthandler
10
11
  from pathlib import Path
11
12
 
12
13
  from sys import platform
@@ -166,6 +167,12 @@ def main():
166
167
 
167
168
  sys.excepthook = _handle_unhandled_exception
168
169
 
170
+ # Enable faulthandler so that if a C/native library crashes (e.g. AppKit
171
+ # NSCursor, OpenGL driver) Python prints a full traceback to stderr before
172
+ # the process dies. sys.excepthook cannot catch native crashes — they are
173
+ # SIGSEGV/SIGABRT signals raised inside C code, not Python exceptions.
174
+ faulthandler.enable()
175
+
169
176
  if hasattr(threading, "excepthook"):
170
177
 
171
178
  def _threading_excepthook(args):
@@ -82,6 +82,7 @@ class GraphicsWire(QGraphicsPathItem):
82
82
  self.segment_handles = {}
83
83
  self.handleSelected = None
84
84
  self.mousePressPos = None
85
+ self._current_cursor_shape = Qt.ArrowCursor
85
86
 
86
87
  self.wire = wire
87
88
 
@@ -245,7 +246,7 @@ class GraphicsWire(QGraphicsPathItem):
245
246
  width = 8
246
247
 
247
248
  self.wire_points = []
248
- (p1x, p1y) = self.wire.wire_coordinates[0]
249
+ p1x, p1y = self.wire.wire_coordinates[0]
249
250
  self.wire_points.append(QPointF(p1x, p1y))
250
251
 
251
252
  for i, (x, y) in enumerate(self.wire.wire_coordinates):
@@ -443,7 +444,7 @@ class GraphicsWire(QGraphicsPathItem):
443
444
  handle = self.handleAt(moveEvent.pos())
444
445
  # print("handle:", handle)
445
446
  cursor = Qt.ArrowCursor if handle is None else self.handleCursors[handle]
446
- self.setCursor(cursor)
447
+ self._setCursorIfChanged(cursor)
447
448
  super().hoverMoveEvent(moveEvent)
448
449
 
449
450
  # -----------------------------------------------------------------------------
@@ -451,9 +452,24 @@ class GraphicsWire(QGraphicsPathItem):
451
452
  """
452
453
  Executed when the mouse leaves the shape (NOT PRESSED).
453
454
  """
454
- self.setCursor(Qt.ArrowCursor)
455
+ self._setCursorIfChanged(Qt.ArrowCursor)
455
456
  super().hoverLeaveEvent(moveEvent)
456
457
 
458
+ # -----------------------------------------------------------------------------
459
+ def _setCursorIfChanged(self, cursor_shape):
460
+ """Avoid redundant cursor updates that can stress native cursor registration."""
461
+ app = QApplication.instance()
462
+ if (
463
+ sys.platform == "darwin"
464
+ and app is not None
465
+ and app.activePopupWidget() is not None
466
+ ):
467
+ # Avoid native cursor updates while a popup menu is active on macOS.
468
+ return
469
+ if cursor_shape != self._current_cursor_shape:
470
+ self.setCursor(cursor_shape)
471
+ self._current_cursor_shape = cursor_shape
472
+
457
473
  # -----------------------------------------------------------------------------
458
474
  def mousePressEvent(self, mouseEvent):
459
475
  """
@@ -83,7 +83,11 @@ def _safe_parse_default_from_text(text):
83
83
  try:
84
84
  return ast.literal_eval(candidate)
85
85
  except Exception:
86
- return candidate
86
+ # Ignore prose defaults like "defaults to block name ..." and only
87
+ # accept simple single-token identifiers (for example: auto).
88
+ if re.fullmatch(r"[A-Za-z_][A-Za-z0-9_]*", candidate):
89
+ return candidate
90
+ return None
87
91
 
88
92
 
89
93
  def _parse_keyword_options_from_text(text):
@@ -445,7 +449,7 @@ def import_blocks(scene, window):
445
449
  ] and param_value_docstring[i + 1] in ["to"]:
446
450
  # Value only has 1 default, which should follow after the word 'to'
447
451
  # Try to evaluate value, if successful, this is some form of non string
448
- if param_value is None:
452
+ if param_value is None and (i + 3) >= len(param_value_docstring):
449
453
  try:
450
454
  param_value = ast.literal_eval(
451
455
  param_value_docstring[i + 2]
@@ -78,11 +78,14 @@ class ParamWindow(QWidget):
78
78
  self.layout = QVBoxLayout()
79
79
 
80
80
  # Definition of with of the parameter window, and the lines holding
81
- # the block parameters inside it. The width is fixed to 300 pixels, scaled
82
- # to what 300 pixels should look like on 2560 screen width resolution
83
- self._parameter_line_width = 150
84
- self._width = 300 * self.block.window.scale
81
+ # the block parameters inside it. The width is fixed to 390 pixels, scaled
82
+ # to what 390 pixels should look like on 2560 screen width resolution.
83
+ # This keeps the RHS popout about 30% wider than before.
84
+ self._parameter_line_width = 195
85
+ self._width = 390 * self.block.window.scale
85
86
  self.setFixedWidth(self._width)
87
+ self.setMinimumWidth(int(self._width))
88
+ self.block.window.setColumnMinimumWidth(10, int(self._width))
86
89
 
87
90
  # Variable to update title of model when parameter values have been changed,
88
91
  # to indicate that there is unsaved progress
@@ -287,7 +290,7 @@ class ParamWindow(QWidget):
287
290
  # If the parameter type is a boolean, create the intractable space as a checkbox, otherwise
288
291
  # make an editable line for that parameter, and populate it with the parameters' current value
289
292
  if not issubclass(parameter[1], bool):
290
- self.line = QLineEdit(str(parameter[2]))
293
+ self.line = QLineEdit("" if parameter[2] is None else str(parameter[2]))
291
294
  else:
292
295
  self.line = QCheckBox()
293
296
  self.line.setChecked(
@@ -398,6 +401,14 @@ class ParamWindow(QWidget):
398
401
 
399
402
  return message
400
403
 
404
+ def allows_none(options):
405
+ if not options:
406
+ return False
407
+ for option in options:
408
+ if option[0] == "type" and type(None) in option[1]:
409
+ return True
410
+ return False
411
+
401
412
  # Update the title
402
413
  duplicate_title = []
403
414
  # UpdateName is returned as None if there are no issues with setting a title
@@ -423,29 +434,48 @@ class ParamWindow(QWidget):
423
434
  if self.parameters:
424
435
 
425
436
  # For each definition of a parameter, in the blocks' defined parameters
426
- for [paramName, paramType, paramVal, paramOptions, _] in self.parameters:
437
+ for parameter in self.parameters:
438
+ if len(parameter) == 5:
439
+ paramName, paramType, paramVal, paramOptions, _ = parameter
440
+ elif len(parameter) == 4:
441
+ paramName, paramType, paramVal, paramOptions = parameter
442
+ else:
443
+ raise ValueError(
444
+ f"Unsupported parameter spec for {self.block.block_type}: {parameter!r}"
445
+ )
427
446
  i += 1
428
447
 
429
448
  # If parameter type is boolean, then retrieve checked state of checkbox, otherwise
430
449
  # extract the text from the editable line as the value to set the parameter to
431
450
  if not issubclass(paramType, bool):
432
- inputValue = self.parameter_values[i].text()
451
+ inputValue = self.parameter_values[i].text().strip()
433
452
  else:
434
453
  inputValue = str(self.parameter_values[i].isChecked())
435
454
 
436
455
  # If a value has been provided for that parameter, perform sanity checking on that input
437
- if inputValue:
438
- if self.parameters[i][0] in ["nin", "ops", "signs", "nout"]:
439
- inputInCompatibleFormat = self.getSafeValue(
440
- inputValue, paramType, paramOptions
441
- )
442
- else:
443
- if inputValue.startswith("="):
444
- inputInCompatibleFormat = inputValue
445
- else:
456
+ if inputValue or (not issubclass(paramType, bool) and (paramVal is None or allows_none(paramOptions))):
457
+ if (
458
+ not issubclass(paramType, bool)
459
+ and inputValue == ""
460
+ and (paramVal is None or allows_none(paramOptions))
461
+ ):
462
+ inputInCompatibleFormat = None
463
+ elif not issubclass(paramType, bool):
464
+ if self.parameters[i][0] in ["nin", "ops", "signs", "nout"]:
446
465
  inputInCompatibleFormat = self.getSafeValue(
447
466
  inputValue, paramType, paramOptions
448
467
  )
468
+ else:
469
+ if inputValue.startswith("="):
470
+ inputInCompatibleFormat = inputValue
471
+ else:
472
+ inputInCompatibleFormat = self.getSafeValue(
473
+ inputValue, paramType, paramOptions
474
+ )
475
+ else:
476
+ inputInCompatibleFormat = self.getSafeValue(
477
+ inputValue, paramType, paramOptions
478
+ )
449
479
 
450
480
  # If in DEBUG mode, this code will return the name, type, current value of the parameter attempting to update
451
481
  # and then for the value that will override the parameter, the value, type(of the value), and whether it is or isn't compatible
@@ -1,4 +1,5 @@
1
1
  # Library imports
2
+ import sys
2
3
  import time
3
4
  import copy
4
5
  from collections import OrderedDict
@@ -22,6 +23,14 @@ DEBUG = False
22
23
  DEBUG_OVERLAP = False
23
24
 
24
25
 
26
+ def _describe_socket_ref(socket_obj, socket_id):
27
+ if socket_obj is None:
28
+ return f"socket id {socket_id}"
29
+ block = socket_obj.node
30
+ block_name = getattr(block, "title", None) or getattr(block, "block_type", None) or block.__class__.__name__
31
+ return f"{block_name} (id {block.id})"
32
+
33
+
25
34
  # =============================================================================
26
35
  #
27
36
  # Defining the Wire Class, which is used to define the Wires that connect the
@@ -361,11 +370,22 @@ class Wire(Serializable):
361
370
  self.id = data["id"]
362
371
  # self.start_socket = data['start_socket']
363
372
  # self.end_socket = data['end_socket']
364
- try:
365
- self.start_socket = hashmap[data["start_socket"]]
366
- self.end_socket = hashmap[data["end_socket"]]
367
- except KeyError:
368
- # One or both endpoint blocks failed to deserialize; skip this wire.
373
+ start_socket_id = data.get("start_socket")
374
+ end_socket_id = data.get("end_socket")
375
+ self.start_socket = hashmap.get(start_socket_id)
376
+ self.end_socket = hashmap.get(end_socket_id)
377
+ if self.start_socket is None or self.end_socket is None:
378
+ print(
379
+ "BdEdit warning: dropping unresolvable wire during load; "
380
+ f"wire_id={data.get('id')}, "
381
+ f"start={_describe_socket_ref(self.start_socket, start_socket_id)}, "
382
+ f"end={_describe_socket_ref(self.end_socket, end_socket_id)}, "
383
+ f"wire_data={data}",
384
+ file=sys.stderr,
385
+ )
386
+ # One or both endpoint blocks failed to deserialize; drop this wire so
387
+ # later scene serialisation/history snapshots do not see a half-built edge.
388
+ self.remove()
369
389
  return False
370
390
  self.wire_type = data["wire_type"]
371
391
 
@@ -1,11 +1,11 @@
1
1
  # PySide6 imports
2
2
  import copy
3
+ import sys
3
4
 
4
5
  from PySide6.QtGui import *
5
6
  from PySide6.QtCore import *
6
7
  from PySide6.QtWidgets import *
7
8
 
8
-
9
9
  # Majority of this code has been adapted with heavy inspiration from: https://stackoverflow.com/a/34442054
10
10
 
11
11
 
@@ -43,6 +43,7 @@ class GraphicsGBox(QGraphicsRectItem):
43
43
  self.handleSelected = None
44
44
  self.mousePressPos = None
45
45
  self.mousePressRect = None
46
+ self._current_cursor_shape = Qt.ArrowCursor
46
47
 
47
48
  # Inherit properties from parent grouping box
48
49
  self.grouping_box = gbox
@@ -102,16 +103,30 @@ class GraphicsGBox(QGraphicsRectItem):
102
103
  if self.isSelected():
103
104
  handle = self.handleAt(moveEvent.pos())
104
105
  cursor = Qt.ArrowCursor if handle is None else self.handleCursors[handle]
105
- self.setCursor(cursor)
106
+ self._setCursorIfChanged(cursor)
106
107
  super().hoverMoveEvent(moveEvent)
107
108
 
108
109
  def hoverLeaveEvent(self, moveEvent):
109
110
  """
110
111
  Executed when the mouse leaves the shape (NOT PRESSED).
111
112
  """
112
- self.setCursor(Qt.ArrowCursor)
113
+ self._setCursorIfChanged(Qt.ArrowCursor)
113
114
  super().hoverLeaveEvent(moveEvent)
114
115
 
116
+ def _setCursorIfChanged(self, cursor_shape):
117
+ """Avoid redundant cursor updates that can stress native cursor registration."""
118
+ app = QApplication.instance()
119
+ if (
120
+ sys.platform == "darwin"
121
+ and app is not None
122
+ and app.activePopupWidget() is not None
123
+ ):
124
+ # Avoid native cursor updates while a popup menu is active on macOS.
125
+ return
126
+ if cursor_shape != self._current_cursor_shape:
127
+ self.setCursor(cursor_shape)
128
+ self._current_cursor_shape = cursor_shape
129
+
115
130
  def mousePressEvent(self, mouseEvent):
116
131
  """
117
132
  Executed when the mouse is pressed on the item.
@@ -764,8 +764,16 @@ class Interface(QWidget):
764
764
  gr = self.scene.grScene
765
765
  saved_bgcolor = getattr(gr, "bgcolor", "grey")
766
766
  saved_grid = getattr(gr, "grid", True)
767
+ saved_hide_connectors = self.scene.hide_connector_blocks
767
768
  gr.updateBackgroundMode("white", False)
768
769
  gr.checkMode()
770
+ # Hide connector blocks so they render as pass-through wires;
771
+ # also deselect them so no orange selection outline appears.
772
+ self.scene.hide_connector_blocks = True
773
+ for block in self.scene.blocks:
774
+ if block.block_type in ["Connector", "CONNECTOR"]:
775
+ block.grBlock.setSelected(False)
776
+ self.scene.grScene.update()
769
777
  try:
770
778
  if fmt == "pdf":
771
779
  self._save_as_pdf(save_path)
@@ -774,6 +782,7 @@ class Interface(QWidget):
774
782
  else:
775
783
  self._save_as_png(save_path)
776
784
  finally:
785
+ self.scene.hide_connector_blocks = saved_hide_connectors
777
786
  gr.updateBackgroundMode(saved_bgcolor, saved_grid)
778
787
  gr.checkMode()
779
788
 
@@ -784,10 +784,38 @@ class InterfaceWindow(QMainWindow):
784
784
  def isModified(self):
785
785
  return self.centralWidget().scene.has_been_modified
786
786
 
787
+ @staticmethod
788
+ def _headless_or_test_mode() -> bool:
789
+ """Return True when GUI modal prompts should be suppressed.
790
+
791
+ Modal QMessageBox dialogs during window teardown can crash some Qt
792
+ backends in offscreen/headless pytest runs.
793
+ """
794
+ if os.environ.get("PYTEST_CURRENT_TEST"):
795
+ return True
796
+
797
+ app = QApplication.instance()
798
+ platform_name = ""
799
+ if app is not None:
800
+ try:
801
+ platform_name = str(app.platformName()).lower()
802
+ except Exception:
803
+ platform_name = ""
804
+
805
+ if platform_name in {"offscreen", "minimal"}:
806
+ return True
807
+
808
+ qpa = str(os.environ.get("QT_QPA_PLATFORM", "")).strip().lower()
809
+ return qpa in {"offscreen", "minimal"}
810
+
787
811
  def exitingWithoutSave(self):
788
812
  if not self.isModified():
789
813
  return True
790
814
 
815
+ if self._headless_or_test_mode():
816
+ # Non-interactive context: treat close as discard to avoid dialogs.
817
+ return True
818
+
791
819
  msg_prompt = QMessageBox.warning(
792
820
  self,
793
821
  "Exiting without saving work.",
@@ -999,6 +1027,12 @@ class InterfaceWindow(QMainWindow):
999
1027
  if self.exitingWithoutSave():
1000
1028
  # Check if file at given path exists, if so, run the deserializing method
1001
1029
  if os.path.isfile(filepath):
1030
+ if self.filename is not None:
1031
+ try:
1032
+ if Path(self.filename).resolve() == Path(filepath).resolve() and not self.isModified():
1033
+ return
1034
+ except OSError:
1035
+ pass
1002
1036
  self.centralWidget().scene.loadFromFile(filepath)
1003
1037
  self.filename = filepath
1004
1038
  self.updateApplicationName()
@@ -1,5 +1,6 @@
1
1
  # Library imports
2
2
  import json
3
+ import sys
3
4
  import time
4
5
  import getpass
5
6
  from PIL import ImageFont
@@ -30,6 +31,15 @@ from bdedit.interface_graphics_scene import GraphicsScene
30
31
  #
31
32
  # =============================================================================
32
33
  class Scene(Serializable):
34
+ _LEGACY_BLOCK_TYPES = {
35
+ "DINTEGRATOR": "INTEGRATOR_S",
36
+ "DPOSEINTEGRATOR": "POSEINTEGRATOR_S",
37
+ }
38
+ _LEGACY_BLOCK_TITLES = {
39
+ "DINTEGRATOR": "Integrator_S Block",
40
+ "DPOSEINTEGRATOR": "PoseIntegrator_S Block",
41
+ }
42
+
33
43
  """
34
44
  The ``Scene`` Class extends the ``Serializable`` Class from BdEdit, and holds
35
45
  the information of all the ``Block`` and ``Wire`` instances that are within it.
@@ -421,17 +431,27 @@ class Scene(Serializable):
421
431
  pass
422
432
 
423
433
  hashmap = {}
434
+ unknown_blocks = []
424
435
 
425
436
  # All the blocks which were saved, are re-created from the JSON file
426
437
  # For each block from the saved blocks
427
438
  for block_data in data["blocks"]:
428
439
  block_type = block_data["block_type"]
440
+ normalized_block_type = Scene._LEGACY_BLOCK_TYPES.get(block_type, block_type)
441
+ if normalized_block_type != block_type:
442
+ print(
443
+ "BdEdit warning: renamed deprecated block type during load: "
444
+ f"{block_type} -> {normalized_block_type}; "
445
+ f"title={block_data.get('title')!r} -> {Scene._LEGACY_BLOCK_TITLES.get(block_type, block_data.get('title'))!r}, "
446
+ f"id={block_data.get('id')}",
447
+ file=sys.stderr,
448
+ )
429
449
  # If a block is one that is manually defined by bdedit (such as the connector
430
450
  # or main blocks, or the text item), they must manaully be re-created.
431
- if block_type == "CONNECTOR" or block_type == "Connector":
451
+ if normalized_block_type == "CONNECTOR" or normalized_block_type == "Connector":
432
452
  Connector(self, self.window).deserialize(block_data, hashmap)
433
453
 
434
- elif block_type == "MAIN" or block_type == "Main":
454
+ elif normalized_block_type == "MAIN" or normalized_block_type == "Main":
435
455
  Main(self, self.window).deserialize(block_data, hashmap)
436
456
 
437
457
  # Otherwise if it is any other block (will be an auto-imported block)
@@ -444,11 +464,37 @@ class Scene(Serializable):
444
464
  # The block_class.__name__ supports older files which would of used self.__class__.__name__
445
465
  # to define the block type
446
466
  if (
447
- block_type == blockname(block_class)
448
- or block_type == block_class.__name__
467
+ normalized_block_type == blockname(block_class)
468
+ or normalized_block_type == block_class.__name__
449
469
  ):
470
+ block_data = dict(block_data)
471
+ if normalized_block_type != block_type:
472
+ block_data["title"] = block_class.title
450
473
  block_class().deserialize(block_data, hashmap)
451
474
  break
475
+ else:
476
+ unknown_blocks.append(
477
+ {
478
+ "block_type": block_type,
479
+ "title": block_data.get("title"),
480
+ "id": block_data.get("id"),
481
+ }
482
+ )
483
+
484
+ if unknown_blocks:
485
+ print(
486
+ "BdEdit warning: unknown block types encountered during load "
487
+ f"({len(unknown_blocks)}):",
488
+ file=sys.stderr,
489
+ )
490
+ for block_info in unknown_blocks:
491
+ print(
492
+ " - "
493
+ f"block_type={block_info['block_type']!r}, "
494
+ f"title={block_info['title']!r}, "
495
+ f"id={block_info['id']}",
496
+ file=sys.stderr,
497
+ )
452
498
 
453
499
  # Next recreate all the wires that were saved
454
500
  for wire_data in data["wires"]:
@@ -4,7 +4,8 @@
4
4
  # from bdsim.block_types import GraphicsBlock
5
5
 
6
6
  from .run_sim import *
7
- from .run_realtime import *
7
+
8
+ # from .run_realtime import *
8
9
  from .blockdiagram import *
9
10
  from .components import *
10
11
  from .block_types import GraphicsBlock
@@ -0,0 +1,131 @@
1
+ import argparse
2
+ import sys
3
+
4
+ from bdsim import BDSim
5
+ from bdsim.blockdiagram import bdload
6
+
7
+
8
+ def _parse_bdrun_args(argv: list[str]) -> tuple[argparse.Namespace, list[str]]:
9
+ """Build/parse bdrun CLI flags and keep remaining args for BDSim."""
10
+ parser = argparse.ArgumentParser(
11
+ prog="bdrun",
12
+ description="load and run a block-diagram file (.bd)",
13
+ epilog=(
14
+ "examples:\n"
15
+ " bdrun model.bd\n"
16
+ " bdrun model.bd --no-graphics --simtime 5\n\n"
17
+ "The options below are provided by the BDSim runtime:"
18
+ ),
19
+ formatter_class=argparse.RawDescriptionHelpFormatter,
20
+ add_help=False,
21
+ )
22
+ parser.add_argument("-h", "--help", action="store_true", dest="help")
23
+ parser.add_argument("--safe-eval", action="store_true", dest="safe_eval")
24
+ parser.add_argument("--force-eval", action="store_true", dest="force_eval")
25
+ parser.add_argument("--trace-eval", action="store_true", dest="trace_eval")
26
+ parser.add_argument("-v", "--verbose", action="store_true", dest="verbose")
27
+ parser.add_argument("filename", nargs="?")
28
+ parser.add_argument(
29
+ "-l",
30
+ "--list",
31
+ action="store_true",
32
+ dest="list_diagram",
33
+ help="show diagram block and wire list, then exit",
34
+ )
35
+
36
+ args, remaining = parser.parse_known_args(argv)
37
+ if args.safe_eval and args.force_eval:
38
+ raise ValueError("cannot use --safe-eval and --force-eval together")
39
+ return args, remaining
40
+
41
+
42
+ def _print_full_help(passthrough_argv: list[str]) -> None:
43
+ """Print bdrun help and delegated BDSim help in one place."""
44
+ parser = argparse.ArgumentParser(
45
+ prog="bdrun",
46
+ description="load and run a block-diagram file (.bd)",
47
+ epilog=(
48
+ "examples:\n"
49
+ " bdrun model.bd\n"
50
+ " bdrun model.bd --no-graphics --simtime 5\n\n"
51
+ "The options below are provided by the BDSim runtime:"
52
+ ),
53
+ formatter_class=argparse.RawDescriptionHelpFormatter,
54
+ add_help=False,
55
+ )
56
+ parser.add_argument("-h", "--help", action="store_true", dest="help")
57
+ parser.add_argument("--safe-eval", action="store_true", dest="safe_eval")
58
+ parser.add_argument("--force-eval", action="store_true", dest="force_eval")
59
+ parser.add_argument("--trace-eval", action="store_true", dest="trace_eval")
60
+ parser.add_argument("-v", "--verbose", action="store_true", dest="verbose")
61
+ parser.add_argument("filename", nargs="?")
62
+ parser.add_argument(
63
+ "-l",
64
+ "--list",
65
+ action="store_true",
66
+ dest="list_diagram",
67
+ help="show diagram block and wire list, then exit",
68
+ )
69
+ parser.print_help()
70
+
71
+ original_argv = sys.argv
72
+ # Ensure BDSim enters its own help path regardless of bdrun parsing.
73
+ sys.argv = [sys.argv[0], "-h", *passthrough_argv]
74
+ try:
75
+ BDSim() # prints BDSim help and exits via SystemExit
76
+ except SystemExit:
77
+ pass
78
+ finally:
79
+ sys.argv = original_argv
80
+
81
+
82
+ def bdrun() -> None:
83
+ """Load a ``.bd`` model file and run it via ``BDSim``.
84
+
85
+ CLI entry point: reads ``sys.argv[1:]``. Options recognised by bdrun
86
+ are stripped; the remainder are forwarded to ``BDSim``.
87
+ """
88
+ parsed, passthrough_argv = _parse_bdrun_args(sys.argv[1:])
89
+
90
+ if parsed.help or parsed.filename is None:
91
+ _print_full_help(passthrough_argv)
92
+ return
93
+
94
+ allow_eval: bool | None = None
95
+ if parsed.safe_eval:
96
+ allow_eval = False
97
+ elif parsed.force_eval:
98
+ allow_eval = True
99
+
100
+ original_argv = sys.argv
101
+ sys.argv = [sys.argv[0], *passthrough_argv]
102
+ try:
103
+ sim = BDSim() # create simulator (reads its own flags from sys.argv)
104
+ finally:
105
+ sys.argv = original_argv
106
+ bd = sim.blockdiagram()
107
+
108
+ bd = bdload(
109
+ bd,
110
+ filename=parsed.filename,
111
+ allow_eval=allow_eval,
112
+ trace_eval=parsed.trace_eval,
113
+ verbose=parsed.verbose,
114
+ )
115
+ if parsed.list_diagram:
116
+ bd.report_lists()
117
+ return
118
+
119
+ bd.compile()
120
+ bd.report_summary()
121
+ sim.run(bd)
122
+ print("bdrun exiting")
123
+
124
+
125
+ if __name__ == "__main__":
126
+ try:
127
+ from ._selftest import run_module_test
128
+ except ImportError:
129
+ from bdsim._selftest import run_module_test
130
+
131
+ raise SystemExit(run_module_test(__file__))