From 9bbd7fc63fa90a6e2a1385577673c71158b99c8a Mon Sep 17 00:00:00 2001 From: MikiVL Date: Tue, 5 May 2026 05:34:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 42 ++++++++++++++++++++++++++++++++++ package.json | 13 +++++++++++ python/generator.py | 1 + python/main.py | 25 ++++++++++++++++++++ python/parser.py | 1 + python/requirements.txt | 3 +++ tests/python/__init__.py | 0 tests/python/test_generator.py | 1 + tests/python/test_parser.py | 1 + 9 files changed, 87 insertions(+) create mode 100644 .gitignore create mode 100644 package.json create mode 100644 python/generator.py create mode 100644 python/main.py create mode 100644 python/parser.py create mode 100644 python/requirements.txt create mode 100644 tests/python/__init__.py create mode 100644 tests/python/test_generator.py create mode 100644 tests/python/test_parser.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7982a1d --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# Python +python/.venv/ +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# Node +node_modules/ +npm-debug.log +yarn-error.log + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# OS +.DS_Store +Thumbs.db + +# Electron +dist/ +out/ diff --git a/package.json b/package.json new file mode 100644 index 0000000..79e3f1b --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "excel-batch-editor", + "version": "0.1.0", + "description": "Electron desktop app for bulk editing Excel files", + "main": "electron/main.js", + "type": "module", + "scripts": { + "dev": "electron .", + "build": "electron-builder" + }, + "dependencies": {}, + "devDependencies": {} +} diff --git a/python/generator.py b/python/generator.py new file mode 100644 index 0000000..fdffa2a --- /dev/null +++ b/python/generator.py @@ -0,0 +1 @@ +# placeholder diff --git a/python/main.py b/python/main.py new file mode 100644 index 0000000..90c8ce7 --- /dev/null +++ b/python/main.py @@ -0,0 +1,25 @@ +import sys +import json + +def main(): + for line in sys.stdin: + line = line.strip() + if not line: + continue + try: + req = json.loads(line) + action = req.get("action") + if action == "parse_template": + from parser import parse_template + result = parse_template(req["file_path"]) + elif action == "generate": + from generator import generate + result = generate(req) + else: + result = {"error": f"unknown action: {action}"} + except Exception as e: + result = {"error": str(e)} + print(json.dumps(result, ensure_ascii=False), flush=True) + +if __name__ == "__main__": + main() diff --git a/python/parser.py b/python/parser.py new file mode 100644 index 0000000..fdffa2a --- /dev/null +++ b/python/parser.py @@ -0,0 +1 @@ +# placeholder diff --git a/python/requirements.txt b/python/requirements.txt new file mode 100644 index 0000000..00cb255 --- /dev/null +++ b/python/requirements.txt @@ -0,0 +1,3 @@ +openpyxl==3.1.2 +Pillow==10.3.0 +pytest==8.2.0 diff --git a/tests/python/__init__.py b/tests/python/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/python/test_generator.py b/tests/python/test_generator.py new file mode 100644 index 0000000..fdffa2a --- /dev/null +++ b/tests/python/test_generator.py @@ -0,0 +1 @@ +# placeholder diff --git a/tests/python/test_parser.py b/tests/python/test_parser.py new file mode 100644 index 0000000..fdffa2a --- /dev/null +++ b/tests/python/test_parser.py @@ -0,0 +1 @@ +# placeholder