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.
- 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.so +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 +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,518 @@
|
|
|
1
|
+
import ctypes
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
from .constants import *
|
|
5
|
+
from .utils import get_hwnd
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
import winreg
|
|
9
|
+
except ImportError:
|
|
10
|
+
winreg = None
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
import ctypes.wintypes
|
|
14
|
+
except ImportError:
|
|
15
|
+
# Safe fallback for non-Windows imports
|
|
16
|
+
class MockWintypes:
|
|
17
|
+
HWND = ctypes.c_void_p
|
|
18
|
+
BOOL = ctypes.c_int
|
|
19
|
+
WPARAM = ctypes.c_void_p
|
|
20
|
+
LPARAM = ctypes.c_void_p
|
|
21
|
+
RECT = ctypes.c_void_p
|
|
22
|
+
|
|
23
|
+
ctypes.wintypes = MockWintypes
|
|
24
|
+
|
|
25
|
+
# -------------------------------------------------------------------
|
|
26
|
+
# Hardened Library Wrappers
|
|
27
|
+
# -------------------------------------------------------------------
|
|
28
|
+
try:
|
|
29
|
+
user32 = ctypes.windll.user32
|
|
30
|
+
shell32 = ctypes.windll.shell32
|
|
31
|
+
kernel32 = ctypes.windll.kernel32
|
|
32
|
+
comdlg32 = ctypes.windll.comdlg32
|
|
33
|
+
except AttributeError:
|
|
34
|
+
# Non-Windows Platform
|
|
35
|
+
user32 = None
|
|
36
|
+
shell32 = None
|
|
37
|
+
kernel32 = None
|
|
38
|
+
comdlg32 = None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if user32 and shell32 and kernel32 and comdlg32:
|
|
42
|
+
# --- USER32 ---
|
|
43
|
+
user32.LoadImageW.argtypes = [
|
|
44
|
+
ctypes.c_void_p,
|
|
45
|
+
ctypes.c_wchar_p,
|
|
46
|
+
ctypes.c_uint,
|
|
47
|
+
ctypes.c_int,
|
|
48
|
+
ctypes.c_int,
|
|
49
|
+
ctypes.c_uint,
|
|
50
|
+
]
|
|
51
|
+
user32.LoadImageW.restype = ctypes.c_void_p # HANDLE
|
|
52
|
+
|
|
53
|
+
user32.LoadIconW.argtypes = [ctypes.c_void_p, ctypes.c_void_p] # Used with ID
|
|
54
|
+
user32.LoadIconW.restype = ctypes.c_void_p
|
|
55
|
+
|
|
56
|
+
user32.MessageBoxW.argtypes = [
|
|
57
|
+
ctypes.c_void_p,
|
|
58
|
+
ctypes.c_wchar_p,
|
|
59
|
+
ctypes.c_wchar_p,
|
|
60
|
+
ctypes.c_uint,
|
|
61
|
+
]
|
|
62
|
+
user32.MessageBoxW.restype = ctypes.c_int
|
|
63
|
+
|
|
64
|
+
user32.SendMessageW.argtypes = [
|
|
65
|
+
ctypes.c_void_p,
|
|
66
|
+
ctypes.c_uint,
|
|
67
|
+
ctypes.wintypes.WPARAM,
|
|
68
|
+
ctypes.wintypes.LPARAM,
|
|
69
|
+
]
|
|
70
|
+
user32.SendMessageW.restype = ctypes.c_longlong # LRESULT can be 64-bit
|
|
71
|
+
|
|
72
|
+
user32.OpenClipboard.argtypes = [ctypes.c_void_p]
|
|
73
|
+
user32.OpenClipboard.restype = ctypes.wintypes.BOOL
|
|
74
|
+
|
|
75
|
+
user32.EmptyClipboard.argtypes = []
|
|
76
|
+
user32.EmptyClipboard.restype = ctypes.wintypes.BOOL
|
|
77
|
+
|
|
78
|
+
user32.SetClipboardData.argtypes = [ctypes.c_uint, ctypes.c_void_p]
|
|
79
|
+
user32.SetClipboardData.restype = ctypes.c_void_p
|
|
80
|
+
|
|
81
|
+
user32.CloseClipboard.argtypes = []
|
|
82
|
+
user32.CloseClipboard.restype = ctypes.wintypes.BOOL
|
|
83
|
+
|
|
84
|
+
user32.GetClipboardData.argtypes = [ctypes.c_uint]
|
|
85
|
+
user32.GetClipboardData.restype = ctypes.c_void_p
|
|
86
|
+
|
|
87
|
+
# --- SHELL32 ---
|
|
88
|
+
shell32.Shell_NotifyIconW.argtypes = [
|
|
89
|
+
ctypes.c_ulong,
|
|
90
|
+
ctypes.POINTER(NOTIFYICONDATAW),
|
|
91
|
+
]
|
|
92
|
+
shell32.Shell_NotifyIconW.restype = ctypes.wintypes.BOOL
|
|
93
|
+
|
|
94
|
+
shell32.SetCurrentProcessExplicitAppUserModelID.argtypes = [ctypes.c_wchar_p]
|
|
95
|
+
shell32.SetCurrentProcessExplicitAppUserModelID.restype = ctypes.c_long # HRESULT
|
|
96
|
+
|
|
97
|
+
shell32.SHBrowseForFolderW.argtypes = [ctypes.POINTER(BROWSEINFOW)]
|
|
98
|
+
shell32.SHBrowseForFolderW.restype = ctypes.c_void_p # PIDLIST_ABSOLUTE
|
|
99
|
+
|
|
100
|
+
shell32.SHGetPathFromIDListW.argtypes = [ctypes.c_void_p, ctypes.c_wchar_p]
|
|
101
|
+
shell32.SHGetPathFromIDListW.restype = ctypes.wintypes.BOOL
|
|
102
|
+
|
|
103
|
+
shell32.ILFree.argtypes = [ctypes.c_void_p]
|
|
104
|
+
shell32.ILFree.restype = None
|
|
105
|
+
|
|
106
|
+
# --- KERNEL32 ---
|
|
107
|
+
kernel32.GlobalAlloc.argtypes = [ctypes.c_uint, ctypes.c_size_t]
|
|
108
|
+
kernel32.GlobalAlloc.restype = ctypes.c_void_p
|
|
109
|
+
|
|
110
|
+
kernel32.GlobalLock.argtypes = [ctypes.c_void_p]
|
|
111
|
+
kernel32.GlobalLock.restype = ctypes.c_void_p
|
|
112
|
+
|
|
113
|
+
kernel32.GlobalUnlock.argtypes = [ctypes.c_void_p]
|
|
114
|
+
kernel32.GlobalUnlock.restype = ctypes.wintypes.BOOL
|
|
115
|
+
|
|
116
|
+
# --- COMDLG32 ---
|
|
117
|
+
comdlg32.GetOpenFileNameW.argtypes = [ctypes.POINTER(OPENFILENAMEW)]
|
|
118
|
+
comdlg32.GetOpenFileNameW.restype = ctypes.wintypes.BOOL
|
|
119
|
+
|
|
120
|
+
comdlg32.GetSaveFileNameW.argtypes = [ctypes.POINTER(OPENFILENAMEW)]
|
|
121
|
+
comdlg32.GetSaveFileNameW.restype = ctypes.wintypes.BOOL
|
|
122
|
+
|
|
123
|
+
# -------------------------------------------------------------------
|
|
124
|
+
# Operations
|
|
125
|
+
# -------------------------------------------------------------------
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def notification(w, title, message, icon=None):
|
|
129
|
+
try:
|
|
130
|
+
hwnd = get_hwnd(w)
|
|
131
|
+
# Even if hwnd is None (e.g. hidden mode), we might need a dummy HWND for the tray api.
|
|
132
|
+
# However, linking it to the main webview HWND is standard.
|
|
133
|
+
if not hwnd:
|
|
134
|
+
print(f"[Pytron] Notification skipped: No valid HWND for window {w}")
|
|
135
|
+
return
|
|
136
|
+
|
|
137
|
+
nid = NOTIFYICONDATAW()
|
|
138
|
+
nid.cbSize = ctypes.sizeof(NOTIFYICONDATAW)
|
|
139
|
+
nid.hWnd = hwnd
|
|
140
|
+
nid.uID = 2000 # Unique ID for "Toast" source
|
|
141
|
+
|
|
142
|
+
# 1. Ensure Icon is Valid
|
|
143
|
+
h_icon = 0
|
|
144
|
+
if icon and os.path.exists(icon):
|
|
145
|
+
h_icon = user32.LoadImageW(None, str(icon), 1, 16, 16, 0x00000010)
|
|
146
|
+
if not h_icon:
|
|
147
|
+
h_icon = user32.LoadIconW(None, ctypes.c_void_p(32512)) # IDI_APPLICATION
|
|
148
|
+
|
|
149
|
+
nid.hIcon = h_icon
|
|
150
|
+
|
|
151
|
+
# 2. Strict ctypes definition (Local Override similar to tray.py)
|
|
152
|
+
shell32.Shell_NotifyIconW.argtypes = [
|
|
153
|
+
ctypes.c_ulong,
|
|
154
|
+
ctypes.POINTER(NOTIFYICONDATAW),
|
|
155
|
+
]
|
|
156
|
+
shell32.Shell_NotifyIconW.restype = ctypes.wintypes.BOOL
|
|
157
|
+
|
|
158
|
+
# 3. ADD the Icon first (if not exists)
|
|
159
|
+
# We need NIF_ICON so it exists. We assume it might already exist.
|
|
160
|
+
nid.uFlags = NIF_ICON | NIF_TIP
|
|
161
|
+
nid.szTip = title[:127] if title else "Notification"
|
|
162
|
+
|
|
163
|
+
# Try ADD. If it fails, it might already exist, so we treat it as success-ish
|
|
164
|
+
shell32.Shell_NotifyIconW(NIM_ADD, ctypes.byref(nid))
|
|
165
|
+
|
|
166
|
+
# 4. Set Version to 4 (Vista+) to enable modern "Balloon/Toast" behavior
|
|
167
|
+
nid.uVersion = NOTIFYICON_VERSION_4
|
|
168
|
+
shell32.Shell_NotifyIconW(NIM_SETVERSION, ctypes.byref(nid))
|
|
169
|
+
|
|
170
|
+
# 5. Show The Toast (MODIFY)
|
|
171
|
+
nid.uFlags = NIF_INFO | NIF_ICON | NIF_TIP
|
|
172
|
+
nid.szInfo = message[:255]
|
|
173
|
+
nid.szInfoTitle = title[:63]
|
|
174
|
+
nid.dwInfoFlags = NIIF_INFO # | NIIF_LARGE_ICON if we had a large icon
|
|
175
|
+
|
|
176
|
+
success = shell32.Shell_NotifyIconW(NIM_MODIFY, ctypes.byref(nid))
|
|
177
|
+
|
|
178
|
+
if not success:
|
|
179
|
+
err = ctypes.get_last_error()
|
|
180
|
+
print(f"[Pytron] Notification Failed. Error Code: {err}")
|
|
181
|
+
|
|
182
|
+
except Exception as e:
|
|
183
|
+
print(f"[Pytron] Notification Exception: {e}")
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def message_box(w, title, message, style=0):
|
|
187
|
+
hwnd = get_hwnd(w)
|
|
188
|
+
return user32.MessageBoxW(hwnd, message, title, style)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def set_window_icon(w, icon_path):
|
|
192
|
+
if not icon_path or not os.path.exists(icon_path):
|
|
193
|
+
return
|
|
194
|
+
hwnd = get_hwnd(w)
|
|
195
|
+
try:
|
|
196
|
+
# LR_LOADFROMFILE | LR_DEFAULTSIZE
|
|
197
|
+
flags = 0x00000010 | 0x00000040
|
|
198
|
+
|
|
199
|
+
h_small = user32.LoadImageW(None, str(icon_path), 1, 16, 16, flags)
|
|
200
|
+
if h_small:
|
|
201
|
+
user32.SendMessageW(hwnd, 0x0080, 0, h_small) # WM_SETICON, ICON_SMALL
|
|
202
|
+
|
|
203
|
+
h_big = user32.LoadImageW(None, str(icon_path), 1, 32, 32, flags)
|
|
204
|
+
if h_big:
|
|
205
|
+
user32.SendMessageW(hwnd, 0x0080, 1, h_big) # WM_SETICON, ICON_BIG
|
|
206
|
+
except Exception as e:
|
|
207
|
+
print(f"Icon error: {e}")
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _prepare_ofn(w, title, default_path, file_types, file_buffer_size=1024):
|
|
211
|
+
ofn = OPENFILENAMEW()
|
|
212
|
+
ofn.lStructSize = ctypes.sizeof(OPENFILENAMEW)
|
|
213
|
+
ofn.hwndOwner = get_hwnd(w)
|
|
214
|
+
|
|
215
|
+
buff = ctypes.create_unicode_buffer(file_buffer_size)
|
|
216
|
+
ofn.lpstrFile = ctypes.addressof(buff)
|
|
217
|
+
ofn.nMaxFile = file_buffer_size
|
|
218
|
+
|
|
219
|
+
if title:
|
|
220
|
+
ofn.lpstrTitle = title
|
|
221
|
+
|
|
222
|
+
if default_path:
|
|
223
|
+
if os.path.isfile(default_path):
|
|
224
|
+
d = os.path.dirname(default_path)
|
|
225
|
+
n = os.path.basename(default_path)
|
|
226
|
+
ofn.lpstrInitialDir = d
|
|
227
|
+
buff.value = n
|
|
228
|
+
else:
|
|
229
|
+
ofn.lpstrInitialDir = default_path
|
|
230
|
+
|
|
231
|
+
if not file_types:
|
|
232
|
+
file_types = "All Files (*.*)|*.*"
|
|
233
|
+
|
|
234
|
+
if isinstance(file_types, (list, tuple)):
|
|
235
|
+
# Convert list of tuples [("Name", "*.ext"), ...] to "Name|*.ext|..."
|
|
236
|
+
# Or if it's a list of strings ["Name|*.ext", ...], just join them.
|
|
237
|
+
ft_parts = []
|
|
238
|
+
for ft in file_types:
|
|
239
|
+
if isinstance(ft, (list, tuple)) and len(ft) >= 2:
|
|
240
|
+
# Ensure the description doesn't contain pipes, though patterns might
|
|
241
|
+
ft_parts.append(f"{ft[0]}|{ft[1]}")
|
|
242
|
+
else:
|
|
243
|
+
ft_parts.append(str(ft))
|
|
244
|
+
file_types = "|".join(ft_parts)
|
|
245
|
+
|
|
246
|
+
filter_str = file_types.replace("|", "\0") + "\0"
|
|
247
|
+
ofn.lpstrFilter = filter_str
|
|
248
|
+
|
|
249
|
+
return ofn, buff
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def open_file_dialog(w, title, default_path=None, file_types=None):
|
|
253
|
+
ofn, buff = _prepare_ofn(w, title, default_path, file_types)
|
|
254
|
+
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR
|
|
255
|
+
|
|
256
|
+
if comdlg32.GetOpenFileNameW(ctypes.byref(ofn)):
|
|
257
|
+
return buff.value
|
|
258
|
+
return None
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def save_file_dialog(w, title, default_path=None, default_name=None, file_types=None):
|
|
262
|
+
path = default_path
|
|
263
|
+
if default_name:
|
|
264
|
+
if path:
|
|
265
|
+
path = os.path.join(path, default_name)
|
|
266
|
+
else:
|
|
267
|
+
path = default_name
|
|
268
|
+
|
|
269
|
+
ofn, buff = _prepare_ofn(w, title, path, file_types)
|
|
270
|
+
ofn.Flags = OFN_EXPLORER | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR
|
|
271
|
+
|
|
272
|
+
if comdlg32.GetSaveFileNameW(ctypes.byref(ofn)):
|
|
273
|
+
return buff.value
|
|
274
|
+
return None
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def open_folder_dialog(w, title, default_path=None):
|
|
278
|
+
bif = BROWSEINFOW()
|
|
279
|
+
bif.hwndOwner = get_hwnd(w)
|
|
280
|
+
bif.lpszTitle = title
|
|
281
|
+
bif.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE
|
|
282
|
+
|
|
283
|
+
pidl = shell32.SHBrowseForFolderW(ctypes.byref(bif))
|
|
284
|
+
if pidl:
|
|
285
|
+
path = ctypes.create_unicode_buffer(260)
|
|
286
|
+
if shell32.SHGetPathFromIDListW(pidl, path):
|
|
287
|
+
shell32.ILFree(pidl)
|
|
288
|
+
return path.value
|
|
289
|
+
shell32.ILFree(pidl)
|
|
290
|
+
return None
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def register_protocol(scheme):
|
|
294
|
+
if not winreg:
|
|
295
|
+
return False
|
|
296
|
+
try:
|
|
297
|
+
exe = sys.executable
|
|
298
|
+
if getattr(sys, "frozen", False):
|
|
299
|
+
command = f'"{exe}" "%1"'
|
|
300
|
+
else:
|
|
301
|
+
main_file = os.path.abspath(sys.modules["__main__"].__file__)
|
|
302
|
+
command = f'"{exe}" "{main_file}" "%1"'
|
|
303
|
+
|
|
304
|
+
key_path = f"Software\\Classes\\{scheme}"
|
|
305
|
+
with winreg.CreateKey(winreg.HKEY_CURRENT_USER, key_path) as key:
|
|
306
|
+
winreg.SetValueEx(key, "", 0, winreg.REG_SZ, f"URL:{scheme} Protocol")
|
|
307
|
+
winreg.SetValueEx(key, "URL Protocol", 0, winreg.REG_SZ, "")
|
|
308
|
+
with winreg.CreateKey(
|
|
309
|
+
winreg.HKEY_CURRENT_USER, f"{key_path}\\shell\\open\\command"
|
|
310
|
+
) as key:
|
|
311
|
+
winreg.SetValueEx(key, "", 0, winreg.REG_SZ, command)
|
|
312
|
+
return True
|
|
313
|
+
except Exception:
|
|
314
|
+
return False
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def set_launch_on_boot(app_name, exe_path, enable=True):
|
|
318
|
+
if not winreg:
|
|
319
|
+
return False
|
|
320
|
+
key_path = r"Software\Microsoft\Windows\CurrentVersion\Run"
|
|
321
|
+
try:
|
|
322
|
+
with winreg.OpenKey(
|
|
323
|
+
winreg.HKEY_CURRENT_USER,
|
|
324
|
+
key_path,
|
|
325
|
+
0,
|
|
326
|
+
winreg.KEY_SET_VALUE | winreg.KEY_QUERY_VALUE,
|
|
327
|
+
) as key:
|
|
328
|
+
if enable:
|
|
329
|
+
winreg.SetValueEx(key, app_name, 0, winreg.REG_SZ, exe_path)
|
|
330
|
+
else:
|
|
331
|
+
try:
|
|
332
|
+
winreg.DeleteValue(key, app_name)
|
|
333
|
+
except FileNotFoundError:
|
|
334
|
+
pass
|
|
335
|
+
return True
|
|
336
|
+
except Exception:
|
|
337
|
+
return False
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def set_app_id(app_id):
|
|
341
|
+
try:
|
|
342
|
+
shell32.SetCurrentProcessExplicitAppUserModelID(app_id)
|
|
343
|
+
except Exception as e:
|
|
344
|
+
print(f"[Pytron] Debug: Failed to set app model ID: {e}")
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
# Taskbar Progress (Using COM - Requires valid ITaskbarList3 definition)
|
|
348
|
+
# For robustness, we catch exceptions but don't strictly type COM interfaces here
|
|
349
|
+
# as that requires a larger struct definition block which is already present but complex.
|
|
350
|
+
_taskbar_list = None
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
def _init_taskbar():
|
|
354
|
+
global _taskbar_list
|
|
355
|
+
if _taskbar_list:
|
|
356
|
+
return _taskbar_list
|
|
357
|
+
try:
|
|
358
|
+
try:
|
|
359
|
+
if hasattr(ctypes, "windll"):
|
|
360
|
+
ctypes.windll.ole32.CoInitialize(0)
|
|
361
|
+
except Exception as e:
|
|
362
|
+
print(f"[Pytron] Debug: Failed to initialize COM: {e}")
|
|
363
|
+
return None
|
|
364
|
+
|
|
365
|
+
CLSID_TaskbarList = "{56FDF344-FD6D-11d0-958A-006097C9A090}"
|
|
366
|
+
import comtypes.client
|
|
367
|
+
from comtypes import GUID, IUnknown, COMMETHOD, HRESULT
|
|
368
|
+
|
|
369
|
+
class ITaskbarList3(IUnknown):
|
|
370
|
+
_iid_ = GUID("{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}")
|
|
371
|
+
_methods_ = [
|
|
372
|
+
COMMETHOD([], HRESULT, "HrInit"),
|
|
373
|
+
COMMETHOD(
|
|
374
|
+
[], HRESULT, "AddTab", (["in"], ctypes.wintypes.HWND, "hwnd")
|
|
375
|
+
),
|
|
376
|
+
COMMETHOD(
|
|
377
|
+
[], HRESULT, "DeleteTab", (["in"], ctypes.wintypes.HWND, "hwnd")
|
|
378
|
+
),
|
|
379
|
+
COMMETHOD(
|
|
380
|
+
[], HRESULT, "ActivateTab", (["in"], ctypes.wintypes.HWND, "hwnd")
|
|
381
|
+
),
|
|
382
|
+
COMMETHOD(
|
|
383
|
+
[], HRESULT, "SetActiveAlt", (["in"], ctypes.wintypes.HWND, "hwnd")
|
|
384
|
+
),
|
|
385
|
+
COMMETHOD(
|
|
386
|
+
[],
|
|
387
|
+
HRESULT,
|
|
388
|
+
"MarkFullscreenWindow",
|
|
389
|
+
(["in"], ctypes.wintypes.HWND, "hwnd"),
|
|
390
|
+
(["in"], ctypes.c_int, "fFullscreen"),
|
|
391
|
+
),
|
|
392
|
+
COMMETHOD(
|
|
393
|
+
[],
|
|
394
|
+
HRESULT,
|
|
395
|
+
"SetProgressValue",
|
|
396
|
+
(["in"], ctypes.wintypes.HWND, "hwnd"),
|
|
397
|
+
(["in"], ctypes.c_ulonglong, "ullCompleted"),
|
|
398
|
+
(["in"], ctypes.c_ulonglong, "ullTotal"),
|
|
399
|
+
),
|
|
400
|
+
COMMETHOD(
|
|
401
|
+
[],
|
|
402
|
+
HRESULT,
|
|
403
|
+
"SetProgressState",
|
|
404
|
+
(["in"], ctypes.wintypes.HWND, "hwnd"),
|
|
405
|
+
(["in"], ctypes.c_int, "tbpFlags"),
|
|
406
|
+
),
|
|
407
|
+
]
|
|
408
|
+
|
|
409
|
+
_taskbar_list = comtypes.client.CreateObject(
|
|
410
|
+
CLSID_TaskbarList, interface=ITaskbarList3
|
|
411
|
+
)
|
|
412
|
+
_taskbar_list.HrInit()
|
|
413
|
+
return _taskbar_list
|
|
414
|
+
except Exception as e:
|
|
415
|
+
print(f"[Pytron] Taskbar Init Failed: {e}")
|
|
416
|
+
return None
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
def set_taskbar_progress(w, state="normal", value=0, max_value=100):
|
|
420
|
+
try:
|
|
421
|
+
tbl = _init_taskbar()
|
|
422
|
+
if not tbl:
|
|
423
|
+
return
|
|
424
|
+
hwnd = get_hwnd(w)
|
|
425
|
+
flags = TBPF_NOPROGRESS
|
|
426
|
+
if state == "indeterminate":
|
|
427
|
+
flags = TBPF_INDETERMINATE
|
|
428
|
+
elif state == "normal":
|
|
429
|
+
flags = TBPF_NORMAL
|
|
430
|
+
elif state == "error":
|
|
431
|
+
flags = TBPF_ERROR
|
|
432
|
+
elif state == "paused":
|
|
433
|
+
flags = TBPF_PAUSED
|
|
434
|
+
tbl.SetProgressState(hwnd, flags)
|
|
435
|
+
if state in ("normal", "error", "paused"):
|
|
436
|
+
tbl.SetProgressValue(hwnd, int(value), int(max_value))
|
|
437
|
+
except Exception as e:
|
|
438
|
+
print(f"[Pytron] Taskbar progress error: {e}")
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
def set_clipboard_text(text: str):
|
|
442
|
+
"""Copies text to the system clipboard."""
|
|
443
|
+
if not user32:
|
|
444
|
+
return False
|
|
445
|
+
try:
|
|
446
|
+
if not user32.OpenClipboard(0):
|
|
447
|
+
return False
|
|
448
|
+
|
|
449
|
+
user32.EmptyClipboard()
|
|
450
|
+
|
|
451
|
+
text_unicode = text
|
|
452
|
+
size = (len(text_unicode) + 1) * 2
|
|
453
|
+
h_mem = kernel32.GlobalAlloc(0x0042, size) # GMEM_MOVEABLE | GMEM_ZEROINIT
|
|
454
|
+
|
|
455
|
+
p_mem = kernel32.GlobalLock(h_mem)
|
|
456
|
+
ctypes.memmove(p_mem, text_unicode, size)
|
|
457
|
+
kernel32.GlobalUnlock(h_mem)
|
|
458
|
+
|
|
459
|
+
user32.SetClipboardData(13, h_mem) # CF_UNICODETEXT
|
|
460
|
+
user32.CloseClipboard()
|
|
461
|
+
return True
|
|
462
|
+
except Exception as e:
|
|
463
|
+
print(f"[Pytron] Clipboard Set Error: {e}")
|
|
464
|
+
return False
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
def get_clipboard_text():
|
|
468
|
+
"""Returns text from the system clipboard."""
|
|
469
|
+
if not user32:
|
|
470
|
+
return None
|
|
471
|
+
try:
|
|
472
|
+
if not user32.OpenClipboard(0):
|
|
473
|
+
return None
|
|
474
|
+
|
|
475
|
+
h_mem = user32.GetClipboardData(13)
|
|
476
|
+
if not h_mem:
|
|
477
|
+
user32.CloseClipboard()
|
|
478
|
+
return None
|
|
479
|
+
|
|
480
|
+
p_mem = kernel32.GlobalLock(h_mem)
|
|
481
|
+
text = ctypes.c_wchar_p(p_mem).value
|
|
482
|
+
kernel32.GlobalUnlock(p_mem)
|
|
483
|
+
|
|
484
|
+
user32.CloseClipboard()
|
|
485
|
+
return text
|
|
486
|
+
except Exception as e:
|
|
487
|
+
print(f"[Pytron] Clipboard Get Error: {e}")
|
|
488
|
+
return None
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
def get_system_info():
|
|
492
|
+
"""Returns platform core information."""
|
|
493
|
+
import platform
|
|
494
|
+
|
|
495
|
+
info = {
|
|
496
|
+
"os": platform.system(),
|
|
497
|
+
"arch": platform.machine(),
|
|
498
|
+
"release": platform.release(),
|
|
499
|
+
"version": platform.version(),
|
|
500
|
+
"cpu_count": os.cpu_count(),
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
try:
|
|
504
|
+
import psutil
|
|
505
|
+
|
|
506
|
+
mem = psutil.virtual_memory()
|
|
507
|
+
info["ram_total"] = mem.total
|
|
508
|
+
info["ram_available"] = mem.available
|
|
509
|
+
info["cpu_usage"] = psutil.cpu_percent(interval=None)
|
|
510
|
+
except ImportError:
|
|
511
|
+
pass
|
|
512
|
+
|
|
513
|
+
return info
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
def enable_drag_drop_safe(w, callback):
|
|
517
|
+
# Legacy Native Hook - Disabled in favor of JS Bridge
|
|
518
|
+
pass
|