pytron-kit 0.3.12__py3-none-win_amd64.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.
- pytron/__init__.py +112 -0
- pytron/application.py +562 -0
- pytron/apputils/__init__.py +0 -0
- pytron/apputils/chrome_ipc.py +203 -0
- pytron/apputils/codegen.py +261 -0
- pytron/apputils/config.py +303 -0
- pytron/apputils/deadmansswitch.py +47 -0
- pytron/apputils/extras.py +76 -0
- pytron/apputils/native.py +148 -0
- pytron/apputils/shell.py +73 -0
- pytron/apputils/windows.py +286 -0
- pytron/cli.py +384 -0
- pytron/commands/__init__.py +0 -0
- pytron/commands/android.py +28 -0
- pytron/commands/build.py +26 -0
- pytron/commands/doctor.py +221 -0
- pytron/commands/engine.py +23 -0
- pytron/commands/frontend.py +60 -0
- pytron/commands/harvest.py +112 -0
- pytron/commands/helpers.py +239 -0
- pytron/commands/info.py +50 -0
- pytron/commands/init.py +521 -0
- pytron/commands/install.py +294 -0
- pytron/commands/login.py +130 -0
- pytron/commands/package.py +228 -0
- pytron/commands/plugin.py +442 -0
- pytron/commands/run.py +312 -0
- pytron/commands/scan.py +210 -0
- pytron/commands/show.py +23 -0
- pytron/commands/uninstall.py +150 -0
- pytron/commands/utils.py +42 -0
- pytron/commands/workflow.py +95 -0
- pytron/console.py +133 -0
- pytron/core.py +18 -0
- pytron/dependencies/WebView2Loader.dll +0 -0
- pytron/dependencies/__init__.py +1 -0
- pytron/dependencies/pytron_native.pyd +0 -0
- pytron/engines/chrome/adapter.py +445 -0
- pytron/engines/chrome/engine.py +576 -0
- pytron/engines/chrome/forge.py +147 -0
- pytron/engines/chrome/shell/package.json +8 -0
- pytron/engines/chrome/shell/preload.js +12 -0
- pytron/engines/chrome/shell/shell.js +534 -0
- pytron/exceptions.py +36 -0
- pytron/inspector.py +201 -0
- pytron/inspector_ui.py +512 -0
- pytron/installer/Installation.nsi +236 -0
- pytron/installer/header.bmp +0 -0
- pytron/installer/pytron.ico +0 -0
- pytron/installer/sidebar.bmp +0 -0
- pytron/llms.md +98 -0
- pytron/manifests/README.md +29 -0
- pytron/manifests/windows-utf8.manifest +44 -0
- pytron/menu.py +128 -0
- pytron/nsis-setup.exe +0 -0
- pytron/pack/__init__.py +0 -0
- pytron/pack/assets.py +131 -0
- pytron/pack/compilers.py +289 -0
- pytron/pack/crystal.py +297 -0
- pytron/pack/graph.py +377 -0
- pytron/pack/inference.py +157 -0
- pytron/pack/installers.py +402 -0
- pytron/pack/introspect.py +357 -0
- pytron/pack/metadata.py +213 -0
- pytron/pack/modules.py +618 -0
- pytron/pack/nuitka.py +108 -0
- pytron/pack/pipeline.py +107 -0
- pytron/pack/pyinstaller.py +176 -0
- pytron/pack/rust_engine.py +273 -0
- pytron/pack/secure.py +309 -0
- pytron/pack/secure_loader/bin/pytron_rust_bootloader.exe +0 -0
- pytron/pack/secure_loader/icon.ico +0 -0
- pytron/pack/utils.py +110 -0
- pytron/pack/virtual_root.py +124 -0
- pytron/platforms/__init__.py +0 -0
- pytron/platforms/android/__init__.py +3 -0
- pytron/platforms/android/android.py +103 -0
- pytron/platforms/android/builder.py +736 -0
- pytron/platforms/android/ops/build.py +79 -0
- pytron/platforms/android/ops/init.py +63 -0
- pytron/platforms/android/ops/run.py +79 -0
- pytron/platforms/android/ops/sync.py +770 -0
- pytron/platforms/android/ops/utils.py +8 -0
- pytron/platforms/android/shell/README.md +30 -0
- pytron/platforms/android/shell/app/build.gradle +64 -0
- pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
- pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
- pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
- pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
- pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- pytron/platforms/android/shell/build.gradle +11 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
- pytron/platforms/android/shell/gradle.properties +2 -0
- pytron/platforms/android/shell/gradlew.bat +85 -0
- pytron/platforms/android/shell/settings.gradle +16 -0
- pytron/platforms/darwin.py +82 -0
- pytron/platforms/darwin_ops/libs.py +31 -0
- pytron/platforms/darwin_ops/system.py +182 -0
- pytron/platforms/darwin_ops/utils.py +85 -0
- pytron/platforms/darwin_ops/webview.py +5 -0
- pytron/platforms/darwin_ops/window.py +102 -0
- pytron/platforms/interface.py +152 -0
- pytron/platforms/linux.py +82 -0
- pytron/platforms/linux_ops/libs.py +49 -0
- pytron/platforms/linux_ops/system.py +316 -0
- pytron/platforms/linux_ops/utils.py +19 -0
- pytron/platforms/linux_ops/webview.py +5 -0
- pytron/platforms/linux_ops/window.py +115 -0
- pytron/platforms/windows.py +136 -0
- pytron/platforms/windows_ops/__init__.py +0 -0
- pytron/platforms/windows_ops/constants.py +126 -0
- pytron/platforms/windows_ops/system.py +518 -0
- pytron/platforms/windows_ops/utils.py +3 -0
- pytron/platforms/windows_ops/webview.py +5 -0
- pytron/platforms/windows_ops/window.py +361 -0
- pytron/plugin.py +467 -0
- pytron/rcedit-x64.exe +0 -0
- pytron/router.py +146 -0
- pytron/serializer.py +240 -0
- pytron/shortcuts.py +279 -0
- pytron/state.py +76 -0
- pytron/tray.py +399 -0
- pytron/updater.py +181 -0
- pytron/utf8_hook.py +112 -0
- pytron/utils.py +44 -0
- pytron/webview.py +722 -0
- pytron_kit-0.3.12.dist-info/METADATA +131 -0
- pytron_kit-0.3.12.dist-info/RECORD +419 -0
- pytron_kit-0.3.12.dist-info/WHEEL +5 -0
- pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
- pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
- pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import shutil
|
|
4
|
+
import inspect
|
|
5
|
+
import asyncio
|
|
6
|
+
from ..webview import Webview
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class WindowMixin:
|
|
10
|
+
def create_window(self, **kwargs):
|
|
11
|
+
if "url" in kwargs and not getattr(sys, "frozen", False):
|
|
12
|
+
if not kwargs["url"].startswith(("http:", "https:", "file:")):
|
|
13
|
+
if not os.path.isabs(kwargs["url"]):
|
|
14
|
+
kwargs["url"] = os.path.join(self.app_root, kwargs["url"])
|
|
15
|
+
window_config = self.config.copy()
|
|
16
|
+
window_config.update(kwargs)
|
|
17
|
+
window_config["__app__"] = self
|
|
18
|
+
# Only navigate if a URL was explicitly provided, or if this is the first (main) window
|
|
19
|
+
target_url = kwargs.get("url")
|
|
20
|
+
if target_url is None and not self.windows:
|
|
21
|
+
target_url = self.config.get("url")
|
|
22
|
+
|
|
23
|
+
window_config["navigate_on_init"] = False
|
|
24
|
+
|
|
25
|
+
# Engine Selection
|
|
26
|
+
if getattr(self, "engine", "native") == "chrome":
|
|
27
|
+
from ..engines.chrome.engine import ChromeWebView
|
|
28
|
+
|
|
29
|
+
window = ChromeWebView(config=window_config)
|
|
30
|
+
else:
|
|
31
|
+
window = Webview(config=window_config)
|
|
32
|
+
|
|
33
|
+
self.windows.append(window)
|
|
34
|
+
for name, data in self._exposed_functions.items():
|
|
35
|
+
func = data["func"]
|
|
36
|
+
secure = data["secure"]
|
|
37
|
+
run_in_thread = data.get("run_in_thread", True)
|
|
38
|
+
if isinstance(func, type):
|
|
39
|
+
try:
|
|
40
|
+
window.expose(func)
|
|
41
|
+
except Exception as e:
|
|
42
|
+
self.logger.debug(f"Failed to expose class {name}: {e}")
|
|
43
|
+
window.bind(name, func, secure=secure, run_in_thread=run_in_thread)
|
|
44
|
+
else:
|
|
45
|
+
window.bind(name, func, secure=secure, run_in_thread=run_in_thread)
|
|
46
|
+
|
|
47
|
+
if target_url:
|
|
48
|
+
window.navigate(target_url)
|
|
49
|
+
if window_config.get("center", True):
|
|
50
|
+
window.center()
|
|
51
|
+
|
|
52
|
+
icon = window_config.get("icon")
|
|
53
|
+
if icon:
|
|
54
|
+
# Resolve icon path relative to app root or via resource_path
|
|
55
|
+
from ..core import get_resource_path
|
|
56
|
+
|
|
57
|
+
resolved_icon = get_resource_path(icon)
|
|
58
|
+
|
|
59
|
+
# If not found in resource path, check script dir fallback
|
|
60
|
+
if not os.path.exists(resolved_icon):
|
|
61
|
+
resolved_icon = os.path.join(self.app_root, icon)
|
|
62
|
+
|
|
63
|
+
# If it's a PNG, check if a converted .ico exists (from packaging)
|
|
64
|
+
if resolved_icon.lower().endswith(".png"):
|
|
65
|
+
ico_path = resolved_icon.rsplit(".", 1)[0] + ".ico"
|
|
66
|
+
if os.path.exists(ico_path):
|
|
67
|
+
resolved_icon = ico_path
|
|
68
|
+
|
|
69
|
+
if os.path.exists(resolved_icon):
|
|
70
|
+
self.logger.debug(f"Runtime: Applying window icon from {resolved_icon}")
|
|
71
|
+
window.set_icon(resolved_icon)
|
|
72
|
+
else:
|
|
73
|
+
self.logger.warning(f"Runtime: Icon file not found: {icon}")
|
|
74
|
+
|
|
75
|
+
# --- Native Drag & Drop Hook ---
|
|
76
|
+
if hasattr(self, "_on_file_drop_callback") and self._on_file_drop_callback:
|
|
77
|
+
try:
|
|
78
|
+
if sys.platform == "win32":
|
|
79
|
+
|
|
80
|
+
# We wrap the callback to pass the window object as first arg
|
|
81
|
+
def _drop_wrapper(files):
|
|
82
|
+
self.thread_pool.submit(
|
|
83
|
+
self._on_file_drop_callback, window, files
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Native Drag & Drop Hook
|
|
87
|
+
# Switched to JS-based approach for simplicity and stability
|
|
88
|
+
# if self._on_file_drop_callback:
|
|
89
|
+
# enable_drag_drop_safe(window.w, _drop_wrapper)
|
|
90
|
+
elif sys.platform == "linux":
|
|
91
|
+
|
|
92
|
+
def _drop_wrapper(files):
|
|
93
|
+
self.thread_pool.submit(
|
|
94
|
+
self._on_file_drop_callback, window, files
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Native Drag & Drop Hook
|
|
98
|
+
# Switched to JS-based approach for simplicity and stability
|
|
99
|
+
# if self._on_file_drop_callback:
|
|
100
|
+
# enable_drag_drop(window.w, _drop_wrapper)
|
|
101
|
+
elif sys.platform == "darwin":
|
|
102
|
+
# TODO: Implement Cocoa/NSDraggingInfo handling
|
|
103
|
+
self.logger.warning(
|
|
104
|
+
"Native Drag & Drop not yet implemented for macOS."
|
|
105
|
+
)
|
|
106
|
+
except Exception as e:
|
|
107
|
+
self.logger.warning(f"Failed to enable Native Drag & Drop: {e}")
|
|
108
|
+
|
|
109
|
+
return window
|
|
110
|
+
|
|
111
|
+
def run(self, **kwargs):
|
|
112
|
+
self.is_running = True
|
|
113
|
+
if "storage_path" not in kwargs:
|
|
114
|
+
kwargs["storage_path"] = self.storage_path
|
|
115
|
+
|
|
116
|
+
if sys.platform == "win32" and "storage_path" in kwargs:
|
|
117
|
+
os.environ["WEBVIEW2_USER_DATA_FOLDER"] = kwargs["storage_path"]
|
|
118
|
+
|
|
119
|
+
if not self.windows:
|
|
120
|
+
self.create_window()
|
|
121
|
+
|
|
122
|
+
if len(self.windows) > 0:
|
|
123
|
+
# Only attempt to close PyInstaller splash if we are in a PyInstaller-managed environment
|
|
124
|
+
if sys.platform == "win32":
|
|
125
|
+
try:
|
|
126
|
+
import pyi_splash
|
|
127
|
+
|
|
128
|
+
if pyi_splash.is_alive():
|
|
129
|
+
pyi_splash.close()
|
|
130
|
+
self.logger.info("Closed PyInstaller splash screen.")
|
|
131
|
+
except (ImportError, Exception):
|
|
132
|
+
# Not in a PyInstaller frozen environment with splash
|
|
133
|
+
pass
|
|
134
|
+
|
|
135
|
+
for combo, func in self.shortcuts.items():
|
|
136
|
+
self.shortcut_manager.register(combo, func)
|
|
137
|
+
|
|
138
|
+
if self.tray:
|
|
139
|
+
self.tray.start(self)
|
|
140
|
+
|
|
141
|
+
# Dispatch pending deep link (Cold Start)
|
|
142
|
+
if hasattr(self, "state") and self.state.launch_url:
|
|
143
|
+
url = self.state.launch_url
|
|
144
|
+
if hasattr(self, "router"):
|
|
145
|
+
self.router.dispatch(url)
|
|
146
|
+
# Also notify the main window
|
|
147
|
+
if self.windows:
|
|
148
|
+
self.windows[0].emit("pytron:deep-link", {"url": url})
|
|
149
|
+
|
|
150
|
+
self.windows[0].start()
|
|
151
|
+
|
|
152
|
+
self.is_running = False
|
|
153
|
+
|
|
154
|
+
for callback in self._on_exit_callbacks:
|
|
155
|
+
try:
|
|
156
|
+
if inspect.iscoroutinefunction(callback):
|
|
157
|
+
# For async callbacks, run them in the background loop
|
|
158
|
+
# and wait for them to finish before proceeding
|
|
159
|
+
future = asyncio.run_coroutine_threadsafe(callback(), self.loop)
|
|
160
|
+
try:
|
|
161
|
+
future.result(timeout=5) # 5-second timeout for cleanup
|
|
162
|
+
except Exception as e:
|
|
163
|
+
self.logger.error(
|
|
164
|
+
f"Async on_exit callback timed out or failed: {e}"
|
|
165
|
+
)
|
|
166
|
+
else:
|
|
167
|
+
callback()
|
|
168
|
+
except Exception as e:
|
|
169
|
+
self.logger.error(f"Error in on_exit callback: {e}")
|
|
170
|
+
|
|
171
|
+
if self.tray:
|
|
172
|
+
self.tray.stop()
|
|
173
|
+
self.shortcut_manager.stop()
|
|
174
|
+
|
|
175
|
+
if self.config.get("debug", False) and "storage_path" in kwargs:
|
|
176
|
+
path = kwargs["storage_path"]
|
|
177
|
+
if os.path.isdir(path):
|
|
178
|
+
try:
|
|
179
|
+
shutil.rmtree(path, ignore_errors=True)
|
|
180
|
+
except Exception as e:
|
|
181
|
+
self.logger.debug(f"Failed to cleanup temp dir {path}: {e}")
|
|
182
|
+
|
|
183
|
+
def register_protocol(self, scheme="pytron"):
|
|
184
|
+
if not getattr(sys, "frozen", False):
|
|
185
|
+
self.logger.info(
|
|
186
|
+
f"Skipping protocol registration '{scheme}://' in Development Mode."
|
|
187
|
+
)
|
|
188
|
+
return False
|
|
189
|
+
|
|
190
|
+
try:
|
|
191
|
+
# Use the platform implementation from the webview instance if it exists
|
|
192
|
+
# otherwise fall back to detection (Webview creates the correct impl on init)
|
|
193
|
+
impl = self._platform if hasattr(self, "_platform") else None
|
|
194
|
+
|
|
195
|
+
if not impl:
|
|
196
|
+
# Fallback detection for App level calls before windows are created
|
|
197
|
+
import platform
|
|
198
|
+
|
|
199
|
+
sys_plat = platform.system()
|
|
200
|
+
if sys_plat == "Windows":
|
|
201
|
+
from ..platforms.windows import WindowsImplementation
|
|
202
|
+
|
|
203
|
+
impl = WindowsImplementation()
|
|
204
|
+
elif sys_plat == "Linux":
|
|
205
|
+
from ..platforms.linux import LinuxImplementation
|
|
206
|
+
|
|
207
|
+
impl = LinuxImplementation()
|
|
208
|
+
elif sys_plat == "Darwin":
|
|
209
|
+
from ..platforms.darwin import DarwinImplementation
|
|
210
|
+
|
|
211
|
+
impl = DarwinImplementation()
|
|
212
|
+
|
|
213
|
+
if impl and impl.register_protocol(scheme):
|
|
214
|
+
self.logger.info(f"Successfully registered protocol: {scheme}://")
|
|
215
|
+
else:
|
|
216
|
+
self.logger.warning(
|
|
217
|
+
f"Failed to register protocol: {scheme}:// (Not supported or failed on this OS)"
|
|
218
|
+
)
|
|
219
|
+
except Exception as e:
|
|
220
|
+
self.logger.error(f"Error registering protocol: {e}")
|
|
221
|
+
|
|
222
|
+
def broadcast(self, event_name, data):
|
|
223
|
+
if self.windows:
|
|
224
|
+
for window in self.windows:
|
|
225
|
+
try:
|
|
226
|
+
window.emit(event_name, data)
|
|
227
|
+
except Exception as e:
|
|
228
|
+
self.logger.warning(f"Failed to broadcast to window: {e}")
|
|
229
|
+
|
|
230
|
+
def emit_to(self, window_id, event_name, data):
|
|
231
|
+
"""Send an event to a specific window by its ID."""
|
|
232
|
+
for window in self.windows:
|
|
233
|
+
if window.id == window_id:
|
|
234
|
+
window.emit(event_name, data)
|
|
235
|
+
return True
|
|
236
|
+
return False
|
|
237
|
+
|
|
238
|
+
def get_window(self, window_id):
|
|
239
|
+
"""Find a window by its ID."""
|
|
240
|
+
for window in self.windows:
|
|
241
|
+
if window.id == window_id:
|
|
242
|
+
return window
|
|
243
|
+
return None
|
|
244
|
+
|
|
245
|
+
def emit(self, event_name, data):
|
|
246
|
+
self.broadcast(event_name, data)
|
|
247
|
+
|
|
248
|
+
def hide(self):
|
|
249
|
+
if self.windows:
|
|
250
|
+
for window in self.windows:
|
|
251
|
+
try:
|
|
252
|
+
window.hide()
|
|
253
|
+
except Exception as e:
|
|
254
|
+
self.logger.debug(f"Failed to hide window {window}: {e}")
|
|
255
|
+
|
|
256
|
+
def show(self):
|
|
257
|
+
if self.windows:
|
|
258
|
+
for window in self.windows:
|
|
259
|
+
try:
|
|
260
|
+
window.show()
|
|
261
|
+
except Exception as e:
|
|
262
|
+
self.logger.debug(f"Failed to show window {window}: {e}")
|
|
263
|
+
|
|
264
|
+
@property
|
|
265
|
+
def is_visible(self):
|
|
266
|
+
"""Returns True if the primary window is visible."""
|
|
267
|
+
if self.windows:
|
|
268
|
+
return self.windows[0].is_visible()
|
|
269
|
+
return False
|
|
270
|
+
|
|
271
|
+
def notify(self, title, message, type="info", duration=5000):
|
|
272
|
+
if self.windows:
|
|
273
|
+
for window in self.windows:
|
|
274
|
+
try:
|
|
275
|
+
window.notify(title, message, type, duration)
|
|
276
|
+
except Exception as e:
|
|
277
|
+
self.logger.debug(f"Failed to notify window {window}: {e}")
|
|
278
|
+
|
|
279
|
+
def quit(self):
|
|
280
|
+
for window in self.windows:
|
|
281
|
+
window.close(force=True)
|
|
282
|
+
|
|
283
|
+
def set_menubar(self, menu_bar):
|
|
284
|
+
"""Attaches a MenuBar to the primary window."""
|
|
285
|
+
if self.windows:
|
|
286
|
+
self.windows[0].set_menu(menu_bar)
|
pytron/cli.py
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"""Simple CLI for Pytron: run, init, package, and frontend build helpers.
|
|
2
|
+
|
|
3
|
+
This implementation uses only the standard library so there are no extra
|
|
4
|
+
dependencies. It provides convenience commands to scaffold a minimal app,
|
|
5
|
+
run a Python entrypoint, run `pyinstaller` to package, and run frontend builds
|
|
6
|
+
for frontend folders.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
from .commands.init import cmd_init
|
|
13
|
+
from .commands.run import cmd_run
|
|
14
|
+
from .commands.package import cmd_package
|
|
15
|
+
from .commands.build import cmd_build_frontend
|
|
16
|
+
from .commands.info import cmd_info
|
|
17
|
+
from .commands.install import cmd_install
|
|
18
|
+
from .commands.uninstall import cmd_uninstall
|
|
19
|
+
from .commands.show import cmd_show
|
|
20
|
+
from .commands.plugin import cmd_plugin
|
|
21
|
+
from .commands.frontend import cmd_frontend
|
|
22
|
+
from .commands.login import cmd_login, cmd_logout
|
|
23
|
+
from .commands.android import cmd_android
|
|
24
|
+
from .commands.engine import cmd_engine
|
|
25
|
+
from .commands.doctor import cmd_doctor
|
|
26
|
+
from .commands.workflow import cmd_workflow
|
|
27
|
+
from .commands.scan import cmd_scan
|
|
28
|
+
from .console import log
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
32
|
+
# Base parser for shared arguments like --logger
|
|
33
|
+
base_parser = argparse.ArgumentParser(add_help=False)
|
|
34
|
+
base_parser.add_argument(
|
|
35
|
+
"--logger",
|
|
36
|
+
help="Enable file logging (provide path or defaults to pytron.log)",
|
|
37
|
+
nargs="?",
|
|
38
|
+
const="pytron.log",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
parser = argparse.ArgumentParser(
|
|
42
|
+
prog="pytron", description="Pytron CLI", parents=[base_parser]
|
|
43
|
+
)
|
|
44
|
+
sub = parser.add_subparsers(dest="command")
|
|
45
|
+
|
|
46
|
+
p_init = sub.add_parser(
|
|
47
|
+
"init", help="Scaffold a minimal Pytron app", parents=[base_parser]
|
|
48
|
+
)
|
|
49
|
+
p_init.add_argument("target", help="Target directory for scaffold")
|
|
50
|
+
p_init.add_argument(
|
|
51
|
+
"--template",
|
|
52
|
+
default="react",
|
|
53
|
+
help="Frontend template (react, vue, svelte, vanilla, etc.)",
|
|
54
|
+
)
|
|
55
|
+
p_init.add_argument(
|
|
56
|
+
"--provider",
|
|
57
|
+
choices=["npm", "yarn", "pnpm", "bun"],
|
|
58
|
+
default="npm",
|
|
59
|
+
help="JS Package Manager to use for scaffolding (default: npm)",
|
|
60
|
+
)
|
|
61
|
+
p_init.set_defaults(func=cmd_init)
|
|
62
|
+
|
|
63
|
+
p_install = sub.add_parser(
|
|
64
|
+
"install",
|
|
65
|
+
help="Install dependencies into project environment",
|
|
66
|
+
parents=[base_parser],
|
|
67
|
+
)
|
|
68
|
+
p_install.add_argument(
|
|
69
|
+
"packages",
|
|
70
|
+
nargs="*",
|
|
71
|
+
help="Packages to install (if empty, installs from requirements.json)",
|
|
72
|
+
)
|
|
73
|
+
p_install.add_argument(
|
|
74
|
+
"--plugin",
|
|
75
|
+
action="store_true",
|
|
76
|
+
help="Install as a plugin instead of a Python dependency",
|
|
77
|
+
)
|
|
78
|
+
p_install.set_defaults(func=cmd_install)
|
|
79
|
+
|
|
80
|
+
p_uninstall = sub.add_parser(
|
|
81
|
+
"uninstall",
|
|
82
|
+
help="Uninstall dependencies and remove from requirements.json",
|
|
83
|
+
parents=[base_parser],
|
|
84
|
+
)
|
|
85
|
+
p_uninstall.add_argument("packages", nargs="+", help="Packages to uninstall")
|
|
86
|
+
p_uninstall.set_defaults(func=cmd_uninstall)
|
|
87
|
+
|
|
88
|
+
p_show = sub.add_parser(
|
|
89
|
+
"show", help="Show installed packages", parents=[base_parser]
|
|
90
|
+
)
|
|
91
|
+
p_show.set_defaults(func=cmd_show)
|
|
92
|
+
|
|
93
|
+
p_login = sub.add_parser(
|
|
94
|
+
"login",
|
|
95
|
+
help="Securely store GitHub credentials for plugin installation",
|
|
96
|
+
parents=[base_parser],
|
|
97
|
+
)
|
|
98
|
+
p_login.set_defaults(func=cmd_login)
|
|
99
|
+
|
|
100
|
+
p_logout = sub.add_parser(
|
|
101
|
+
"logout",
|
|
102
|
+
help="Log out from GitHub and remove stored credentials",
|
|
103
|
+
parents=[base_parser],
|
|
104
|
+
)
|
|
105
|
+
p_logout.set_defaults(func=cmd_logout)
|
|
106
|
+
|
|
107
|
+
p_doctor = sub.add_parser(
|
|
108
|
+
"doctor", help="Check system dependencies", parents=[base_parser]
|
|
109
|
+
)
|
|
110
|
+
p_doctor.set_defaults(func=cmd_doctor)
|
|
111
|
+
|
|
112
|
+
p_scan = sub.add_parser(
|
|
113
|
+
"scan", help="Analyze dependency graph with ML Oracle", parents=[base_parser]
|
|
114
|
+
)
|
|
115
|
+
p_scan.add_argument("target", nargs="?", help="Target directory (default: current)")
|
|
116
|
+
p_scan.add_argument("--json", action="store_true", help="Dump graph to JSON")
|
|
117
|
+
p_scan.add_argument(
|
|
118
|
+
"--html", action="store_true", help="Generate interactive HTML graph"
|
|
119
|
+
)
|
|
120
|
+
p_scan.add_argument(
|
|
121
|
+
"--verbose", action="store_true", help="Show raw uncertainty zones"
|
|
122
|
+
)
|
|
123
|
+
p_scan.set_defaults(func=cmd_scan)
|
|
124
|
+
|
|
125
|
+
p_frontend = sub.add_parser(
|
|
126
|
+
"frontend",
|
|
127
|
+
help="Frontend commands proxy (runs '<provider> <args>' in the frontend folder)",
|
|
128
|
+
parents=[base_parser],
|
|
129
|
+
)
|
|
130
|
+
p_frontend.add_argument(
|
|
131
|
+
"--provider",
|
|
132
|
+
choices=["npm", "yarn", "pnpm", "bun"],
|
|
133
|
+
default="npm",
|
|
134
|
+
help="JS Package Manager to use (default: npm)",
|
|
135
|
+
)
|
|
136
|
+
p_frontend.add_argument(
|
|
137
|
+
"npm_args",
|
|
138
|
+
nargs=argparse.REMAINDER,
|
|
139
|
+
help="Arguments to pass to the provider (e.g., install, run dev, test)",
|
|
140
|
+
)
|
|
141
|
+
p_frontend.set_defaults(func=cmd_frontend)
|
|
142
|
+
|
|
143
|
+
p_run = sub.add_parser(
|
|
144
|
+
"run", help="Run a Python entrypoint script", parents=[base_parser]
|
|
145
|
+
)
|
|
146
|
+
p_run.add_argument(
|
|
147
|
+
"script", nargs="?", help="Path to Python script to run (default: app.py)"
|
|
148
|
+
)
|
|
149
|
+
p_run.add_argument(
|
|
150
|
+
"--dev",
|
|
151
|
+
action="store_true",
|
|
152
|
+
help="Enable dev mode (hot reload + frontend watch)",
|
|
153
|
+
)
|
|
154
|
+
p_run.add_argument(
|
|
155
|
+
"--no-build",
|
|
156
|
+
action="store_true",
|
|
157
|
+
help="Skip automatic frontend build before running",
|
|
158
|
+
)
|
|
159
|
+
p_run.add_argument("--engine", help="Browser engine to use (native)")
|
|
160
|
+
p_run.add_argument(
|
|
161
|
+
"--chrome", action="store_true", help="Shortcut for --engine chrome"
|
|
162
|
+
)
|
|
163
|
+
p_run.add_argument(
|
|
164
|
+
"extra_args",
|
|
165
|
+
nargs=argparse.REMAINDER,
|
|
166
|
+
help="Extra args to forward to script",
|
|
167
|
+
default=[],
|
|
168
|
+
)
|
|
169
|
+
p_run.set_defaults(func=cmd_run)
|
|
170
|
+
|
|
171
|
+
p_pkg = sub.add_parser(
|
|
172
|
+
"package", help="Package app using PyInstaller", parents=[base_parser]
|
|
173
|
+
)
|
|
174
|
+
p_pkg.add_argument(
|
|
175
|
+
"script", nargs="?", help="Python entrypoint to package (default: app.py)"
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
# General Options
|
|
179
|
+
grp_general = p_pkg.add_argument_group("General Options")
|
|
180
|
+
grp_general.add_argument("--name", help="Output executable name")
|
|
181
|
+
grp_general.add_argument("--icon", help="Path to app icon (.ico)")
|
|
182
|
+
grp_general.add_argument(
|
|
183
|
+
"--console", action="store_true", help="Show console window (debug mode)"
|
|
184
|
+
)
|
|
185
|
+
grp_general.add_argument(
|
|
186
|
+
"--add-data", nargs="*", help="Additional data to include (format: src;dest)"
|
|
187
|
+
)
|
|
188
|
+
grp_general.add_argument(
|
|
189
|
+
"--installer", action="store_true", help="Build NSIS installer after packaging"
|
|
190
|
+
)
|
|
191
|
+
grp_general.add_argument(
|
|
192
|
+
"--smart-assets",
|
|
193
|
+
action="store_true",
|
|
194
|
+
help="Enable auto-inclusion of smart assets (non-code files).",
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# Engine Options
|
|
198
|
+
grp_engine = p_pkg.add_argument_group("Engine Options")
|
|
199
|
+
grp_engine.add_argument("--engine", help="Browser engine to use (native)")
|
|
200
|
+
grp_engine.add_argument(
|
|
201
|
+
"--chrome", action="store_true", help="Shortcut for --engine chrome"
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
# Build Strategy
|
|
205
|
+
grp_build = p_pkg.add_argument_group("Build Strategy")
|
|
206
|
+
grp_build.add_argument(
|
|
207
|
+
"--one-file",
|
|
208
|
+
action="store_true",
|
|
209
|
+
help="Package into a single executable file (default for Nuitka)",
|
|
210
|
+
)
|
|
211
|
+
grp_build.add_argument(
|
|
212
|
+
"--one-dir",
|
|
213
|
+
action="store_true",
|
|
214
|
+
help="Package into a directory (default for PyInstaller, faster build)",
|
|
215
|
+
)
|
|
216
|
+
grp_build.add_argument(
|
|
217
|
+
"--nuitka",
|
|
218
|
+
action="store_true",
|
|
219
|
+
help="Use Nuitka compiler instead of PyInstaller (Advanced, secure)",
|
|
220
|
+
)
|
|
221
|
+
grp_build.add_argument(
|
|
222
|
+
"--bundled",
|
|
223
|
+
action="store_true",
|
|
224
|
+
help="Enable grouping of library modules into app.bundle (Cleaner dist)",
|
|
225
|
+
)
|
|
226
|
+
grp_build.add_argument(
|
|
227
|
+
"--no-shake",
|
|
228
|
+
action="store_true",
|
|
229
|
+
help="Disable post-build optimization (Tree Shaking).",
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
# Hook Generation
|
|
233
|
+
grp_hooks = p_pkg.add_argument_group("Hook Generation")
|
|
234
|
+
grp_hooks.add_argument(
|
|
235
|
+
"--collect-all",
|
|
236
|
+
action="store_true",
|
|
237
|
+
help='Generate full "collect_all" hooks (larger builds).',
|
|
238
|
+
)
|
|
239
|
+
grp_hooks.add_argument(
|
|
240
|
+
"--force-hooks",
|
|
241
|
+
action="store_true",
|
|
242
|
+
help="Force generation of hooks using collect_submodules.",
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
# Security (Fortress/Rust)
|
|
246
|
+
grp_sec = p_pkg.add_argument_group("Security & Hardening")
|
|
247
|
+
grp_sec.add_argument(
|
|
248
|
+
"--secure",
|
|
249
|
+
action="store_true",
|
|
250
|
+
help="Enable Rust Bootloader (Protects source logic)",
|
|
251
|
+
)
|
|
252
|
+
grp_sec.add_argument(
|
|
253
|
+
"--fortress",
|
|
254
|
+
action="store_true",
|
|
255
|
+
help="Enable Fortress Architecture (Hardened Core + Static Shield)",
|
|
256
|
+
)
|
|
257
|
+
grp_sec.add_argument(
|
|
258
|
+
"--no-cython",
|
|
259
|
+
action="store_true",
|
|
260
|
+
help="Disable Cythonization during Fortress build.",
|
|
261
|
+
)
|
|
262
|
+
grp_sec.add_argument(
|
|
263
|
+
"--patch-from",
|
|
264
|
+
help="Generate a binary patch against a previous app.pytron payload",
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
p_pkg.set_defaults(func=cmd_package)
|
|
268
|
+
|
|
269
|
+
p_build = sub.add_parser(
|
|
270
|
+
"build-frontend",
|
|
271
|
+
help="Run frontend build in a frontend folder",
|
|
272
|
+
parents=[base_parser],
|
|
273
|
+
)
|
|
274
|
+
p_build.add_argument("folder", help="Frontend folder (contains package.json)")
|
|
275
|
+
p_build.set_defaults(func=cmd_build_frontend)
|
|
276
|
+
|
|
277
|
+
p_info = sub.add_parser("info", help="Show environment info", parents=[base_parser])
|
|
278
|
+
p_info.set_defaults(func=cmd_info)
|
|
279
|
+
|
|
280
|
+
# Plugin Management
|
|
281
|
+
p_plugin = sub.add_parser(
|
|
282
|
+
"plugin", help="Manage application plugins", parents=[base_parser]
|
|
283
|
+
)
|
|
284
|
+
plugin_sub = p_plugin.add_subparsers(dest="plugin_command")
|
|
285
|
+
|
|
286
|
+
# Plugin Install
|
|
287
|
+
p_plugin_inst = plugin_sub.add_parser(
|
|
288
|
+
"install", help="Install a plugin from GitHub"
|
|
289
|
+
)
|
|
290
|
+
p_plugin_inst.add_argument(
|
|
291
|
+
"identifier", help="username.repo.version (e.g. ghua8088.pytron-weather-plugin)"
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
# Plugin List
|
|
295
|
+
plugin_sub.add_parser("list", help="List installed plugins")
|
|
296
|
+
|
|
297
|
+
# Plugin Create
|
|
298
|
+
p_plugin_create = plugin_sub.add_parser("create", help="Scaffold a new plugin")
|
|
299
|
+
p_plugin_create.add_argument("name", help="Name of the plugin directory")
|
|
300
|
+
|
|
301
|
+
# Plugin Uninstall
|
|
302
|
+
p_plugin_uninst = plugin_sub.add_parser("uninstall", help="Remove a plugin")
|
|
303
|
+
p_plugin_uninst.add_argument("name", help="Directory name of the plugin to remove")
|
|
304
|
+
|
|
305
|
+
p_plugin.set_defaults(func=cmd_plugin)
|
|
306
|
+
|
|
307
|
+
p_android = sub.add_parser(
|
|
308
|
+
"android", help="Android build tools", parents=[base_parser]
|
|
309
|
+
)
|
|
310
|
+
p_android.add_argument(
|
|
311
|
+
"action",
|
|
312
|
+
choices=["init", "sync", "build", "run", "logcat", "reset"],
|
|
313
|
+
help="Action to perform",
|
|
314
|
+
)
|
|
315
|
+
p_android.add_argument(
|
|
316
|
+
"--force", action="store_true", help="Force overwrite during init"
|
|
317
|
+
)
|
|
318
|
+
p_android.add_argument(
|
|
319
|
+
"--native",
|
|
320
|
+
action="store_true",
|
|
321
|
+
help="Enable native extension cross-compilation (defaults to False)",
|
|
322
|
+
)
|
|
323
|
+
p_android.add_argument(
|
|
324
|
+
"--aab",
|
|
325
|
+
action="store_true",
|
|
326
|
+
help="Build Android App Bundle (.aab) for Google Play Store",
|
|
327
|
+
)
|
|
328
|
+
p_android.set_defaults(func=cmd_android)
|
|
329
|
+
|
|
330
|
+
p_workflow = sub.add_parser(
|
|
331
|
+
"workflow", help="CI/CD Workflow management", parents=[base_parser]
|
|
332
|
+
)
|
|
333
|
+
p_workflow.set_defaults(func=cmd_workflow)
|
|
334
|
+
|
|
335
|
+
# Engine Management
|
|
336
|
+
p_eng = sub.add_parser(
|
|
337
|
+
"engine",
|
|
338
|
+
help="Manage browser engines (Mojo Chrome, etc.)",
|
|
339
|
+
parents=[base_parser],
|
|
340
|
+
)
|
|
341
|
+
eng_sub = p_eng.add_subparsers(dest="engine_command")
|
|
342
|
+
|
|
343
|
+
pe_inst = eng_sub.add_parser("install", help="Install/Forge a browser engine")
|
|
344
|
+
pe_inst.add_argument("name", choices=["chrome"], help="Name of the engine")
|
|
345
|
+
|
|
346
|
+
p_eng.set_defaults(func=cmd_engine)
|
|
347
|
+
|
|
348
|
+
return parser
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
from .exceptions import PytronError
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def main(argv: list[str] | None = None) -> int:
|
|
355
|
+
parser = build_parser()
|
|
356
|
+
args = parser.parse_args(argv)
|
|
357
|
+
|
|
358
|
+
# Initialize logger if requested
|
|
359
|
+
if getattr(args, "logger", None):
|
|
360
|
+
from .console import set_log_file
|
|
361
|
+
|
|
362
|
+
set_log_file(args.logger)
|
|
363
|
+
|
|
364
|
+
if not hasattr(args, "func"):
|
|
365
|
+
parser.print_help()
|
|
366
|
+
return 0
|
|
367
|
+
try:
|
|
368
|
+
return args.func(args)
|
|
369
|
+
except KeyboardInterrupt:
|
|
370
|
+
print("\nCancelled")
|
|
371
|
+
return 1
|
|
372
|
+
except PytronError as e:
|
|
373
|
+
log(str(e), style="error")
|
|
374
|
+
return 1
|
|
375
|
+
except Exception as e:
|
|
376
|
+
import traceback
|
|
377
|
+
|
|
378
|
+
traceback.print_exc()
|
|
379
|
+
log(f"Unexpected error: {e}", style="error")
|
|
380
|
+
return 1
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
if __name__ == "__main__":
|
|
384
|
+
raise SystemExit(main())
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
from ..platforms.android.ops.init import init_android_project, reset_android_project
|
|
4
|
+
from ..platforms.android.ops.sync import sync_android_project
|
|
5
|
+
from ..platforms.android.ops.build import build_android_project
|
|
6
|
+
from ..platforms.android.ops.run import run_android_project, run_logcat
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def cmd_android(args: argparse.Namespace) -> None:
|
|
10
|
+
action = args.action
|
|
11
|
+
project_root = os.getcwd()
|
|
12
|
+
|
|
13
|
+
if action == "init":
|
|
14
|
+
# args.force might not be present if not defined in parser, but usually it is for init
|
|
15
|
+
force = getattr(args, "force", False)
|
|
16
|
+
init_android_project(project_root, force=force)
|
|
17
|
+
elif action == "reset":
|
|
18
|
+
reset_android_project(project_root)
|
|
19
|
+
elif action == "sync":
|
|
20
|
+
native = getattr(args, "native", False)
|
|
21
|
+
sync_android_project(project_root, native=native)
|
|
22
|
+
elif action == "build":
|
|
23
|
+
is_aab = getattr(args, "aab", False)
|
|
24
|
+
build_android_project(project_root, is_aab=is_aab)
|
|
25
|
+
elif action == "run":
|
|
26
|
+
run_android_project(project_root)
|
|
27
|
+
elif action == "logcat":
|
|
28
|
+
run_logcat()
|