From b9d3482905a4fb6a178b06bab936844b77154a63 Mon Sep 17 00:00:00 2001 From: HONOR Date: Sun, 20 Sep 2026 10:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2:=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=AE=BE=E7=BD=AE=E5=B8=83=E5=B1=80=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=93=E5=BC=80=E7=9B=AE=E5=BD=95=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/gui.py | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/src/ui/gui.py b/src/ui/gui.py index 6405090..cf6a5a5 100644 --- a/src/ui/gui.py +++ b/src/ui/gui.py @@ -143,14 +143,18 @@ class BatchTableExtractorApp: self.lbl_src = ttk.Label(path_box, text="来源目录:") self.lbl_src.grid(row=0, column=0, sticky=tk.W, pady=5) - ttk.Entry(path_box, textvariable=self.src_path_var, width=46).grid(row=0, column=1, sticky=tk.EW, padx=6) - self.btn_browse_src = ProgressButton(path_box, text="选择...", command=self._browse_src, height=22, width=65) - self.btn_browse_src.grid(row=0, column=2, sticky=tk.EW) + ttk.Entry(path_box, textvariable=self.src_path_var).grid(row=0, column=1, sticky=tk.EW, padx=6) + self.btn_browse_src = ProgressButton(path_box, text="选择...", command=self._browse_src, height=22, width=50) + self.btn_browse_src.grid(row=0, column=2, sticky=tk.EW, padx=(0, 4)) + self.btn_open_src = ProgressButton(path_box, text="打开", command=self._open_src_dir, height=22, width=40) + self.btn_open_src.grid(row=0, column=3, sticky=tk.EW) ttk.Label(path_box, text="转换目录:").grid(row=1, column=0, sticky=tk.W, pady=5) - ttk.Entry(path_box, textvariable=self.out_dir_var, width=46, state="readonly").grid(row=1, column=1, sticky=tk.EW, padx=6) - self.btn_browse_out = ProgressButton(path_box, text="选择...", command=self._browse_out, height=22, width=65) - self.btn_browse_out.grid(row=1, column=2, sticky=tk.EW) + ttk.Entry(path_box, textvariable=self.out_dir_var, state="readonly").grid(row=1, column=1, sticky=tk.EW, padx=6) + self.btn_browse_out = ProgressButton(path_box, text="选择...", command=self._browse_out, height=22, width=50) + self.btn_browse_out.grid(row=1, column=2, sticky=tk.EW, padx=(0, 4)) + self.btn_open_out = ProgressButton(path_box, text="打开", command=self._open_out_dir, height=22, width=40) + self.btn_open_out.grid(row=1, column=3, sticky=tk.EW) ttk.Label(path_box, text="文件冲突:").grid(row=2, column=0, sticky=tk.W, pady=5) @@ -170,8 +174,8 @@ class BatchTableExtractorApp: cb_pdf.pack(side=tk.LEFT, fill=tk.X, expand=True) cb_pdf.bind("<>", _clear_combo_focus) - self.btn_view_log = ProgressButton(path_box, text="日志", command=self._show_log_window, height=22, width=65) - self.btn_view_log.grid(row=2, column=2, sticky=tk.EW) + self.btn_view_log = ProgressButton(path_box, text="日志", command=self._show_log_window, height=22) + self.btn_view_log.grid(row=2, column=2, columnspan=2, sticky=tk.EW) path_box.columnconfigure(1, weight=1) @@ -240,6 +244,34 @@ class BatchTableExtractorApp: if path: self.out_dir_var.set(os.path.normpath(path)) + def _open_src_dir(self): + path = self.src_path_var.get().strip() + if not path: + messagebox.showinfo("提示", "来源目录为空") + return + if os.path.isfile(path): + path = os.path.dirname(path) + if os.path.exists(path): + try: + os.startfile(path) + except Exception as e: + messagebox.showerror("错误", f"无法打开目录: {e}") + else: + messagebox.showinfo("提示", "该来源路径不存在") + + def _open_out_dir(self): + path = self.out_dir_var.get().strip() + if not path: + messagebox.showinfo("提示", "转换目录为空") + return + if os.path.exists(path): + try: + os.startfile(path) + except Exception as e: + messagebox.showerror("错误", f"无法打开目录: {e}") + else: + messagebox.showinfo("提示", "转换目录目前还不存在,请先提取生成文件") + def _on_drop_files(self, files): if not files: return