refactor: 根据 Python 标准规范重构项目目录树,拆分 core, ui, utils 三层架构

This commit is contained in:
HONOR
2026-09-16 11:18:02 +08:00
parent 15f7b0ea2b
commit 02ec382d88
9 changed files with 9 additions and 9 deletions
View File
+2 -2
View File
@@ -1,7 +1,7 @@
import tkinter as tk
# 确保最先导入 config 以完成环境配置(尤其是 pywin32 的 dll 问题)
import config
from gui import BatchTableExtractorApp
import utils.config
from ui.gui import BatchTableExtractorApp
if __name__ == "__main__":
app_root = tk.Tk()
View File
+5 -5
View File
@@ -8,10 +8,10 @@ import pythoncom
import windnd
import datetime
from config import CONFIG_FILE, APP_DIR
from extractor import detect_and_create_apps, export_single_doc_tables
from widgets import ProgressButton
from history_window import record_log
from utils.config import CONFIG_FILE, APP_DIR
from core.extractor import detect_and_create_apps, export_single_doc_tables
from ui.widgets import ProgressButton
from ui.history_window import record_log
class BatchTableExtractorApp:
def __init__(self, root):
@@ -232,7 +232,7 @@ class BatchTableExtractorApp:
self.root.after(100, self._start)
def _show_log_window(self):
from history_window import show_history_log_window
from ui.history_window import show_history_log_window
show_history_log_window(self.root, self.topmost_var.get())
def log(self, msg, tag=None):
@@ -3,7 +3,7 @@ import csv
import datetime
import tkinter as tk
from tkinter import ttk, messagebox
from config import APP_DIR
from utils.config import APP_DIR
def record_log(batch_id, status, doc_name, excel_name, table_count, duration, src_path, message):
log_path = os.path.join(APP_DIR, "conversion.csv")
View File
+1 -1
View File
@@ -15,6 +15,6 @@ if getattr(sys, 'frozen', False):
APP_DIR = os.path.dirname(sys.executable)
else:
# 源码开发调试:定位到 src 的上一层(项目根目录)
APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
APP_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
CONFIG_FILE = os.path.join(APP_DIR, "config.json")