pytron-kit 0.3.12__py3-none-macosx_11_0_universal2.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 (419) hide show
  1. pytron/__init__.py +112 -0
  2. pytron/application.py +562 -0
  3. pytron/apputils/__init__.py +0 -0
  4. pytron/apputils/chrome_ipc.py +203 -0
  5. pytron/apputils/codegen.py +261 -0
  6. pytron/apputils/config.py +303 -0
  7. pytron/apputils/deadmansswitch.py +47 -0
  8. pytron/apputils/extras.py +76 -0
  9. pytron/apputils/native.py +148 -0
  10. pytron/apputils/shell.py +73 -0
  11. pytron/apputils/windows.py +286 -0
  12. pytron/cli.py +384 -0
  13. pytron/commands/__init__.py +0 -0
  14. pytron/commands/android.py +28 -0
  15. pytron/commands/build.py +26 -0
  16. pytron/commands/doctor.py +221 -0
  17. pytron/commands/engine.py +23 -0
  18. pytron/commands/frontend.py +60 -0
  19. pytron/commands/harvest.py +112 -0
  20. pytron/commands/helpers.py +239 -0
  21. pytron/commands/info.py +50 -0
  22. pytron/commands/init.py +521 -0
  23. pytron/commands/install.py +294 -0
  24. pytron/commands/login.py +130 -0
  25. pytron/commands/package.py +228 -0
  26. pytron/commands/plugin.py +442 -0
  27. pytron/commands/run.py +312 -0
  28. pytron/commands/scan.py +210 -0
  29. pytron/commands/show.py +23 -0
  30. pytron/commands/uninstall.py +150 -0
  31. pytron/commands/utils.py +42 -0
  32. pytron/commands/workflow.py +95 -0
  33. pytron/console.py +133 -0
  34. pytron/core.py +18 -0
  35. pytron/dependencies/WebView2Loader.dll +0 -0
  36. pytron/dependencies/__init__.py +1 -0
  37. pytron/dependencies/pytron_native.so +0 -0
  38. pytron/engines/chrome/adapter.py +445 -0
  39. pytron/engines/chrome/engine.py +576 -0
  40. pytron/engines/chrome/forge.py +147 -0
  41. pytron/engines/chrome/shell/package.json +8 -0
  42. pytron/engines/chrome/shell/preload.js +12 -0
  43. pytron/engines/chrome/shell/shell.js +534 -0
  44. pytron/exceptions.py +36 -0
  45. pytron/inspector.py +201 -0
  46. pytron/inspector_ui.py +512 -0
  47. pytron/installer/Installation.nsi +236 -0
  48. pytron/installer/header.bmp +0 -0
  49. pytron/installer/pytron.ico +0 -0
  50. pytron/installer/sidebar.bmp +0 -0
  51. pytron/llms.md +98 -0
  52. pytron/manifests/README.md +29 -0
  53. pytron/manifests/windows-utf8.manifest +44 -0
  54. pytron/menu.py +128 -0
  55. pytron/nsis-setup.exe +0 -0
  56. pytron/pack/__init__.py +0 -0
  57. pytron/pack/assets.py +131 -0
  58. pytron/pack/compilers.py +289 -0
  59. pytron/pack/crystal.py +297 -0
  60. pytron/pack/graph.py +377 -0
  61. pytron/pack/inference.py +157 -0
  62. pytron/pack/installers.py +402 -0
  63. pytron/pack/introspect.py +357 -0
  64. pytron/pack/metadata.py +213 -0
  65. pytron/pack/modules.py +618 -0
  66. pytron/pack/nuitka.py +108 -0
  67. pytron/pack/pipeline.py +107 -0
  68. pytron/pack/pyinstaller.py +176 -0
  69. pytron/pack/rust_engine.py +273 -0
  70. pytron/pack/secure.py +309 -0
  71. pytron/pack/secure_loader/bin/pytron_rust_bootloader +0 -0
  72. pytron/pack/secure_loader/icon.ico +0 -0
  73. pytron/pack/utils.py +110 -0
  74. pytron/pack/virtual_root.py +124 -0
  75. pytron/platforms/__init__.py +0 -0
  76. pytron/platforms/android/__init__.py +3 -0
  77. pytron/platforms/android/android.py +103 -0
  78. pytron/platforms/android/builder.py +736 -0
  79. pytron/platforms/android/ops/build.py +79 -0
  80. pytron/platforms/android/ops/init.py +63 -0
  81. pytron/platforms/android/ops/run.py +79 -0
  82. pytron/platforms/android/ops/sync.py +770 -0
  83. pytron/platforms/android/ops/utils.py +8 -0
  84. pytron/platforms/android/shell/README.md +30 -0
  85. pytron/platforms/android/shell/app/build.gradle +64 -0
  86. pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
  87. pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
  88. pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
  89. pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
  90. pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
  91. pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
  92. pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
  93. pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
  94. pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
  95. pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
  96. pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
  97. pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
  98. pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
  99. pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
  100. pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
  101. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
  102. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
  103. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
  104. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
  105. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
  106. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
  107. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
  108. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
  109. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
  110. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
  111. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
  112. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
  113. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
  114. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
  115. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
  116. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
  117. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
  118. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
  119. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
  120. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
  121. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
  122. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
  123. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
  124. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
  125. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
  126. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
  127. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
  128. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
  129. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
  130. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
  131. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
  132. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
  133. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
  134. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
  135. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
  136. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
  137. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
  138. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
  139. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
  140. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
  141. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
  142. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
  143. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
  144. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
  145. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
  146. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
  147. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
  148. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
  149. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
  150. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
  151. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
  152. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
  153. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
  154. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
  155. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
  156. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
  157. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
  158. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
  159. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
  160. pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
  161. pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
  162. pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
  163. pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
  164. pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
  165. pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
  166. pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
  167. pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
  168. pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
  169. pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
  170. pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
  171. pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
  172. pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
  173. pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
  174. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
  175. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
  176. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
  177. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
  178. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
  179. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
  180. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
  181. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
  182. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
  183. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
  184. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
  185. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
  186. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
  187. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
  188. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
  189. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
  190. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
  191. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
  192. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
  193. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
  194. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
  195. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
  196. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
  197. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
  198. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
  199. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
  200. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
  201. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
  202. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
  203. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
  204. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
  205. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
  206. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
  207. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
  208. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
  209. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
  210. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
  211. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
  212. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
  213. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
  214. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
  215. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
  216. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
  217. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
  218. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
  219. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
  220. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
  221. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
  222. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
  223. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
  224. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
  225. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
  226. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
  227. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
  228. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
  229. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
  230. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
  231. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
  232. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
  233. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
  234. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
  235. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
  236. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
  237. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
  238. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
  239. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
  240. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
  241. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
  242. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
  243. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
  244. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
  245. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
  246. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
  247. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
  248. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
  249. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
  250. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
  251. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
  252. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
  253. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
  254. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
  255. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
  256. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
  257. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
  258. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
  259. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
  260. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
  261. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
  262. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
  263. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
  264. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
  265. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
  266. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
  267. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
  268. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
  269. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
  270. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
  271. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
  272. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
  273. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
  274. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
  275. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
  276. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
  277. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
  278. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
  279. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
  280. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
  281. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
  282. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
  283. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
  284. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
  285. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
  286. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
  287. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
  288. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
  289. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
  290. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
  291. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
  292. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
  293. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
  294. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
  295. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
  296. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
  297. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
  298. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
  299. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
  300. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
  301. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
  302. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
  303. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
  304. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
  305. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
  306. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
  307. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
  308. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
  309. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
  310. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
  311. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
  312. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
  313. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
  314. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
  315. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
  316. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
  317. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
  318. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
  319. pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
  320. pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
  321. pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
  322. pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
  323. pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
  324. pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
  325. pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
  326. pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
  327. pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
  328. pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
  329. pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
  330. pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
  331. pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
  332. pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
  333. pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
  334. pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
  335. pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
  336. pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
  337. pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
  338. pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
  339. pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
  340. pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
  341. pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
  342. pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
  343. pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
  344. pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
  345. pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
  346. pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
  347. pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
  348. pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
  349. pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
  350. pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
  351. pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
  352. pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
  353. pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
  354. pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
  355. pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
  356. pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
  357. pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
  358. pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
  359. pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
  360. pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
  361. pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
  362. pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
  363. pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
  364. pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
  365. pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
  366. pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
  367. pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
  368. pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
  369. pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
  370. pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
  371. pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
  372. pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
  373. pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
  374. pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
  375. pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  376. pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  377. pytron/platforms/android/shell/build.gradle +11 -0
  378. pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
  379. pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
  380. pytron/platforms/android/shell/gradle.properties +2 -0
  381. pytron/platforms/android/shell/gradlew.bat +85 -0
  382. pytron/platforms/android/shell/settings.gradle +16 -0
  383. pytron/platforms/darwin.py +82 -0
  384. pytron/platforms/darwin_ops/libs.py +31 -0
  385. pytron/platforms/darwin_ops/system.py +182 -0
  386. pytron/platforms/darwin_ops/utils.py +85 -0
  387. pytron/platforms/darwin_ops/webview.py +5 -0
  388. pytron/platforms/darwin_ops/window.py +102 -0
  389. pytron/platforms/interface.py +152 -0
  390. pytron/platforms/linux.py +82 -0
  391. pytron/platforms/linux_ops/libs.py +49 -0
  392. pytron/platforms/linux_ops/system.py +316 -0
  393. pytron/platforms/linux_ops/utils.py +19 -0
  394. pytron/platforms/linux_ops/webview.py +5 -0
  395. pytron/platforms/linux_ops/window.py +115 -0
  396. pytron/platforms/windows.py +136 -0
  397. pytron/platforms/windows_ops/__init__.py +0 -0
  398. pytron/platforms/windows_ops/constants.py +126 -0
  399. pytron/platforms/windows_ops/system.py +518 -0
  400. pytron/platforms/windows_ops/utils.py +3 -0
  401. pytron/platforms/windows_ops/webview.py +5 -0
  402. pytron/platforms/windows_ops/window.py +361 -0
  403. pytron/plugin.py +467 -0
  404. pytron/rcedit-x64.exe +0 -0
  405. pytron/router.py +146 -0
  406. pytron/serializer.py +240 -0
  407. pytron/shortcuts.py +279 -0
  408. pytron/state.py +76 -0
  409. pytron/tray.py +399 -0
  410. pytron/updater.py +181 -0
  411. pytron/utf8_hook.py +112 -0
  412. pytron/utils.py +44 -0
  413. pytron/webview.py +722 -0
  414. pytron_kit-0.3.12.dist-info/METADATA +131 -0
  415. pytron_kit-0.3.12.dist-info/RECORD +419 -0
  416. pytron_kit-0.3.12.dist-info/WHEEL +5 -0
  417. pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
  418. pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
  419. pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
@@ -0,0 +1,82 @@
1
+ from .interface import PlatformInterface
2
+ from .darwin_ops import window, system, libs
3
+
4
+
5
+ class DarwinImplementation(PlatformInterface):
6
+ def __init__(self):
7
+ # Libraries are loaded by darwin_ops.libs on import
8
+ if not libs.objc:
9
+ print("Pytron Warning: Cocoa/ObjC not found.")
10
+
11
+ def minimize(self, w):
12
+ window.minimize(w)
13
+
14
+ def center(self, w):
15
+ window.center(w)
16
+
17
+ def set_bounds(self, w, x, y, width, height):
18
+ window.set_bounds(w, x, y, width, height)
19
+
20
+ def close(self, w):
21
+ window.close(w)
22
+
23
+ def toggle_maximize(self, w):
24
+ return window.toggle_maximize(w)
25
+
26
+ def make_frameless(self, w):
27
+ window.make_frameless(w)
28
+
29
+ def start_drag(self, w):
30
+ window.start_drag(w)
31
+
32
+ def message_box(self, w, title, message, style=0):
33
+ return system.message_box(w, title, message, style)
34
+
35
+ def hide(self, w):
36
+ window.hide(w)
37
+
38
+ def is_visible(self, w):
39
+ return window.is_visible(w)
40
+
41
+ def is_alive(self, w):
42
+ # On macOS/Cocoa, we check if the NSWindow pointer is still valid
43
+ win = window.get_window(w)
44
+ return bool(win and win != 0)
45
+
46
+ def show(self, w):
47
+ window.show(w)
48
+
49
+ def set_fullscreen(self, w, fullscreen):
50
+ window.set_fullscreen(w, fullscreen)
51
+
52
+ def set_always_on_top(self, w, enable):
53
+ window.set_always_on_top(w, enable)
54
+
55
+ def notification(self, w, title, message, icon=None):
56
+ system.notification(w, title, message, icon)
57
+
58
+ def open_file_dialog(self, w, title, default_path=None, file_types=None):
59
+ return system.open_file_dialog(w, title, default_path, file_types)
60
+
61
+ def save_file_dialog(
62
+ self, w, title, default_path=None, default_name=None, file_types=None
63
+ ):
64
+ return system.save_file_dialog(w, title, default_path, default_name, file_types)
65
+
66
+ def open_folder_dialog(self, w, title, default_path=None):
67
+ return system.open_folder_dialog(w, title, default_path)
68
+
69
+ def set_taskbar_progress(self, w, state="normal", value=0, max_value=100):
70
+ system.set_taskbar_progress(w, state, value, max_value)
71
+
72
+ def set_window_icon(self, w, icon_path):
73
+ window.set_window_icon(w, icon_path)
74
+
75
+ def set_app_id(self, app_id):
76
+ system.set_app_id(app_id)
77
+
78
+ def set_launch_on_boot(self, app_name, exe_path, enable=True):
79
+ return system.set_launch_on_boot(app_name, exe_path, enable)
80
+
81
+ def register_protocol(self, scheme):
82
+ return system.register_protocol(scheme)
@@ -0,0 +1,31 @@
1
+ import ctypes
2
+ import ctypes.util
3
+
4
+ cocoa = None
5
+ objc = None
6
+
7
+
8
+ def load_libs():
9
+ global cocoa, objc
10
+ try:
11
+ # Load Cocoa
12
+ cocoa = ctypes.cdll.LoadLibrary(ctypes.util.find_library("Cocoa"))
13
+
14
+ # Setup objc_msgSend
15
+ objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library("objc"))
16
+
17
+ objc.objc_getClass.restype = ctypes.c_void_p
18
+ objc.objc_getClass.argtypes = [ctypes.c_char_p]
19
+
20
+ objc.sel_registerName.restype = ctypes.c_void_p
21
+ objc.sel_registerName.argtypes = [ctypes.c_char_p]
22
+
23
+ # Do NOT set restype/argtypes for objc_msgSend here.
24
+ # It MUST be cast to the correct signature for every call on ARM64.
25
+
26
+ except Exception as e:
27
+ print(f"Pytron Warning: Cocoa/ObjC not found: {e}")
28
+ objc = None
29
+
30
+
31
+ load_libs()
@@ -0,0 +1,182 @@
1
+ import subprocess
2
+ import os
3
+ import ctypes
4
+ from . import libs
5
+ from .utils import get_class, str_to_nsstring, msg_send, call
6
+
7
+
8
+ def message_box(w, title, message, style=0):
9
+ # Use osascript for native-look dialogs
10
+ script = ""
11
+ if style == 4:
12
+ script = f'display alert "{title}" message "{message}" buttons {{"No", "Yes"}} default button "Yes"'
13
+ elif style == 1:
14
+ script = f'display alert "{title}" message "{message}" buttons {{"Cancel", "OK"}} default button "OK"'
15
+ else:
16
+ script = f'display alert "{title}" message "{message}" buttons {{"OK"}} default button "OK"'
17
+
18
+ try:
19
+ output = subprocess.check_output(["osascript", "-e", script], text=True)
20
+ if "Yes" in output or "OK" in output:
21
+ return 6 if style == 4 else 1
22
+ return 7 if style == 4 else 2
23
+ except subprocess.CalledProcessError:
24
+ return 7 if style == 4 else 2
25
+ except Exception:
26
+ return 6
27
+
28
+
29
+ def notification(w, title, message, icon=None):
30
+ script = f'display notification "{message}" with title "{title}"'
31
+ try:
32
+ subprocess.Popen(["osascript", "-e", script])
33
+ except Exception:
34
+ pass
35
+
36
+
37
+ def _run_osascript_dialog(script):
38
+ try:
39
+ proc = subprocess.run(
40
+ ["osascript", "-e", script], capture_output=True, text=True
41
+ )
42
+ if proc.returncode == 0:
43
+ return proc.stdout.strip()
44
+ return None
45
+ except Exception:
46
+ return None
47
+
48
+
49
+ def open_file_dialog(w, title, default_path=None, file_types=None):
50
+ script = f'POSIX path of (choose file with prompt "{title}"'
51
+ if default_path:
52
+ script += f' default location "{default_path}"'
53
+ script += ")"
54
+ return _run_osascript_dialog(script)
55
+
56
+
57
+ def save_file_dialog(w, title, default_path=None, default_name=None, file_types=None):
58
+ script = f'POSIX path of (choose file name with prompt "{title}"'
59
+ if default_path:
60
+ script += f' default location "{default_path}"'
61
+ if default_name:
62
+ script += f' default name "{default_name}"'
63
+ script += ")"
64
+ return _run_osascript_dialog(script)
65
+
66
+
67
+ def open_folder_dialog(w, title, default_path=None):
68
+ script = f'POSIX path of (choose folder with prompt "{title}"'
69
+ if default_path:
70
+ script += f' default location "{default_path}"'
71
+ script += ")"
72
+ return _run_osascript_dialog(script)
73
+
74
+
75
+ def set_app_id(app_id):
76
+ if not libs.objc:
77
+ return
78
+ try:
79
+ cls_proc = get_class("NSProcessInfo")
80
+ proc_info = msg_send(cls_proc, "processInfo")
81
+
82
+ name_str = str_to_nsstring(app_id)
83
+ msg_send(proc_info, "setProcessName:", name_str)
84
+ except Exception:
85
+ pass
86
+
87
+
88
+ def set_launch_on_boot(app_name, exe_path, enable=True):
89
+ import shlex
90
+
91
+ home = os.path.expanduser("~")
92
+ launch_agents = os.path.join(home, "Library/LaunchAgents")
93
+ plist_file = os.path.join(launch_agents, f"com.{app_name.lower()}.startup.plist")
94
+
95
+ if enable:
96
+ try:
97
+ os.makedirs(launch_agents, exist_ok=True)
98
+ args = shlex.split(exe_path)
99
+ array_str = "\n".join([f" <string>{a}</string>" for a in args])
100
+ content = f"""<?xml version="1.0" encoding="UTF-8"?>
101
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
102
+ <plist version="1.0">
103
+ <dict>
104
+ <key>Label</key>
105
+ <string>com.{app_name.lower()}.startup</string>
106
+ <key>ProgramArguments</key>
107
+ <array>
108
+ {array_str}
109
+ </array>
110
+ <key>RunAtLoad</key>
111
+ <true/>
112
+ </dict>
113
+ </plist>
114
+ """
115
+ with open(plist_file, "w") as f:
116
+ f.write(content)
117
+ return True
118
+ except Exception as e:
119
+ print(f"[Pytron] Failed to enable launch agent on macOS: {e}")
120
+ return False
121
+ else:
122
+ try:
123
+ if os.path.exists(plist_file):
124
+ os.remove(plist_file)
125
+ return True
126
+ except Exception as e:
127
+ print(f"[Pytron] Failed to disable launch agent on macOS: {e}")
128
+ return False
129
+
130
+
131
+ def set_taskbar_progress(w, state="normal", value=0, max_value=100):
132
+ if not libs.objc:
133
+ return
134
+ try:
135
+ cls_app = get_class("NSApplication")
136
+ ns_app = msg_send(cls_app, "sharedApplication")
137
+ dock_tile = msg_send(ns_app, "dockTile")
138
+
139
+ badge_text = None
140
+ if state in ("normal", "error", "paused") and max_value > 0:
141
+ pct = int((value / max_value) * 100)
142
+ badge_text = str_to_nsstring(f"{pct}%")
143
+ elif state == "indeterminate":
144
+ badge_text = str_to_nsstring("...")
145
+
146
+ msg_send(dock_tile, "setBadgeLabel:", badge_text)
147
+ msg_send(dock_tile, "display")
148
+
149
+ except Exception:
150
+ pass
151
+
152
+
153
+ def register_protocol(scheme):
154
+ """
155
+ Registers the application to handle a custom URI scheme on macOS.
156
+ Note: On macOS, this is primarily handled via the Info.plist CFBundleURLTypes.
157
+ This method attempts to refresh the Launch Services database if bundled.
158
+ """
159
+ try:
160
+ import sys
161
+
162
+ if getattr(sys, "frozen", False):
163
+ # Try to find the .app bundle path
164
+ exec_path = sys.executable
165
+ if ".app/Contents/MacOS/" in exec_path:
166
+ app_path = exec_path.split(".app/Contents/MacOS/")[0] + ".app"
167
+ # Use lsregister to refresh the registration
168
+ lsregister_path = "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister"
169
+ if os.path.exists(lsregister_path):
170
+ subprocess.run(
171
+ [lsregister_path, "-f", app_path], capture_output=True
172
+ )
173
+ return True
174
+
175
+ # If not bundled or lsregister failed
176
+ print(
177
+ f"[Pytron] Warning: For {scheme}:// to work on macOS, the application should be bundled as a .app with the scheme defined in Info.plist."
178
+ )
179
+ return False
180
+ except Exception as e:
181
+ print(f"[Pytron] macOS Protocol Registration Error: {e}")
182
+ return False
@@ -0,0 +1,85 @@
1
+ import ctypes
2
+ from . import libs
3
+
4
+ # In Native Engine architecture, 'w' is passed as the NSWindow pointer/integer directly.
5
+
6
+
7
+ def get_window(w):
8
+ return w
9
+
10
+
11
+ get_hwnd = get_window
12
+
13
+
14
+ def msg_send(target, selector, *args, restype=ctypes.c_void_p, argtypes=None):
15
+ if not libs.objc:
16
+ return None
17
+
18
+ # Safety: If we are in a test environment with Mocks, avoid CFUNCTYPE casting
19
+ # on the mock as it can cause infinite recursion during internal ctypes inspection.
20
+ from unittest.mock import Mock
21
+
22
+ if isinstance(libs.objc, Mock):
23
+ # In mock mode, just call directly to record the call
24
+ # and ensure sel_registerName is called so tests pass.
25
+ sel = libs.objc.sel_registerName(selector.encode("utf-8"))
26
+ return libs.objc.objc_msgSend(target, sel, *args)
27
+
28
+ # On macOS ARM64, objc_msgSend MUST be cast to the correct function pointer type
29
+ # before being called, or it will cause a segmentation fault.
30
+ if argtypes is None:
31
+ # Infer from args
32
+ argtypes = []
33
+ for x in args:
34
+ if isinstance(x, (int, float, bool)):
35
+ if isinstance(x, bool):
36
+ argtypes.append(ctypes.c_bool)
37
+ elif isinstance(x, float):
38
+ argtypes.append(ctypes.c_double)
39
+ else:
40
+ argtypes.append(ctypes.c_void_p)
41
+ else:
42
+ argtypes.append(ctypes.c_void_p)
43
+
44
+ all_argtypes = [ctypes.c_void_p, ctypes.c_void_p] + list(argtypes)
45
+
46
+ # We must ensure we are using the raw function pointer without restype/argtypes
47
+ # already set on it, as that can interfere with CFUNCTYPE.
48
+ try:
49
+ # Get the underlying function pointer address
50
+ func_addr = ctypes.cast(libs.objc.objc_msgSend, ctypes.c_void_p).value
51
+ proto = ctypes.CFUNCTYPE(restype, *all_argtypes)
52
+ f = proto(func_addr)
53
+ except Exception:
54
+ # Fallback to direct call if casting fails (though this may crash on ARM64)
55
+ f = libs.objc.objc_msgSend
56
+
57
+ sel = libs.objc.sel_registerName(selector.encode("utf-8"))
58
+ return f(target, sel, *args)
59
+
60
+
61
+ def call(obj, selector, *args):
62
+ # Backward compatible call - defaults to void_p return
63
+ return msg_send(obj, selector, *args)
64
+
65
+
66
+ def get_class(name):
67
+ if not libs.objc:
68
+ return None
69
+ return libs.objc.objc_getClass(name.encode("utf-8"))
70
+
71
+
72
+ def str_to_nsstring(s):
73
+ if not libs.objc:
74
+ return None
75
+ cls = get_class("NSString")
76
+ return msg_send(
77
+ cls, "stringWithUTF8String:", s.encode("utf-8"), argtypes=[ctypes.c_char_p]
78
+ )
79
+
80
+
81
+ def bool_to_nsnumber(b):
82
+ if not libs.objc:
83
+ return None
84
+ cls = get_class("NSNumber")
85
+ return msg_send(cls, "numberWithBool:", b, argtypes=[ctypes.c_bool])
@@ -0,0 +1,5 @@
1
+ def register_pytron_scheme(w, callback):
2
+ """
3
+ Deprecated: Using JS-Bridge Interceptor in webview.py for cross-platform stability.
4
+ """
5
+ return None
@@ -0,0 +1,102 @@
1
+ import ctypes
2
+ from . import libs
3
+ from .utils import get_window, call, get_class, str_to_nsstring, msg_send
4
+
5
+
6
+ def minimize(w):
7
+ win = get_window(w)
8
+ call(win, "miniaturize:", None)
9
+
10
+
11
+ def set_bounds(w, x, y, width, height):
12
+ pass
13
+
14
+
15
+ def close(w):
16
+ win = get_window(w)
17
+ call(win, "close")
18
+
19
+
20
+ def toggle_maximize(w):
21
+ win = get_window(w)
22
+ call(win, "zoom:", None)
23
+ return True
24
+
25
+
26
+ def make_frameless(w):
27
+ win = get_window(w)
28
+ # NSWindowStyleMaskTitled = 1 << 0
29
+ # NSWindowStyleMaskClosable = 1 << 1
30
+ # NSWindowStyleMaskMiniaturizable = 1 << 2
31
+ # NSWindowStyleMaskResizable = 1 << 3
32
+ # NSWindowStyleMaskFullSizeContentView = 1 << 15
33
+
34
+ # We want bits: 1|2|4|8|32768 = 32783
35
+ call(win, "setStyleMask:", 32783) # Standard macos "frameless but native controls"
36
+ call(win, "setTitlebarAppearsTransparent:", 1)
37
+ call(win, "setTitleVisibility:", 1) # NSWindowTitleHidden
38
+
39
+
40
+ def start_drag(w):
41
+ win = get_window(w)
42
+ call(win, "setMovableByWindowBackground:", 1)
43
+
44
+
45
+ def hide(w):
46
+ win = get_window(w)
47
+ call(win, "orderOut:", None)
48
+
49
+
50
+ def is_visible(w):
51
+ win = get_window(w)
52
+ return bool(call(win, "isVisible"))
53
+
54
+
55
+ def show(w):
56
+ win = get_window(w)
57
+ call(win, "makeKeyAndOrderFront:", None)
58
+ try:
59
+ cls_app = get_class("NSApplication")
60
+ ns_app = msg_send(cls_app, "sharedApplication")
61
+ msg_send(ns_app, "activateIgnoringOtherApps:", True)
62
+ except Exception:
63
+ pass
64
+
65
+
66
+ def set_window_icon(w, icon_path):
67
+ if not libs.objc or not icon_path:
68
+ return
69
+ try:
70
+ cls_image = get_class("NSImage")
71
+ img_alloc = msg_send(cls_image, "alloc")
72
+ ns_path = str_to_nsstring(icon_path)
73
+ ns_image = msg_send(img_alloc, "initWithContentsOfFile:", ns_path)
74
+
75
+ if ns_image:
76
+ cls_app = get_class("NSApplication")
77
+ ns_app = msg_send(cls_app, "sharedApplication")
78
+ msg_send(ns_app, "setApplicationIconImage:", ns_image)
79
+ except Exception:
80
+ pass
81
+
82
+
83
+ def center(w):
84
+ win = get_window(w)
85
+ call(win, "center")
86
+
87
+
88
+ def set_always_on_top(w, enable):
89
+ win = get_window(w)
90
+ # NSFloatingWindowLevel = 3, NSNormalWindowLevel = 0
91
+ level = 3 if enable else 0
92
+ call(win, "setLevel:", level)
93
+
94
+
95
+ def set_fullscreen(w, enable):
96
+ win = get_window(w)
97
+ # Check current style mask for NSWindowStyleMaskFullScreen (1 << 14)
98
+ style_mask = call(win, "styleMask")
99
+ is_fullscreen = (style_mask & (1 << 14)) != 0
100
+
101
+ if is_fullscreen != enable:
102
+ call(win, "toggleFullScreen:", None)
@@ -0,0 +1,152 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Optional, Dict, List, TypeAlias
3
+
4
+ # Defines a "Handle" type for clarity -> Zero runtime cost, high readability.
5
+ WindowHandle: TypeAlias = int
6
+
7
+
8
+ class PlatformInterface(ABC):
9
+ """
10
+ PINNED STABILITY CONTRACT
11
+ -------------------------
12
+ This interface defines the immutable core contract for all platform implementations.
13
+ Core lifecycle and window operations are abstract and MUST be implemented.
14
+ Extended capabilities (Notifications, Taskbar, etc.) are virtual and optional.
15
+ """
16
+
17
+ # --- Core Window Operations (Pinned) ---
18
+
19
+ @abstractmethod
20
+ def show(self, w: WindowHandle) -> None:
21
+ pass
22
+
23
+ @abstractmethod
24
+ def hide(self, w: WindowHandle) -> None:
25
+ pass
26
+
27
+ @abstractmethod
28
+ def close(self, w: WindowHandle) -> None:
29
+ pass
30
+
31
+ @abstractmethod
32
+ def minimize(self, w: WindowHandle) -> None:
33
+ pass
34
+
35
+ @abstractmethod
36
+ def toggle_maximize(self, w: WindowHandle) -> bool:
37
+ """Returns True if maximized, False if restored."""
38
+ pass
39
+
40
+ @abstractmethod
41
+ def set_bounds(
42
+ self, w: WindowHandle, x: int, y: int, width: int, height: int
43
+ ) -> None:
44
+ pass
45
+
46
+ @abstractmethod
47
+ def set_fullscreen(self, w: WindowHandle, fullscreen: bool) -> None:
48
+ pass
49
+
50
+ @abstractmethod
51
+ def set_always_on_top(self, w: WindowHandle, enable: bool) -> None:
52
+ pass
53
+
54
+ @abstractmethod
55
+ def is_visible(self, w: WindowHandle) -> bool:
56
+ pass
57
+
58
+ @abstractmethod
59
+ def center(self, w: WindowHandle) -> None:
60
+ pass
61
+
62
+ # --- Essential extensions (Should interpret 'w') ---
63
+
64
+ def is_alive(self, w: WindowHandle) -> bool:
65
+ """Checks if the native window handle is still valid. Default True to prevent crashes."""
66
+ return True
67
+
68
+ def make_frameless(self, w: WindowHandle) -> None:
69
+ pass
70
+
71
+ def start_drag(self, w: WindowHandle) -> None:
72
+ pass
73
+
74
+ def set_window_icon(self, w: WindowHandle, icon_path: str) -> None:
75
+ pass
76
+
77
+ def set_menu(self, w: WindowHandle, menu_bar: List) -> None:
78
+ pass
79
+
80
+ # --- System Dialogs & Interactions (Stable Extensions) ---
81
+
82
+ def message_box(
83
+ self, w: WindowHandle, title: str, message: str, style: int = 0
84
+ ) -> int:
85
+ return 0 # Default OK/Cancel result
86
+
87
+ def open_file_dialog(
88
+ self,
89
+ w: WindowHandle,
90
+ title: str,
91
+ default_path: Optional[str] = None,
92
+ file_types: Optional[str] = None,
93
+ ) -> Optional[str]:
94
+ return None
95
+
96
+ def save_file_dialog(
97
+ self,
98
+ w: WindowHandle,
99
+ title: str,
100
+ default_path: Optional[str] = None,
101
+ default_name: Optional[str] = None,
102
+ file_types: Optional[str] = None,
103
+ ) -> Optional[str]:
104
+ return None
105
+
106
+ def open_folder_dialog(
107
+ self, w: WindowHandle, title: str, default_path: Optional[str] = None
108
+ ) -> Optional[str]:
109
+ return None
110
+
111
+ def notification(
112
+ self, w: WindowHandle, title: str, message: str, icon: Optional[str] = None
113
+ ) -> None:
114
+ pass
115
+
116
+ def set_taskbar_progress(
117
+ self, w: WindowHandle, state: str, value: int, max_value: int
118
+ ) -> None:
119
+ """
120
+ Sets the taskbar/dock progress bar state.
121
+ state: 'normal', 'error', 'paused', 'indeterminate', 'none'
122
+ """
123
+ pass
124
+
125
+ # --- System Integration (OS Hooks) ---
126
+
127
+ def register_protocol(self, scheme: str) -> bool:
128
+ return False
129
+
130
+ def set_launch_on_boot(
131
+ self, app_name: str, exe_path: str, enable: bool = True
132
+ ) -> bool:
133
+ return False
134
+
135
+ def set_app_id(self, app_id: str) -> None:
136
+ pass
137
+
138
+ def get_system_info(self) -> Dict:
139
+ return {}
140
+
141
+ # --- Clipboard ---
142
+
143
+ def set_clipboard_text(self, text: str) -> bool:
144
+ return False
145
+
146
+ def get_clipboard_text(self) -> Optional[str]:
147
+ return None
148
+
149
+ # --- UI Polish ---
150
+
151
+ def set_slim_titlebar(self, w: WindowHandle, enabled: bool) -> None:
152
+ pass