界面: 调整路径设置布局,添加打开目录按钮
This commit is contained in:
+40
-8
@@ -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("<<ComboboxSelected>>", _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
|
||||
|
||||
Reference in New Issue
Block a user