rapid-router 5.4.1__py2.py3-none-any.whl → 7.6.8__py2.py3-none-any.whl

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 (354) hide show
  1. example_project/rapid_router_test_settings.py +164 -0
  2. example_project/settings.py +152 -0
  3. example_project/urls.py +15 -0
  4. example_project/{example_project/wsgi.py → wsgi.py} +2 -1
  5. game/__init__.py +1 -1
  6. game/admin.py +43 -4
  7. game/app_settings.py +3 -7
  8. game/character.py +26 -18
  9. game/decor.py +172 -97
  10. game/end_to_end_tests/base_game_test.py +44 -33
  11. game/end_to_end_tests/editor_page.py +17 -2
  12. game/end_to_end_tests/game_page.py +127 -45
  13. game/end_to_end_tests/selenium_test_case.py +1 -20
  14. game/end_to_end_tests/test_cow_crashes.py +3 -5
  15. game/end_to_end_tests/test_language_dropdown.py +14 -0
  16. game/end_to_end_tests/test_level_editor.py +290 -0
  17. game/end_to_end_tests/test_level_failures.py +1 -1
  18. game/end_to_end_tests/test_level_selection.py +79 -0
  19. game/end_to_end_tests/test_play_through.py +240 -102
  20. game/end_to_end_tests/test_python_levels.py +44 -13
  21. game/end_to_end_tests/test_saving_workspace.py +22 -0
  22. game/forms.py +9 -2
  23. game/level_management.py +38 -29
  24. game/messages.py +1218 -203
  25. game/migrations/0001_squashed_0025_levels_ordering_pt1.py +19 -1
  26. game/migrations/0026_levels_pt2.py +13 -2
  27. game/migrations/0032_cannot_turn_left_level.py +13 -2
  28. game/migrations/0033_recursion_level.py +13 -2
  29. game/migrations/0034_joes_level.py +13 -2
  30. game/migrations/0035_disable_route_score_level_70.py +0 -2
  31. game/migrations/0036_level_score_73.py +0 -2
  32. game/migrations/0037_level_score_79.py +0 -2
  33. game/migrations/0038_level_score_40.py +0 -1
  34. game/migrations/0042_level_score_73.py +0 -2
  35. game/migrations/0048_add_cow_field_and_blocks.py +0 -2
  36. game/migrations/0049_level_score_34.py +0 -2
  37. game/migrations/0050_level_score_40.py +0 -2
  38. game/migrations/0051_level_score_49.py +0 -1
  39. game/migrations/0076_level_locked_for_class.py +19 -0
  40. game/migrations/0077_alter_level_next_level.py +52 -0
  41. game/migrations/0078_add_block_types.py +23 -0
  42. game/migrations/0079_populate_block_type_add_cow_blocks.py +60 -0
  43. game/migrations/0080_level_disable_algorithm_score.py +18 -0
  44. game/migrations/0081_first_12_levels_no_algo_score.py +29 -0
  45. game/migrations/0082_level_43_solution.py +16 -0
  46. game/migrations/0083_add_cows_to_existing_levels.py +195 -0
  47. game/migrations/0084_alter_block_block_type.py +18 -0
  48. game/migrations/0085_add_new_blocks.py +53 -0
  49. game/migrations/0086_loop_levels.py +482 -0
  50. game/migrations/0087_workspace_python_view_enabled.py +18 -0
  51. game/migrations/0088_rename_episodes.py +35 -0
  52. game/migrations/0089_episodes_in_development.py +30 -0
  53. game/migrations/0090_add_missing_model_solutions.py +144 -0
  54. game/migrations/0091_disable_algo_score_if_no_model_solution.py +46 -0
  55. game/migrations/0092_disable_algo_score_in_custom_levels.py +28 -0
  56. game/migrations/0093_alter_level_character_name.py +18 -0
  57. game/migrations/0094_add_hint_lesson_subtitle_to_levels.py +28 -0
  58. game/migrations/0095_level_commands.py +18 -0
  59. game/migrations/0096_alter_level_commands.py +18 -0
  60. game/migrations/0097_add_python_den_levels.py +1515 -0
  61. game/migrations/0098_add_episode_link_fields.py +44 -0
  62. game/migrations/0099_python_episodes_links.py +103 -0
  63. game/migrations/0100_reorder_python_levels.py +179 -0
  64. game/migrations/0101_rename_episodes.py +45 -0
  65. game/migrations/0102_reoder_episodes_13_14.py +136 -0
  66. game/migrations/0103_level_1015_solution.py +26 -0
  67. game/migrations/0104_remove_level_direct_drive.py +17 -0
  68. game/migrations/0105_delete_invalid_attempts.py +18 -0
  69. game/migrations/0106_fields_to_snake_case.py +48 -0
  70. game/migrations/0107_rename_worksheet_link_episode_student_worksheet_link.py +18 -0
  71. game/migrations/0108_episode_indy_worksheet_link.py +18 -0
  72. game/migrations/0109_create_episodes_23_and_24.py +99 -0
  73. game/migrations/0110_remove_episode_indy_worksheet_link_and_more.py +100 -0
  74. game/migrations/0111_create_worksheets.py +149 -0
  75. game/migrations/0112_worksheet_locked_classes.py +21 -0
  76. game/migrations/0113_level_needs_approval.py +18 -0
  77. game/migrations/0114_default_and_non_student_levels_no_approval.py +31 -0
  78. game/migrations/0115_level_level__default_does_not_need_approval.py +22 -0
  79. game/migrations/0116_update_worksheet_video_links.py +68 -0
  80. game/migrations/0117_update_solutions_to_if_else.py +61 -0
  81. game/models.py +157 -16
  82. game/permissions.py +34 -19
  83. game/python_den_urls.py +26 -0
  84. game/random_road.py +43 -127
  85. game/serializers.py +12 -17
  86. game/static/django_reverse_js/js/reverse.js +171 -0
  87. game/static/game/css/LilitaOne-Regular.ttf +0 -0
  88. game/static/game/css/backgrounds.css +14 -10
  89. game/static/game/css/dataTables.custom.css +4 -2
  90. game/static/game/css/dataTables.jqueryui.css +561 -320
  91. game/static/game/css/editor.css +47 -0
  92. game/static/game/css/game.css +43 -49
  93. game/static/game/css/game_screen.css +116 -53
  94. game/static/game/css/jquery.dataTables.css +455 -251
  95. game/static/game/css/level_editor.css +10 -1
  96. game/static/game/css/level_selection.css +32 -3
  97. game/static/game/css/level_share.css +6 -5
  98. game/static/game/css/skulpt/codemirror.css +1 -0
  99. game/static/game/image/Python_Den_hero_student.png +0 -0
  100. game/static/game/image/Python_levels_page.svg +1954 -0
  101. game/static/game/image/characters/front_view/Electric_van.svg +448 -0
  102. game/static/game/image/characters/top_view/Electric_van.svg +448 -0
  103. game/static/game/image/characters/top_view/Sleigh.svg +436 -0
  104. game/static/game/image/decor/city/solar_panel.svg +1200 -0
  105. game/static/game/image/decor/farm/solar_panel.svg +86 -0
  106. game/static/game/image/decor/grass/solar_panel.svg +86 -0
  107. game/static/game/image/decor/snow/barn.svg +1788 -0
  108. game/static/game/image/decor/snow/cfc.svg +1050 -147
  109. game/static/game/image/decor/snow/crops.svg +7370 -0
  110. game/static/game/image/decor/snow/hospital.svg +1220 -0
  111. game/static/game/image/decor/snow/house1.svg +971 -0
  112. game/static/game/image/decor/snow/house2.svg +1574 -0
  113. game/static/game/image/decor/snow/school.svg +1071 -0
  114. game/static/game/image/decor/snow/shop.svg +3211 -0
  115. game/static/game/image/decor/snow/solar_panel.svg +173 -0
  116. game/static/game/image/electric_van.svg +448 -0
  117. game/static/game/image/icons/add_house.svg +26 -0
  118. game/static/game/image/icons/delete_house.svg +26 -0
  119. game/static/game/image/icons/description.svg +1 -0
  120. game/static/game/image/icons/hint.svg +1 -0
  121. game/static/game/image/icons/if_else.svg +3 -0
  122. game/static/game/image/icons/python.svg +1 -1
  123. game/static/game/image/if_else_example.png +0 -0
  124. game/static/game/image/pigeon.svg +684 -0
  125. game/static/game/image/python_den_header.svg +19 -0
  126. game/static/game/js/animation.js +84 -28
  127. game/static/game/js/blockly/msg/js/bg.js +52 -1
  128. game/static/game/js/blockly/msg/js/ca.js +52 -1
  129. game/static/game/js/blockly/msg/js/en-gb.js +52 -1
  130. game/static/game/js/blockly/msg/js/en.js +52 -1
  131. game/static/game/js/blockly/msg/js/es.js +52 -1
  132. game/static/game/js/blockly/msg/js/fr.js +52 -1
  133. game/static/game/js/blockly/msg/js/hi.js +52 -1
  134. game/static/game/js/blockly/msg/js/it.js +52 -1
  135. game/static/game/js/blockly/msg/js/pl.js +52 -1
  136. game/static/game/js/blockly/msg/js/pt-br.js +52 -1
  137. game/static/game/js/blockly/msg/js/ru.js +52 -1
  138. game/static/game/js/blockly/msg/js/ur.js +52 -1
  139. game/static/game/js/blocklyCompiler.js +550 -392
  140. game/static/game/js/blocklyControl.js +335 -302
  141. game/static/game/js/blocklyCustomBlocks.js +691 -458
  142. game/static/game/js/blocklyCustomisations.js +3 -1
  143. game/static/game/js/button.js +12 -0
  144. game/static/game/js/cow.js +15 -130
  145. game/static/game/js/drawing.js +313 -201
  146. game/static/game/js/editor.js +23 -0
  147. game/static/game/js/game.js +148 -139
  148. game/static/game/js/jquery.dataTables.min.js +3 -159
  149. game/static/game/js/level_editor.js +823 -448
  150. game/static/game/js/level_moderation.js +33 -2
  151. game/static/game/js/level_selection.js +62 -25
  152. game/static/game/js/loadLanguages.js +21 -0
  153. game/static/game/js/map.js +106 -36
  154. game/static/game/js/model.js +55 -107
  155. game/static/game/js/pathFinder.js +73 -72
  156. game/static/game/js/program.js +184 -193
  157. game/static/game/js/pythonControl.js +14 -1
  158. game/static/game/js/scoreboard.js +0 -37
  159. game/static/game/js/scoreboardSharedLevels.js +48 -0
  160. game/static/game/js/sharing.js +22 -10
  161. game/static/game/js/skulpt/codemirror.js +5 -4
  162. game/static/game/js/skulpt/skulpt-stdlib.js +1 -1
  163. game/static/game/js/sound.js +52 -5
  164. game/static/game/js/van.js +0 -7
  165. game/static/game/raphael_image/characters/top_view/Electric_van.svg +448 -0
  166. game/static/game/raphael_image/characters/top_view/Sleigh.svg +436 -0
  167. game/static/game/raphael_image/decor/city/solar_panel.svg +1200 -0
  168. game/static/game/raphael_image/decor/farm/solar_panel.svg +86 -0
  169. game/static/game/raphael_image/decor/grass/solar_panel.svg +86 -0
  170. game/static/game/raphael_image/decor/snow/barn.svg +1788 -0
  171. game/static/game/raphael_image/decor/snow/cfc.svg +1050 -147
  172. game/static/game/raphael_image/decor/snow/crops.svg +7370 -0
  173. game/static/game/raphael_image/decor/snow/hospital.svg +1220 -0
  174. game/static/game/raphael_image/decor/snow/house1.svg +971 -0
  175. game/static/game/raphael_image/decor/snow/house2.svg +1574 -0
  176. game/static/game/raphael_image/decor/snow/school.svg +1071 -0
  177. game/static/game/raphael_image/decor/snow/shop.svg +3211 -0
  178. game/static/game/raphael_image/decor/snow/solar_panel.svg +173 -0
  179. game/static/game/raphael_image/pigeon.svg +685 -0
  180. game/static/game/raphael_image/sleigh_wreckage.svg +430 -0
  181. game/static/game/sass/game.scss +22 -6
  182. game/static/game/sound/clown_horn.mp3 +0 -0
  183. game/static/game/sound/clown_horn.ogg +0 -0
  184. game/static/game/sound/electric_van_starting.mp3 +0 -0
  185. game/static/game/sound/electric_van_starting.ogg +0 -0
  186. game/static/game/sound/pigeon.mp3 +0 -0
  187. game/static/game/sound/pigeon.ogg +0 -0
  188. game/static/game/sound/sleigh_bells.mp3 +0 -0
  189. game/static/game/sound/sleigh_bells.ogg +0 -0
  190. game/static/game/sound/sleigh_crash.mp3 +0 -0
  191. game/static/game/sound/sleigh_crash.ogg +0 -0
  192. game/templates/game/base.html +35 -15
  193. game/templates/game/basenonav.html +23 -17
  194. game/templates/game/game.html +236 -111
  195. game/templates/game/level_editor.html +353 -275
  196. game/templates/game/level_moderation.html +19 -6
  197. game/templates/game/level_selection.html +75 -62
  198. game/templates/game/python_den_level_selection.html +291 -0
  199. game/templates/game/python_den_worksheet.html +101 -0
  200. game/templates/game/scoreboard.html +88 -65
  201. game/tests/test_level_editor.py +210 -35
  202. game/tests/test_level_moderation.py +6 -20
  203. game/tests/test_level_selection.py +332 -11
  204. game/tests/test_python_den_worksheet.py +85 -0
  205. game/tests/test_scoreboard.py +258 -66
  206. game/tests/utils/level.py +43 -3
  207. game/tests/utils/teacher.py +2 -2
  208. game/theme.py +21 -21
  209. game/urls.py +125 -78
  210. game/views/language_code_conversions.py +90 -0
  211. game/views/level.py +201 -63
  212. game/views/level_editor.py +109 -48
  213. game/views/level_moderation.py +29 -6
  214. game/views/level_selection.py +179 -56
  215. game/views/level_solutions.py +600 -106
  216. game/views/scoreboard.py +181 -66
  217. game/views/worksheet.py +25 -0
  218. rapid_router-7.6.8.dist-info/METADATA +174 -0
  219. {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/RECORD +222 -242
  220. {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/WHEEL +1 -1
  221. rapid_router-7.6.8.dist-info/licenses/LICENSE.md +3 -0
  222. example_project/example_project/__init__.py +0 -1
  223. example_project/example_project/settings.py +0 -54
  224. example_project/example_project/urls.py +0 -16
  225. example_project/manage.py +0 -10
  226. game/autoconfig.py +0 -59
  227. game/csp_config.py +0 -23
  228. game/locale/ar_SA/LC_MESSAGES/django.mo +0 -0
  229. game/locale/ar_SA/LC_MESSAGES/django.po +0 -405
  230. game/locale/ar_SA/LC_MESSAGES/djangojs.mo +0 -0
  231. game/locale/ar_SA/LC_MESSAGES/djangojs.po +0 -743
  232. game/locale/bg_BG/LC_MESSAGES/django.mo +0 -0
  233. game/locale/bg_BG/LC_MESSAGES/django.po +0 -405
  234. game/locale/bg_BG/LC_MESSAGES/djangojs.mo +0 -0
  235. game/locale/bg_BG/LC_MESSAGES/djangojs.po +0 -739
  236. game/locale/ca_ES/LC_MESSAGES/django.mo +0 -0
  237. game/locale/ca_ES/LC_MESSAGES/django.po +0 -405
  238. game/locale/ca_ES/LC_MESSAGES/djangojs.mo +0 -0
  239. game/locale/ca_ES/LC_MESSAGES/djangojs.po +0 -740
  240. game/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  241. game/locale/cs_CZ/LC_MESSAGES/django.po +0 -405
  242. game/locale/cs_CZ/LC_MESSAGES/djangojs.mo +0 -0
  243. game/locale/cs_CZ/LC_MESSAGES/djangojs.po +0 -741
  244. game/locale/cy_GB/LC_MESSAGES/django.mo +0 -0
  245. game/locale/cy_GB/LC_MESSAGES/django.po +0 -405
  246. game/locale/cy_GB/LC_MESSAGES/djangojs.mo +0 -0
  247. game/locale/cy_GB/LC_MESSAGES/djangojs.po +0 -743
  248. game/locale/de_DE/LC_MESSAGES/django.mo +0 -0
  249. game/locale/de_DE/LC_MESSAGES/django.po +0 -405
  250. game/locale/de_DE/LC_MESSAGES/djangojs.mo +0 -0
  251. game/locale/de_DE/LC_MESSAGES/djangojs.po +0 -739
  252. game/locale/el_GR/LC_MESSAGES/django.mo +0 -0
  253. game/locale/el_GR/LC_MESSAGES/django.po +0 -405
  254. game/locale/el_GR/LC_MESSAGES/djangojs.mo +0 -0
  255. game/locale/el_GR/LC_MESSAGES/djangojs.po +0 -739
  256. game/locale/en_GB/LC_MESSAGES/django.mo +0 -0
  257. game/locale/en_GB/LC_MESSAGES/django.po +0 -405
  258. game/locale/en_GB/LC_MESSAGES/djangojs.mo +0 -0
  259. game/locale/en_GB/LC_MESSAGES/djangojs.po +0 -739
  260. game/locale/es_ES/LC_MESSAGES/django.mo +0 -0
  261. game/locale/es_ES/LC_MESSAGES/django.po +0 -405
  262. game/locale/es_ES/LC_MESSAGES/djangojs.mo +0 -0
  263. game/locale/es_ES/LC_MESSAGES/djangojs.po +0 -739
  264. game/locale/fi_FI/LC_MESSAGES/django.mo +0 -0
  265. game/locale/fi_FI/LC_MESSAGES/django.po +0 -405
  266. game/locale/fi_FI/LC_MESSAGES/djangojs.mo +0 -0
  267. game/locale/fi_FI/LC_MESSAGES/djangojs.po +0 -739
  268. game/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
  269. game/locale/fr_FR/LC_MESSAGES/django.po +0 -405
  270. game/locale/fr_FR/LC_MESSAGES/djangojs.mo +0 -0
  271. game/locale/fr_FR/LC_MESSAGES/djangojs.po +0 -739
  272. game/locale/gu_IN/LC_MESSAGES/django.mo +0 -0
  273. game/locale/gu_IN/LC_MESSAGES/django.po +0 -405
  274. game/locale/gu_IN/LC_MESSAGES/djangojs.mo +0 -0
  275. game/locale/gu_IN/LC_MESSAGES/djangojs.po +0 -739
  276. game/locale/hi_IN/LC_MESSAGES/django.mo +0 -0
  277. game/locale/hi_IN/LC_MESSAGES/django.po +0 -405
  278. game/locale/hi_IN/LC_MESSAGES/djangojs.mo +0 -0
  279. game/locale/hi_IN/LC_MESSAGES/djangojs.po +0 -739
  280. game/locale/id_ID/LC_MESSAGES/django.mo +0 -0
  281. game/locale/id_ID/LC_MESSAGES/django.po +0 -405
  282. game/locale/id_ID/LC_MESSAGES/djangojs.mo +0 -0
  283. game/locale/id_ID/LC_MESSAGES/djangojs.po +0 -738
  284. game/locale/it_IT/LC_MESSAGES/django.mo +0 -0
  285. game/locale/it_IT/LC_MESSAGES/django.po +0 -405
  286. game/locale/it_IT/LC_MESSAGES/djangojs.mo +0 -0
  287. game/locale/it_IT/LC_MESSAGES/djangojs.po +0 -739
  288. game/locale/ja_JP/LC_MESSAGES/django.mo +0 -0
  289. game/locale/ja_JP/LC_MESSAGES/django.po +0 -405
  290. game/locale/ja_JP/LC_MESSAGES/djangojs.mo +0 -0
  291. game/locale/ja_JP/LC_MESSAGES/djangojs.po +0 -738
  292. game/locale/lol_US/LC_MESSAGES/django.mo +0 -0
  293. game/locale/lol_US/LC_MESSAGES/django.po +0 -405
  294. game/locale/lol_US/LC_MESSAGES/djangojs.mo +0 -0
  295. game/locale/lol_US/LC_MESSAGES/djangojs.po +0 -739
  296. game/locale/nb_NO/LC_MESSAGES/django.mo +0 -0
  297. game/locale/nb_NO/LC_MESSAGES/django.po +0 -405
  298. game/locale/nb_NO/LC_MESSAGES/djangojs.mo +0 -0
  299. game/locale/nb_NO/LC_MESSAGES/djangojs.po +0 -739
  300. game/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
  301. game/locale/nl_NL/LC_MESSAGES/django.po +0 -405
  302. game/locale/nl_NL/LC_MESSAGES/djangojs.mo +0 -0
  303. game/locale/nl_NL/LC_MESSAGES/djangojs.po +0 -739
  304. game/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
  305. game/locale/pl_PL/LC_MESSAGES/django.po +0 -405
  306. game/locale/pl_PL/LC_MESSAGES/djangojs.mo +0 -0
  307. game/locale/pl_PL/LC_MESSAGES/djangojs.po +0 -741
  308. game/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  309. game/locale/pt_BR/LC_MESSAGES/django.po +0 -405
  310. game/locale/pt_BR/LC_MESSAGES/djangojs.mo +0 -0
  311. game/locale/pt_BR/LC_MESSAGES/djangojs.po +0 -739
  312. game/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  313. game/locale/pt_PT/LC_MESSAGES/django.po +0 -405
  314. game/locale/pt_PT/LC_MESSAGES/djangojs.mo +0 -0
  315. game/locale/pt_PT/LC_MESSAGES/djangojs.po +0 -739
  316. game/locale/ro_RO/LC_MESSAGES/django.mo +0 -0
  317. game/locale/ro_RO/LC_MESSAGES/django.po +0 -405
  318. game/locale/ro_RO/LC_MESSAGES/djangojs.mo +0 -0
  319. game/locale/ro_RO/LC_MESSAGES/djangojs.po +0 -740
  320. game/locale/ru_RU/LC_MESSAGES/django.mo +0 -0
  321. game/locale/ru_RU/LC_MESSAGES/django.po +0 -405
  322. game/locale/ru_RU/LC_MESSAGES/djangojs.mo +0 -0
  323. game/locale/ru_RU/LC_MESSAGES/djangojs.po +0 -741
  324. game/locale/sv_SE/LC_MESSAGES/django.mo +0 -0
  325. game/locale/sv_SE/LC_MESSAGES/django.po +0 -405
  326. game/locale/sv_SE/LC_MESSAGES/djangojs.mo +0 -0
  327. game/locale/sv_SE/LC_MESSAGES/djangojs.po +0 -739
  328. game/locale/tl_PH/LC_MESSAGES/django.mo +0 -0
  329. game/locale/tl_PH/LC_MESSAGES/django.po +0 -405
  330. game/locale/tl_PH/LC_MESSAGES/djangojs.mo +0 -0
  331. game/locale/tl_PH/LC_MESSAGES/djangojs.po +0 -739
  332. game/locale/tlh_AA/LC_MESSAGES/django.mo +0 -0
  333. game/locale/tlh_AA/LC_MESSAGES/django.po +0 -405
  334. game/locale/tlh_AA/LC_MESSAGES/djangojs.mo +0 -0
  335. game/locale/tlh_AA/LC_MESSAGES/djangojs.po +0 -739
  336. game/locale/tr_TR/LC_MESSAGES/django.mo +0 -0
  337. game/locale/tr_TR/LC_MESSAGES/django.po +0 -405
  338. game/locale/tr_TR/LC_MESSAGES/djangojs.mo +0 -0
  339. game/locale/tr_TR/LC_MESSAGES/djangojs.po +0 -740
  340. game/locale/ur_IN/LC_MESSAGES/django.mo +0 -0
  341. game/locale/ur_IN/LC_MESSAGES/django.po +0 -405
  342. game/locale/ur_IN/LC_MESSAGES/djangojs.mo +0 -0
  343. game/locale/ur_IN/LC_MESSAGES/djangojs.po +0 -739
  344. game/locale/ur_PK/LC_MESSAGES/django.mo +0 -0
  345. game/locale/ur_PK/LC_MESSAGES/django.po +0 -405
  346. game/locale/ur_PK/LC_MESSAGES/djangojs.mo +0 -0
  347. game/locale/ur_PK/LC_MESSAGES/djangojs.po +0 -739
  348. game/static/game/image/actions/go.svg +0 -18
  349. game/static/game/image/icons/destination.svg +0 -9
  350. game/static/game/js/pqselect.min.js +0 -9
  351. game/static/game/js/widget-scroller.js +0 -906
  352. rapid_router-5.4.1.dist-info/LICENSE.md +0 -577
  353. rapid_router-5.4.1.dist-info/METADATA +0 -24
  354. {rapid_router-5.4.1.dist-info → rapid_router-7.6.8.dist-info}/top_level.txt +0 -0
@@ -1,471 +1,704 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  var ocargo = ocargo || {};
4
4
  var Blockly = Blockly || {};
5
5
 
6
6
  function initCustomBlocks() {
7
- initCustomBlocksDescription();
8
- initCustomBlocksPython();
7
+ initCustomBlocksDescription();
8
+ initCustomBlocksPython();
9
9
  }
10
10
 
11
11
  function initCustomBlocksDescription() {
12
-
13
- Blockly.Blocks['start'] = {
14
- // Beginning block - identifies the start of the program
15
- init: function() {
16
- ocargo.blocklyControl.numStartBlocks++;
17
- this.setColour(50);
18
- this.appendDummyInput()
19
- .appendField(gettext('Start'))
20
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + CHARACTER_EN_FACE_URL,
21
- ocargo.BlocklyControl.BLOCK_CHARACTER_HEIGHT,
22
- ocargo.BlocklyControl.BLOCK_CHARACTER_WIDTH));
23
- this.setNextStatement(true, 'Action');
24
- this.setTooltip(gettext('The beginning of the program'));
25
- this.setDeletable(false);
26
- }
27
- };
28
-
29
- /*****************/
30
- /* Action Blocks */
31
- /*****************/
32
-
33
- Blockly.Blocks['move_forwards'] = {
34
- // Block for moving forward
35
- init: function() {
36
- this.setColour(160);
37
- this.appendDummyInput()
38
- .appendField(gettext('move forwards'))
39
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/forward.svg',
40
- ocargo.BlocklyControl.IMAGE_WIDTH,
41
- ocargo.BlocklyControl.BLOCK_HEIGHT));
42
- this.setPreviousStatement(true, 'Action');
43
- this.setNextStatement(true, 'Action');
44
- this.setTooltip(gettext('Move the van forwards'));
45
- }
46
- };
47
-
48
- Blockly.Blocks['turn_left'] = {
49
- // Block for turning left
50
- init: function() {
51
- this.setColour(160);
52
- this.appendDummyInput()
53
- .appendField(gettext('turn left'))
54
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
55
- 38,
56
- ocargo.BlocklyControl.BLOCK_HEIGHT))
57
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/left.svg',
58
- ocargo.BlocklyControl.IMAGE_WIDTH,
59
- ocargo.BlocklyControl.BLOCK_HEIGHT));
60
- this.setPreviousStatement(true, 'Action');
61
- this.setNextStatement(true, 'Action');
62
- this.setTooltip(gettext('Turn the van left'));
63
- }
64
- };
65
-
66
- Blockly.Blocks['turn_right'] = {
67
- // Block for turning right
68
- init: function() {
69
- this.setColour(160);
70
- this.appendDummyInput()
71
- .appendField(gettext('turn right'))
72
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
73
- 29,
74
- ocargo.BlocklyControl.BLOCK_HEIGHT))
75
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/right.svg',
76
- ocargo.BlocklyControl.IMAGE_WIDTH,
77
- ocargo.BlocklyControl.BLOCK_HEIGHT));
78
- this.setPreviousStatement(true, 'Action');
79
- this.setNextStatement(true, 'Action');
80
- this.setTooltip(gettext('Turn the van right'));
81
- }
82
- };
83
-
84
- Blockly.Blocks['turn_around'] = {
85
- // Block for turning around
86
- init: function() {
87
- this.setColour(160);
88
- this.appendDummyInput()
89
- .appendField(gettext('turn around'))
90
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
91
- 12,
92
- ocargo.BlocklyControl.BLOCK_HEIGHT))
93
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir +
94
- 'actions/turn_around.svg',
95
- ocargo.BlocklyControl.IMAGE_WIDTH,
96
- ocargo.BlocklyControl.BLOCK_HEIGHT));
97
- this.setPreviousStatement(true, 'Action');
98
- this.setNextStatement(true, 'Action');
99
- this.setTooltip(gettext('Turn the van around'));
100
- }
101
- };
102
-
103
- Blockly.Blocks['wait'] = {
104
- // Block for not moving the van for a time
105
- init: function() {
106
- this.setColour(160);
107
- this.appendDummyInput()
108
- .appendField(gettext('wait'))
109
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
110
- 60,
111
- ocargo.BlocklyControl.BLOCK_HEIGHT))
112
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/wait.svg',
113
- ocargo.BlocklyControl.IMAGE_WIDTH,
114
- ocargo.BlocklyControl.BLOCK_HEIGHT));
115
- this.setPreviousStatement(true, 'Action');
116
- this.setNextStatement(true, 'Action');
117
- this.setTooltip(gettext('Keep the van stationary'));
118
- }
119
- };
120
-
121
- Blockly.Blocks['deliver'] = {
122
- // Block for delivering (only on levels with multiple destinations)
123
- init: function() {
124
- this.setColour(160);
125
- this.appendDummyInput()
126
- .appendField(gettext('deliver'))
127
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
128
- 43,
129
- ocargo.BlocklyControl.BLOCK_HEIGHT))
130
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/deliver.svg',
131
- ocargo.BlocklyControl.IMAGE_WIDTH,
132
- ocargo.BlocklyControl.BLOCK_HEIGHT));
133
- this.setPreviousStatement(true, 'Action');
134
- this.setNextStatement(true, 'Action');
135
- this.setTooltip(gettext('Deliver the goods from the van'));
136
- }
137
- };
138
-
139
- Blockly.Blocks['puff_up'] = {
140
- // Block for puffing up the van
141
- init: function() {
142
- this.setColour(330);
143
- this.appendDummyInput()
144
- .appendField(gettext('puff up'))
145
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
146
- 43,
147
- ocargo.BlocklyControl.BLOCK_HEIGHT))
148
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
149
- ocargo.BlocklyControl.IMAGE_WIDTH,
150
- ocargo.BlocklyControl.BLOCK_HEIGHT));
151
- this.setPreviousStatement(true, 'EventAction');
152
- this.setNextStatement(false);
153
- this.setTooltip(gettext('Puff up the van to scare away the cows'));
154
- }
155
- };
156
-
157
- Blockly.Blocks['sound_horn'] = {
158
- // Block for puffing up the van
159
- init: function() {
160
- this.setColour(330);
161
- this.appendDummyInput()
162
- .appendField(gettext('sound horn'))
163
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
164
- 43,
165
- ocargo.BlocklyControl.BLOCK_HEIGHT))
166
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
167
- ocargo.BlocklyControl.IMAGE_WIDTH,
168
- ocargo.BlocklyControl.BLOCK_HEIGHT));
169
- this.setPreviousStatement(true, 'EventAction');
170
- this.setNextStatement(false);
171
- this.setTooltip(gettext('Sound the horn to scare away the cows'));
12
+ Blockly.Blocks["start"] = {
13
+ // Beginning block - identifies the start of the program
14
+ init: function () {
15
+ ocargo.blocklyControl.numStartBlocks++;
16
+ this.setColour(50);
17
+ this.appendDummyInput()
18
+ .appendField(Blockly.Msg.START_TITLE)
19
+ .appendField(
20
+ new Blockly.FieldImage(
21
+ new Date().getMonth() === 11 && CHARACTER_NAME === "Van"
22
+ ? ocargo.Drawing.imageDir + "characters/top_view/Sleigh.svg"
23
+ : ocargo.Drawing.imageDir + CHARACTER_EN_FACE_URL,
24
+ ocargo.BlocklyControl.BLOCK_CHARACTER_HEIGHT,
25
+ ocargo.BlocklyControl.BLOCK_CHARACTER_WIDTH
26
+ )
27
+ );
28
+ this.setNextStatement(true, "Action");
29
+ this.setTooltip(Blockly.Msg.START_TOOLTIP);
30
+ this.setDeletable(false);
31
+ },
32
+ };
33
+
34
+ /*****************/
35
+ /* Action Blocks */
36
+ /*****************/
37
+
38
+ Blockly.Blocks["move_forwards"] = {
39
+ // Block for moving forward
40
+ init: function () {
41
+ this.setColour(160);
42
+ this.appendDummyInput()
43
+ .appendField(Blockly.Msg.MOVE_FORWARDS_TITLE)
44
+ .appendField(
45
+ new Blockly.FieldImage(
46
+ ocargo.Drawing.imageDir + "actions/forward.svg",
47
+ ocargo.BlocklyControl.IMAGE_WIDTH,
48
+ ocargo.BlocklyControl.BLOCK_HEIGHT
49
+ )
50
+ );
51
+ this.setPreviousStatement(true, "Action");
52
+ this.setNextStatement(true, "Action");
53
+ this.setTooltip(Blockly.Msg.MOVE_FORWARDS_TOOLTIP);
54
+ },
55
+ };
56
+
57
+ Blockly.Blocks["turn_left"] = {
58
+ // Block for turning left
59
+ init: function () {
60
+ this.setColour(160);
61
+ this.appendDummyInput()
62
+ .appendField(Blockly.Msg.TURN_LEFT_TITLE)
63
+ .appendField(
64
+ new Blockly.FieldImage(
65
+ ocargo.Drawing.imageDir + "empty.svg",
66
+ 38,
67
+ ocargo.BlocklyControl.BLOCK_HEIGHT
68
+ )
69
+ )
70
+ .appendField(
71
+ new Blockly.FieldImage(
72
+ ocargo.Drawing.imageDir + "actions/left.svg",
73
+ ocargo.BlocklyControl.IMAGE_WIDTH,
74
+ ocargo.BlocklyControl.BLOCK_HEIGHT
75
+ )
76
+ );
77
+ this.setPreviousStatement(true, "Action");
78
+ this.setNextStatement(true, "Action");
79
+ this.setTooltip(Blockly.Msg.TURN_LEFT_TOOLTIP);
80
+ },
81
+ };
82
+
83
+ Blockly.Blocks["turn_right"] = {
84
+ // Block for turning right
85
+ init: function () {
86
+ this.setColour(160);
87
+ this.appendDummyInput()
88
+ .appendField(Blockly.Msg.TURN_RIGHT_TITLE)
89
+ .appendField(
90
+ new Blockly.FieldImage(
91
+ ocargo.Drawing.imageDir + "empty.svg",
92
+ 29,
93
+ ocargo.BlocklyControl.BLOCK_HEIGHT
94
+ )
95
+ )
96
+ .appendField(
97
+ new Blockly.FieldImage(
98
+ ocargo.Drawing.imageDir + "actions/right.svg",
99
+ ocargo.BlocklyControl.IMAGE_WIDTH,
100
+ ocargo.BlocklyControl.BLOCK_HEIGHT
101
+ )
102
+ );
103
+ this.setPreviousStatement(true, "Action");
104
+ this.setNextStatement(true, "Action");
105
+ this.setTooltip(Blockly.Msg.TURN_RIGHT_TOOLTIP);
106
+ },
107
+ };
108
+
109
+ Blockly.Blocks["turn_around"] = {
110
+ // Block for turning around
111
+ init: function () {
112
+ this.setColour(160);
113
+ this.appendDummyInput()
114
+ .appendField(Blockly.Msg.TURN_AROUND_TITLE)
115
+ .appendField(
116
+ new Blockly.FieldImage(
117
+ ocargo.Drawing.imageDir + "empty.svg",
118
+ 12,
119
+ ocargo.BlocklyControl.BLOCK_HEIGHT
120
+ )
121
+ )
122
+ .appendField(
123
+ new Blockly.FieldImage(
124
+ ocargo.Drawing.imageDir + "actions/turn_around.svg",
125
+ ocargo.BlocklyControl.IMAGE_WIDTH,
126
+ ocargo.BlocklyControl.BLOCK_HEIGHT
127
+ )
128
+ );
129
+ this.setPreviousStatement(true, "Action");
130
+ this.setNextStatement(true, "Action");
131
+ this.setTooltip(Blockly.Msg.TURN_AROUND_TOOLTIP);
132
+ },
133
+ };
134
+
135
+ Blockly.Blocks["wait"] = {
136
+ // Block for not moving the van for a time
137
+ init: function () {
138
+ this.setColour(160);
139
+ this.appendDummyInput()
140
+ .appendField(Blockly.Msg.WAIT_TITLE)
141
+ .appendField(
142
+ new Blockly.FieldImage(
143
+ ocargo.Drawing.imageDir + "empty.svg",
144
+ 60,
145
+ ocargo.BlocklyControl.BLOCK_HEIGHT
146
+ )
147
+ )
148
+ .appendField(
149
+ new Blockly.FieldImage(
150
+ ocargo.Drawing.imageDir + "actions/wait.svg",
151
+ ocargo.BlocklyControl.IMAGE_WIDTH,
152
+ ocargo.BlocklyControl.BLOCK_HEIGHT
153
+ )
154
+ );
155
+ this.setPreviousStatement(true, "Action");
156
+ this.setNextStatement(true, "Action");
157
+ this.setTooltip(Blockly.Msg.WAIT_TOOLTIP);
158
+ },
159
+ };
160
+
161
+ Blockly.Blocks["deliver"] = {
162
+ // Block for delivering (only on levels with multiple destinations)
163
+ init: function () {
164
+ this.setColour(160);
165
+ this.appendDummyInput()
166
+ .appendField(Blockly.Msg.DELIVER_TITLE)
167
+ .appendField(
168
+ new Blockly.FieldImage(
169
+ ocargo.Drawing.imageDir + "empty.svg",
170
+ 43,
171
+ ocargo.BlocklyControl.BLOCK_HEIGHT
172
+ )
173
+ )
174
+ .appendField(
175
+ new Blockly.FieldImage(
176
+ ocargo.Drawing.imageDir + "actions/deliver.svg",
177
+ ocargo.BlocklyControl.IMAGE_WIDTH,
178
+ ocargo.BlocklyControl.BLOCK_HEIGHT
179
+ )
180
+ );
181
+ this.setPreviousStatement(true, "Action");
182
+ this.setNextStatement(true, "Action");
183
+ this.setTooltip(Blockly.Msg.DELIVER_TOOLTIP);
184
+ },
185
+ };
186
+
187
+ Blockly.Blocks["sound_horn"] = {
188
+ init: function () {
189
+ this.setColour(160);
190
+ this.appendDummyInput()
191
+ .appendField(Blockly.Msg.SOUND_HORN_TITLE)
192
+ .appendField(
193
+ new Blockly.FieldImage(
194
+ ocargo.Drawing.imageDir + "empty.svg",
195
+ 43,
196
+ ocargo.BlocklyControl.BLOCK_HEIGHT
197
+ )
198
+ )
199
+ .appendField(
200
+ new Blockly.FieldImage(
201
+ ocargo.Drawing.imageDir + "empty.svg",
202
+ ocargo.BlocklyControl.IMAGE_WIDTH,
203
+ ocargo.BlocklyControl.BLOCK_HEIGHT
204
+ )
205
+ );
206
+ this.setPreviousStatement(true, "Action");
207
+ this.setNextStatement(true, "Action");
208
+ this.setTooltip(Blockly.Msg.SOUND_HORN_TOOLTIP);
209
+ },
210
+ };
211
+
212
+ /*****************/
213
+ /* Conditions */
214
+ /*****************/
215
+
216
+ Blockly.Blocks["road_exists"] = {
217
+ init: function () {
218
+ var BOOLEANS = [
219
+ [Blockly.Msg.ROAD_EXISTS_FORWARD_TITLE, "FORWARD"],
220
+ [Blockly.Msg.ROAD_EXISTS_LEFT_TITLE, "LEFT"],
221
+ [Blockly.Msg.ROAD_EXISTS_RIGHT_TITLE, "RIGHT"],
222
+ ];
223
+ this.setColour(210);
224
+ this.setOutput(true, "Boolean");
225
+ this.appendDummyInput()
226
+ .appendField(new Blockly.FieldDropdown(BOOLEANS), "CHOICE")
227
+ .appendField(
228
+ new Blockly.FieldImage(
229
+ ocargo.Drawing.imageDir + "empty.svg",
230
+ ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
231
+ ocargo.BlocklyControl.BLOCK_HEIGHT
232
+ )
233
+ );
234
+ },
235
+ };
236
+
237
+ Blockly.Blocks["traffic_light"] = {
238
+ init: function () {
239
+ var BOOLEANS = [
240
+ [Blockly.Msg.TRAFFIC_LIGHT_RED_TITLE, ocargo.TrafficLight.RED],
241
+ [Blockly.Msg.TRAFFIC_LIGHT_GREEN_TITLE, ocargo.TrafficLight.GREEN],
242
+ ];
243
+ this.setColour(210);
244
+ this.setOutput(true, "Boolean");
245
+ this.appendDummyInput()
246
+ .appendField(new Blockly.FieldDropdown(BOOLEANS), "CHOICE")
247
+ .appendField(
248
+ new Blockly.FieldImage(
249
+ ocargo.Drawing.imageDir + "empty.svg",
250
+ ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
251
+ ocargo.BlocklyControl.BLOCK_HEIGHT
252
+ )
253
+ );
254
+ },
255
+ };
256
+
257
+ Blockly.Blocks["dead_end"] = {
258
+ init: function () {
259
+ this.setColour(210);
260
+ this.setOutput(true, "Boolean");
261
+ this.appendDummyInput()
262
+ .appendField(Blockly.Msg.DEAD_END_TITLE)
263
+ .appendField(
264
+ new Blockly.FieldImage(
265
+ ocargo.Drawing.imageDir + "empty.svg",
266
+ ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
267
+ ocargo.BlocklyControl.BLOCK_HEIGHT
268
+ )
269
+ );
270
+ },
271
+ };
272
+
273
+ Blockly.Blocks["at_destination"] = {
274
+ init: function () {
275
+ this.setColour(210);
276
+ this.setOutput(true, "Boolean");
277
+ this.appendDummyInput()
278
+ .appendField(Blockly.Msg.AT_DESTINATION_TITLE)
279
+ .appendField(
280
+ new Blockly.FieldImage(
281
+ ocargo.Drawing.imageDir + "empty.svg",
282
+ ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
283
+ ocargo.BlocklyControl.BLOCK_HEIGHT
284
+ )
285
+ );
286
+ },
287
+ };
288
+
289
+ Blockly.Blocks["cow_crossing"] = {
290
+ init: function () {
291
+ this.setColour(210);
292
+ this.setOutput(true, "Boolean");
293
+ let imageUrl =
294
+ ocargo.Drawing.animalType == ocargo.Cow.PIGEON
295
+ ? ocargo.Drawing.pigeonUrl
296
+ : ocargo.Drawing.whiteCowUrl;
297
+ this.appendDummyInput()
298
+ .appendField(
299
+ ocargo.Drawing.animalType == ocargo.Cow.PIGEON
300
+ ? Blockly.Msg.PIGEON_CROSSING_TITLE
301
+ : Blockly.Msg.COW_CROSSING_TITLE
302
+ )
303
+ .appendField(
304
+ new Blockly.FieldImage(
305
+ ocargo.Drawing.imageDir + imageUrl,
306
+ ocargo.BlocklyControl.COW_WIDTH,
307
+ ocargo.BlocklyControl.BLOCK_HEIGHT
308
+ ),
309
+ "IMAGE"
310
+ );
311
+ },
312
+ };
313
+
314
+ Blockly.Blocks["pigeon_crossing_IMAGE_ONLY"] = {
315
+ init: function () {
316
+ this.setColour(210);
317
+ this.setOutput(true, "Boolean");
318
+ this.appendDummyInput()
319
+ .appendField("pigeons")
320
+ .appendField(
321
+ new Blockly.FieldImage(
322
+ ocargo.Drawing.imageDir + ocargo.Drawing.pigeonUrl,
323
+ ocargo.BlocklyControl.COW_WIDTH,
324
+ ocargo.BlocklyControl.BLOCK_HEIGHT
325
+ ),
326
+ "IMAGE"
327
+ );
328
+ },
329
+ };
330
+ /****************/
331
+ /* Procedures */
332
+ /****************/
333
+
334
+ Blockly.Blocks["call_proc"] = {
335
+ // Block for calling a defined procedure
336
+ init: function () {
337
+ var name = "";
338
+ this.setColour(260);
339
+ this.appendDummyInput()
340
+ .appendField(Blockly.Msg.CALL_PROC_TITLE)
341
+ .appendField(
342
+ new Blockly.FieldImage(
343
+ ocargo.Drawing.imageDir + "empty.svg",
344
+ 7,
345
+ ocargo.BlocklyControl.BLOCK_HEIGHT
346
+ )
347
+ )
348
+ .appendField(new Blockly.FieldTextInput(name), "NAME");
349
+ this.setPreviousStatement(true, "Action");
350
+ this.setNextStatement(true, "Action");
351
+ this.setTooltip(Blockly.Msg.CALL_PROC_TOOLTIP);
352
+ },
353
+ };
354
+
355
+ Blockly.Blocks["declare_proc"] = {
356
+ // Block for declaring a procedure
357
+ init: function () {
358
+ var name = "";
359
+ this.setColour(260);
360
+ this.appendDummyInput()
361
+ .appendField(Blockly.Msg.DECLARE_PROC_TITLE)
362
+ .appendField(new Blockly.FieldTextInput(name), "NAME");
363
+ this.appendStatementInput("DO")
364
+ .setCheck("Action")
365
+ .appendField(Blockly.Msg.DECLARE_PROC_SUBTITLE);
366
+ this.setTooltip(Blockly.Msg.DECLARE_PROC_TOOLTIP);
367
+ this.statementConnection_ = null;
368
+ },
369
+ };
370
+
371
+ /****************/
372
+ /* Events */
373
+ /****************/
374
+
375
+ Blockly.Blocks["declare_event"] = {
376
+ // Block for declaring an event handler
377
+ init: function () {
378
+ this.setColour(260);
379
+ var dropdown = new Blockly.FieldDropdown(
380
+ [
381
+ [gettext("white"), ocargo.Cow.WHITE],
382
+ [gettext("brown"), ocargo.Cow.BROWN],
383
+ ],
384
+ function (option) {
385
+ var imageUrl =
386
+ ocargo.Drawing.imageDir + ocargo.Drawing.cowUrl(option);
387
+ this.sourceBlock_.getField("IMAGE").setValue(imageUrl);
172
388
  }
173
- };
174
-
175
- /*****************/
176
- /* Conditions */
177
- /*****************/
178
-
179
- Blockly.Blocks['road_exists'] = {
180
- init: function() {
181
- var BOOLEANS =
182
- [[gettext('road exists forward'), 'FORWARD'],
183
- [gettext('road exists left'), 'LEFT'],
184
- [gettext('road exists right'), 'RIGHT']];
185
- this.setColour(210);
186
- this.setOutput(true, 'Boolean');
187
- this.appendDummyInput()
188
- .appendField(new Blockly.FieldDropdown(BOOLEANS), 'CHOICE')
189
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
190
- ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
191
- ocargo.BlocklyControl.BLOCK_HEIGHT));
192
- }
193
- };
194
-
195
- Blockly.Blocks['traffic_light'] = {
196
- init: function() {
197
- var BOOLEANS =
198
- [[gettext('traffic light red'), ocargo.TrafficLight.RED],
199
- [gettext('traffic light green'), ocargo.TrafficLight.GREEN]];
200
- this.setColour(210);
201
- this.setOutput(true, 'Boolean');
202
- this.appendDummyInput()
203
- .appendField(new Blockly.FieldDropdown(BOOLEANS), 'CHOICE')
204
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
205
- ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
206
- ocargo.BlocklyControl.BLOCK_HEIGHT));
207
- }
208
- };
209
-
210
- Blockly.Blocks['dead_end'] = {
211
- init: function() {
212
- this.setColour(210);
213
- this.setOutput(true, 'Boolean');
214
- this.appendDummyInput()
215
- .appendField(gettext('is dead end'))
216
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
217
- ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
218
- ocargo.BlocklyControl.BLOCK_HEIGHT));
219
- }
220
- };
221
-
222
- Blockly.Blocks['at_destination'] = {
223
- init: function() {
224
- this.setColour(210);
225
- this.setOutput(true, 'Boolean');
226
- this.appendDummyInput()
227
- .appendField(gettext('at destination'))
228
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
229
- ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
230
- ocargo.BlocklyControl.BLOCK_HEIGHT));
231
- }
232
- };
233
-
234
- /****************/
235
- /* Procedures */
236
- /****************/
237
-
238
- Blockly.Blocks['call_proc'] = {
239
- // Block for calling a defined procedure
240
- init: function() {
241
- var name = '';
242
- this.setColour(260);
243
- this.appendDummyInput()
244
- .appendField(gettext('Call'))
245
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg', 7,
246
- ocargo.BlocklyControl.BLOCK_HEIGHT))
247
- .appendField(new Blockly.FieldTextInput(name),'NAME');
248
- this.setPreviousStatement(true, 'Action');
249
- this.setNextStatement(true, 'Action');
250
- this.setTooltip(gettext('Call'));
251
- }
252
-
253
- };
254
-
255
- Blockly.Blocks['declare_proc'] = {
256
- // Block for declaring a procedure
257
- init: function() {
258
- var name = '';
259
- this.setColour(260);
260
- this.appendDummyInput()
261
- .appendField(gettext('Define'))
262
- .appendField(new Blockly.FieldTextInput(name),'NAME');
263
- this.appendStatementInput('DO')
264
- .setCheck('Action')
265
- .appendField(gettext('Do'));
266
- this.setTooltip(gettext('Declares the procedure'));
267
- this.statementConnection_ = null;
268
- }
269
- };
270
-
271
- /****************/
272
- /* Events */
273
- /****************/
274
-
275
- Blockly.Blocks['declare_event'] = {
276
-
277
- // Block for declaring an event handler
278
- init: function() {
279
- this.setColour(260);
280
- var dropdown = new Blockly.FieldDropdown([[gettext('white'), ocargo.Cow.WHITE], [gettext('brown'), ocargo.Cow.BROWN]], function(option) {
281
- var imageUrl = ocargo.Drawing.imageDir + ocargo.Drawing.cowUrl(option);
282
- this.sourceBlock_.getField('IMAGE').setValue(imageUrl);
283
- });
284
- this.appendDummyInput('Event')
285
- .appendField(gettext('On '))
286
- .appendField(dropdown, 'TYPE')
287
- .appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + ocargo.Drawing.whiteCowUrl,
288
- ocargo.BlocklyControl.COW_WIDTH,
289
- ocargo.BlocklyControl.BLOCK_HEIGHT), 'IMAGE');
290
- this.getField('IMAGE').EDITABLE = true; //saves the image path as well in the XML
291
- this.appendStatementInput('DO')
292
- .setCheck('EventAction')
293
- .appendField(gettext('Do'));
294
- this.setTooltip(gettext('Declares the event handler'));
295
- this.statementConnection_ = null;
296
- }
297
- };
298
-
299
- /*******************/
300
- /* Control Flows */
301
- /*******************/
302
-
303
- Blockly.Blocks['controls_repeat_while'] = {
304
- // Block for repeat while
305
- init: function() {
306
- this.setColour(120);
307
- this.appendValueInput("condition")
308
- .setCheck("Boolean")
309
- .appendField(gettext('repeat while'));
310
- this.appendStatementInput("body")
311
- .setCheck("Action")
312
- .appendField(gettext('do'));
313
- this.setPreviousStatement(true, 'Action');
314
- this.setNextStatement(true, 'Action');
315
- this.setTooltip(gettext('While a value is true, do some statements'));
316
- }
317
- };
318
-
319
- Blockly.Blocks['controls_repeat_until'] = {
320
- // Block for repeat until
321
- init: function() {
322
- this.setColour(120);
323
- this.appendValueInput("condition")
324
- .setCheck("Boolean")
325
- .appendField(gettext('repeat until'));
326
- this.appendStatementInput("body")
327
- .setCheck("Action")
328
- .appendField(gettext('do'));
329
- this.setPreviousStatement(true, 'Action');
330
- this.setNextStatement(true, 'Action');
331
- this.setTooltip(gettext('Until a value is true, do some statements'));
332
- }
333
- };
334
-
335
- // Set text colour to red
336
- var textBlock = Blockly.Blocks['text'];
337
- var originalTextInit = textBlock.init;
338
- textBlock.init = function() {
339
- originalTextInit.call(this);
340
- this.setColour(260);
341
- };
342
-
343
- //Customise controls_repeat block to not allow more than a sensible number of repetitions
344
- var controlsRepeatBlock = Blockly.Blocks['controls_repeat'];
345
- var originalInit = controlsRepeatBlock.init;
346
- controlsRepeatBlock.init = function () {
347
- originalInit.call(this);
348
-
349
- this.setPreviousStatement(!0, 'Action');
350
- this.setNextStatement(!0, 'Action');
351
- this.inputList[1].setCheck('Action'); //Disallow event action blocks to be in body
352
-
353
- var input = this.inputList[0];
354
- var field = input.fieldRow[1];
355
- field.changeHandler_ = function(text) {
356
- var n = Blockly.FieldTextInput.numberValidator(text);
357
- if (n) {
358
- n = String(Math.min(Math.max(0, Math.floor(n)), 20));
359
- }
360
- return n;
361
- };
362
- };
363
-
364
- // Make 'not' taller
365
- var notBlock = Blockly.Blocks['logic_negate'];
366
- var originalNotInit = notBlock.init;
367
- notBlock.init = function () {
368
- originalNotInit.call(this);
369
- this.inputList[0].appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
370
- ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
371
- ocargo.BlocklyControl.BLOCK_HEIGHT));
372
- };
389
+ );
390
+ this.appendDummyInput("Event")
391
+ .appendField(gettext("On "))
392
+ .appendField(dropdown, "TYPE")
393
+ .appendField(
394
+ new Blockly.FieldImage(
395
+ ocargo.Drawing.imageDir + ocargo.Drawing.whiteCowUrl,
396
+ ocargo.BlocklyControl.COW_WIDTH,
397
+ ocargo.BlocklyControl.BLOCK_HEIGHT
398
+ ),
399
+ "IMAGE"
400
+ );
401
+ this.getField("IMAGE").EDITABLE = true; //saves the image path as well in the XML
402
+ this.appendStatementInput("DO")
403
+ .setCheck("EventAction")
404
+ .appendField(gettext("Do"));
405
+ this.setTooltip(gettext("Declares the event handler"));
406
+ this.statementConnection_ = null;
407
+ },
408
+ };
409
+
410
+ /*******************/
411
+ /* Control Flows */
412
+ /*******************/
413
+
414
+ Blockly.Blocks["controls_repeat_while"] = {
415
+ // Block for repeat while
416
+ init: function () {
417
+ this.setColour(120);
418
+ this.appendValueInput("condition")
419
+ .setCheck("Boolean")
420
+ .appendField(Blockly.Msg.CONTROLS_REPEAT_WHILE_TITLE);
421
+ this.appendStatementInput("body")
422
+ .setCheck("Action")
423
+ .appendField(Blockly.Msg.CONTROLS_REPEAT_WHILE_SUBTITLE);
424
+ this.setPreviousStatement(true, "Action");
425
+ this.setNextStatement(true, "Action");
426
+ this.setTooltip(Blockly.Msg.CONTROLS_REPEAT_WHILE_TOOLTIP);
427
+ },
428
+ };
429
+
430
+ Blockly.Blocks["controls_repeat_until"] = {
431
+ // Block for repeat until
432
+ init: function () {
433
+ this.setColour(120);
434
+ this.appendValueInput("condition")
435
+ .setCheck("Boolean")
436
+ .appendField(Blockly.Msg.CONTROLS_REPEAT_UNTIL_TITLE);
437
+ this.appendStatementInput("body")
438
+ .setCheck("Action")
439
+ .appendField(Blockly.Msg.CONTROLS_REPEAT_UNTIL_SUBTITLE);
440
+ this.setPreviousStatement(true, "Action");
441
+ this.setNextStatement(true, "Action");
442
+ this.setTooltip(Blockly.Msg.CONTROLS_REPEAT_UNTIL_TOOLTIP);
443
+ },
444
+ };
445
+
446
+ /*****************/
447
+ /* Variables */
448
+ /*****************/
449
+
450
+ Blockly.Blocks["variables_get"] = {
451
+ init: function () {
452
+ this.appendDummyInput().appendField(
453
+ new Blockly.FieldTextInput(""),
454
+ "NAME"
455
+ );
456
+ this.setOutput(true, null);
457
+ this.setColour(330);
458
+ this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP);
459
+ },
460
+ };
461
+
462
+ Blockly.Blocks["variables_set"] = {
463
+ init: function () {
464
+ this.appendValueInput("VALUE")
465
+ .setCheck(null)
466
+ .appendField(Blockly.Msg.VARIABLES_SET_TITLE)
467
+ .appendField(new Blockly.FieldTextInput(""), "VAR")
468
+ .appendField(Blockly.Msg.VARIABLES_SET_SUBTITLE);
469
+ this.setPreviousStatement(true, null);
470
+ this.setNextStatement(true, null);
471
+ this.setColour(330);
472
+ this.setTooltip(Blockly.Msg.VARIABLES_SET_TOOLTIP);
473
+ },
474
+ };
475
+
476
+ Blockly.Blocks["variables_numeric_set"] = {
477
+ init: function () {
478
+ this.appendDummyInput()
479
+ .appendField(Blockly.Msg.VARIABLES_SET_TITLE)
480
+ .appendField(new Blockly.FieldTextInput(""), "NAME")
481
+ .appendField(Blockly.Msg.VARIABLES_SET_SUBTITLE)
482
+ .appendField(new Blockly.FieldNumber(0), "VALUE");
483
+ this.setPreviousStatement(true, null);
484
+ this.setNextStatement(true, null);
485
+ this.setColour(330);
486
+ this.setTooltip(Blockly.Msg.VARIABLES_NUMERIC_SET_TOOLTIP);
487
+ },
488
+ };
489
+
490
+ Blockly.Blocks["variables_increment"] = {
491
+ init: function () {
492
+ this.appendDummyInput()
493
+ .appendField(Blockly.Msg.VARIABLES_INCREMENT_TITLE)
494
+ .appendField(new Blockly.FieldTextInput(""), "NAME")
495
+ .appendField(Blockly.Msg.VARIABLES_INCREMENT_SUBTITLE)
496
+ .appendField(new Blockly.FieldNumber(0), "VALUE");
497
+ this.setPreviousStatement(true, null);
498
+ this.setNextStatement(true, null);
499
+ this.setColour(330);
500
+ this.setTooltip(Blockly.Msg.VARIABLES_INCREMENT_TOOLTIP);
501
+ },
502
+ };
503
+
504
+ /***************/
505
+ /* Numbers */
506
+ /***************/
507
+
508
+ Blockly.Blocks["math_number"] = {
509
+ init: function () {
510
+ this.appendDummyInput()
511
+ .appendField(Blockly.Msg.NUMBER_TITLE)
512
+ .appendField(new Blockly.FieldNumber(0), "NUM");
513
+ this.setOutput(true, null);
514
+ this.setColour(230);
515
+ this.setTooltip(Blockly.Msg.NUMBER_TOOLTIP);
516
+ },
517
+ };
518
+
519
+ // Set text colour to red
520
+ var textBlock = Blockly.Blocks["text"];
521
+ var originalTextInit = textBlock.init;
522
+ textBlock.init = function () {
523
+ originalTextInit.call(this);
524
+ this.setColour(260);
525
+ };
526
+
527
+ //Customise controls_repeat block to not allow more than a sensible number of repetitions
528
+ var controlsRepeatBlock = Blockly.Blocks["controls_repeat"];
529
+ var originalInit = controlsRepeatBlock.init;
530
+ controlsRepeatBlock.init = function () {
531
+ originalInit.call(this);
532
+
533
+ this.setPreviousStatement(!0, "Action");
534
+ this.setNextStatement(!0, "Action");
535
+ this.inputList[1].setCheck("Action"); //Disallow event action blocks to be in body
536
+
537
+ var input = this.inputList[0];
538
+ var field = input.fieldRow[1];
539
+ field.changeHandler_ = function (text) {
540
+ var n = Blockly.FieldTextInput.numberValidator(text);
541
+ if (n) {
542
+ n = String(Math.min(Math.max(0, Math.floor(n)), 20));
543
+ }
544
+ return n;
545
+ };
546
+ };
547
+
548
+ // Make 'not' taller
549
+ var notBlock = Blockly.Blocks["logic_negate"];
550
+ var originalNotInit = notBlock.init;
551
+ notBlock.init = function () {
552
+ originalNotInit.call(this);
553
+ this.inputList[0].appendField(
554
+ new Blockly.FieldImage(
555
+ ocargo.Drawing.imageDir + "empty.svg",
556
+ ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
557
+ ocargo.BlocklyControl.BLOCK_HEIGHT
558
+ )
559
+ );
560
+ };
373
561
  }
374
562
 
375
563
  function initCustomBlocksPython() {
376
- Blockly.Python['start'] = function(block) {
377
- return '';
378
- };
379
-
380
- Blockly.Python['move_forwards'] = function(block) {
381
- return 'my_van.move_forwards()\n';
382
- };
383
-
384
- Blockly.Python['turn_left'] = function(block) {
385
- return 'my_van.turn_left()\n';
386
- };
387
-
388
- Blockly.Python['turn_right'] = function(block) {
389
- return 'my_van.turn_right()\n';
390
- };
391
-
392
- Blockly.Python['turn_around'] = function(block) {
393
- return 'my_van.turn_around()\n';
394
- };
395
-
396
- Blockly.Python['wait'] = function(block) {
397
- return 'my_van.wait()\n';
398
- };
399
-
400
- Blockly.Python['deliver'] = function(block) {
401
- return 'v.deliver()\n';
402
- };
403
-
404
- Blockly.Python['road_exists'] = function(block) {
405
- if(block.inputList[0].fieldRow[1].value_ === 'FORWARD'){
406
- var python = "my_van.is_road('FORWARD')";
407
- }else if(block.inputList[0].fieldRow[1].value_ === 'LEFT'){
408
- var python = "my_van.is_road('LEFT')";
409
- }else{
410
- var python = "my_van.is_road('RIGHT')";
411
- }
412
-
413
- return [python, Blockly.Python.ORDER_NONE];
414
- // TODO: figure out what this ordering relates to
415
- };
416
-
417
- Blockly.Python['traffic_light'] = function(block) {
418
- var python;
419
- if(block.inputList[0].fieldRow[1].value_ === ocargo.TrafficLight.RED){
420
- python = "my_van.at_traffic_light('RED')";
421
- }else{
422
- python = "my_van.at_traffic_light('GREEN')";
423
- }
424
-
425
- return [python, Blockly.Python.ORDER_NONE]; //TODO: figure out what this ordering relates to
426
- };
427
-
428
- Blockly.Python['dead_end'] = function(block) {
429
- return ['my_van.at_dead_end()', Blockly.Python.ORDER_NONE];
430
- // TODO: figure out what this ordering relates to
431
- };
432
-
433
- Blockly.Python['cow_crossing'] = function(block) {
434
- return ['my_van.cow_crossing()', Blockly.Python.ORDER_NONE];
435
- // TODO: figure out what this ordering relates to
436
- };
437
-
438
- Blockly.Python['at_destination'] = function(block) {
439
- return ['my_van.at_destination()', Blockly.Python.ORDER_NONE];
440
- // TODO: figure out what this ordering relates to;
441
- };
442
-
443
- Blockly.Python['call_proc'] = function(block) {
444
- return block.inputList[0].fieldRow[2].text_ + '()\n';
445
- };
446
-
447
- Blockly.Python['declare_proc'] = function(block) {
448
- var branch = Blockly.Python.statementToCode(block, 'DO');
449
- return 'def ' + block.inputList[0].fieldRow[1].text_ + '():\n' + branch;
450
- // TODO: get code out of sub-blocks (there's a Blockly function for it)
451
- };
452
-
453
- Blockly.Python['declare_event'] = function(block) {
454
- // TODO support events in python
455
- throw 'events not supported in python';
456
- };
457
-
458
- Blockly.Python['controls_repeat_while'] = function(block) {
459
- var condition = Blockly.Python.valueToCode(block, 'condition', Blockly.Python.ORDER_ATOMIC);
460
- var subBlock = Blockly.Python.statementToCode(block, 'body');
461
- var code = 'while ' + condition + ':\n' + subBlock;
462
- return code;
463
- };
464
-
465
- Blockly.Python['controls_repeat_until'] = function(block) {
466
- var condition = Blockly.Python.valueToCode(block, 'condition', Blockly.Python.ORDER_ATOMIC);
467
- var subBlock = Blockly.Python.statementToCode(block, 'body');
468
- var code = 'while not ' + condition + ':\n' + subBlock;
469
- return code;
470
- };
564
+ Blockly.Python["start"] = function (block) {
565
+ return "";
566
+ };
567
+
568
+ Blockly.Python["move_forwards"] = function (block) {
569
+ return "my_van.move_forwards()\n";
570
+ };
571
+
572
+ Blockly.Python["turn_left"] = function (block) {
573
+ return "my_van.turn_left()\n";
574
+ };
575
+
576
+ Blockly.Python["turn_right"] = function (block) {
577
+ return "my_van.turn_right()\n";
578
+ };
579
+
580
+ Blockly.Python["turn_around"] = function (block) {
581
+ return "my_van.turn_around()\n";
582
+ };
583
+
584
+ Blockly.Python["wait"] = function (block) {
585
+ return "my_van.wait()\n";
586
+ };
587
+
588
+ Blockly.Python["deliver"] = function (block) {
589
+ return "my_van.deliver()\n";
590
+ };
591
+
592
+ Blockly.Python["sound_horn"] = function (block) {
593
+ return "my_van.sound_horn()\n";
594
+ };
595
+
596
+ Blockly.Python["road_exists"] = function (block) {
597
+ if (block.inputList[0].fieldRow[1].value_ === "FORWARD") {
598
+ var python = "my_van.is_road_forward()";
599
+ } else if (block.inputList[0].fieldRow[1].value_ === "LEFT") {
600
+ var python = "my_van.is_road_left()";
601
+ } else {
602
+ var python = "my_van.is_road_right()";
603
+ }
604
+
605
+ return [python, Blockly.Python.ORDER_NONE];
606
+ // TODO: figure out what this ordering relates to
607
+ };
608
+
609
+ Blockly.Python["traffic_light"] = function (block) {
610
+ var python;
611
+ if (block.inputList[0].fieldRow[1].value_ === ocargo.TrafficLight.RED) {
612
+ python = "my_van.is_red_traffic_light()";
613
+ } else {
614
+ python = "my_van.is_green_traffic_light()";
615
+ }
616
+
617
+ return [python, Blockly.Python.ORDER_NONE]; //TODO: figure out what this ordering relates to
618
+ };
619
+
620
+ Blockly.Python["dead_end"] = function (block) {
621
+ return ["my_van.at_dead_end()", Blockly.Python.ORDER_NONE];
622
+ // TODO: figure out what this ordering relates to
623
+ };
624
+
625
+ Blockly.Python["cow_crossing"] = function (block) {
626
+ return ["my_van.is_animal_crossing()", Blockly.Python.ORDER_NONE];
627
+ // TODO: figure out what this ordering relates to
628
+ };
629
+
630
+ Blockly.Python["at_destination"] = function (block) {
631
+ return ["my_van.at_destination()", Blockly.Python.ORDER_NONE];
632
+ // TODO: figure out what this ordering relates to;
633
+ };
634
+
635
+ Blockly.Python["call_proc"] = function (block) {
636
+ return block.inputList[0].fieldRow[2].text_ + "()\n";
637
+ };
638
+
639
+ Blockly.Python["declare_proc"] = function (block) {
640
+ var branch = Blockly.Python.statementToCode(block, "DO");
641
+ return "def " + block.inputList[0].fieldRow[1].text_ + "():\n" + branch;
642
+ // TODO: get code out of sub-blocks (there's a Blockly function for it)
643
+ };
644
+
645
+ Blockly.Python["declare_event"] = function (block) {
646
+ // TODO support events in python
647
+ throw "events not supported in python";
648
+ };
649
+
650
+ Blockly.Python["controls_repeat_while"] = function (block) {
651
+ var condition = Blockly.Python.valueToCode(
652
+ block,
653
+ "condition",
654
+ Blockly.Python.ORDER_ATOMIC
655
+ );
656
+
657
+ condition = condition.replace(/\((.*)\)/, "$1");
658
+
659
+ var subBlock = Blockly.Python.statementToCode(block, "body");
660
+ var code = "while " + condition + ":\n" + subBlock;
661
+ return code;
662
+ };
663
+
664
+ Blockly.Python["controls_repeat_until"] = function (block) {
665
+ var condition = Blockly.Python.valueToCode(
666
+ block,
667
+ "condition",
668
+ Blockly.Python.ORDER_ATOMIC
669
+ );
670
+ var subBlock = Blockly.Python.statementToCode(block, "body");
671
+ var code = "while not " + condition + ":\n" + subBlock;
672
+ return code;
673
+ };
674
+
675
+ Blockly.Python["variables_get"] = function (block) {
676
+ var variableName = block.getFieldValue("NAME");
677
+ return [variableName, Blockly.Python.ORDER_ATOMIC];
678
+ };
679
+
680
+ Blockly.Python["variables_set"] = function (block) {
681
+ var variableName = block.getFieldValue("VAR");
682
+ var value = Blockly.Python.valueToCode(
683
+ block,
684
+ "VALUE",
685
+ Blockly.Python.ORDER_NONE
686
+ );
687
+ var code = `${variableName} = ${value}\n`;
688
+ return code;
689
+ };
690
+
691
+ Blockly.Python["variables_numeric_set"] = function (block) {
692
+ var variableName = block.getFieldValue("NAME");
693
+ var numberValue = block.getFieldValue("VALUE");
694
+ var code = `${variableName} = ${numberValue}\n`;
695
+ return code;
696
+ };
697
+
698
+ Blockly.Python["variables_increment"] = function (block) {
699
+ var variableName = block.getFieldValue("NAME");
700
+ var numberValue = block.getFieldValue("VALUE");
701
+ var code = `${variableName} = ${variableName} + ${numberValue}\n`;
702
+ return code;
703
+ };
471
704
  }