Add Windows build script and update README with build instructions

This commit is contained in:
hyyz17200
2026-05-08 12:42:37 +08:00
parent 4ba654ca3f
commit 6ac5331932
5 changed files with 251 additions and 4 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
APP_NAME = "A1 Swap Mod Packer"
__version__ = "0.4.0"
__version__ = "0.5.0"
APP_TITLE = f"{APP_NAME} v{__version__}"
+1 -1
View File
@@ -94,7 +94,7 @@ def create_parser() -> argparse.ArgumentParser:
build.add_argument("--metadata-mode", choices=("source", "sum"), default="source", help="How to write slice_info prediction and weight.")
build.add_argument("--line-ending", choices=("lf", "crlf"), default="crlf", help="Line ending for the generated G-code.")
build.add_argument("--zip-level", type=int, choices=range(1, 10), default=DEFAULT_ZIP_COMPRESS_LEVEL, metavar="1-9", help="zlib-ng Deflate compression level for the output 3MF. Default: 7.")
build.add_argument("--no-preview-label", action="store_true", help="Do not add a plate-count label to the first preview image.")
build.add_argument("--no-preview-label", action="store_true", help="Do not rewrite the preview image label/composite.")
build.add_argument("--no-gcode-patches", action="store_true", help=f"Do not apply editable patches from {default_patch_config_path()}.")
build.set_defaults(func=build_command)
+10
View File
@@ -9,6 +9,16 @@ PATCH_CONFIG_FILE_NAME = "gcode_patches.ini"
def program_root() -> Path:
compiled = globals().get("__compiled__")
if compiled is not None and getattr(compiled, "onefile", False):
containing_dir = getattr(compiled, "containing_dir", None)
if containing_dir:
return Path(containing_dir).resolve()
original_argv0 = getattr(compiled, "original_argv0", None)
if original_argv0:
return Path(original_argv0).resolve().parent
if getattr(sys, "frozen", False):
return Path(sys.executable).resolve().parent
return Path(__file__).resolve().parents[1]