|
|
|
@ -14,7 +14,7 @@ import tkinter.font as tkfont |
|
|
|
|
|
|
|
# ----------------------- CONFIG ----------------------- |
|
|
|
# region 配置 |
|
|
|
VERSION = "v1.0.5" |
|
|
|
VERSION = "v1.0.6" |
|
|
|
|
|
|
|
DB_PATH = "tasks.db" # 数据库文件路径 |
|
|
|
TEMPLATES_PATH = "templates.json" # 检索模板文件路径 |
|
|
|
@ -1059,8 +1059,56 @@ class TaskManagerApp(ctk.CTk): |
|
|
|
tid = self.displayed_sids[r] |
|
|
|
row = self.db.get_task(tid) |
|
|
|
links = json.loads(row.get("links") or "[]") |
|
|
|
if not links: messagebox.showinfo("No links", "No links found"); return |
|
|
|
for u in links: webbrowser.open(u) |
|
|
|
if not links: |
|
|
|
messagebox.showinfo("No links", "No links found") |
|
|
|
return |
|
|
|
# Single link: open immediately (preserve original behaviour) |
|
|
|
if len(links) == 1: |
|
|
|
try: |
|
|
|
webbrowser.open(links[0]) |
|
|
|
except Exception: |
|
|
|
messagebox.showerror("Error", "Failed to open link") |
|
|
|
return |
|
|
|
|
|
|
|
# Multiple links: show a small window listing them; user selects one to open |
|
|
|
win = ctk.CTkToplevel(self) |
|
|
|
win.title("Open Link") |
|
|
|
win.geometry("640x320") |
|
|
|
# header |
|
|
|
try: |
|
|
|
ctk.CTkLabel(win, text=f"Links for task {tid}").pack(anchor="w", padx=8, pady=(8,0)) |
|
|
|
except Exception: |
|
|
|
tk.Label(win, text=f"Links for task {tid}").pack(anchor="w", padx=8, pady=(8,0)) |
|
|
|
|
|
|
|
lb = tk.Listbox(win, height=10) |
|
|
|
lb.pack(fill="both", expand=True, padx=8, pady=8) |
|
|
|
for u in links: |
|
|
|
lb.insert("end", u) |
|
|
|
|
|
|
|
def _open_selected(): |
|
|
|
sel = lb.curselection() |
|
|
|
if not sel: |
|
|
|
messagebox.showinfo("Info", "Select a link") |
|
|
|
return |
|
|
|
url = lb.get(sel[0]) |
|
|
|
try: |
|
|
|
webbrowser.open(url) |
|
|
|
except Exception: |
|
|
|
messagebox.showerror("Error", "Failed to open link") |
|
|
|
win.destroy() |
|
|
|
|
|
|
|
def _open_all(): |
|
|
|
for u in links: |
|
|
|
try: webbrowser.open(u) |
|
|
|
except Exception: pass |
|
|
|
win.destroy() |
|
|
|
|
|
|
|
lb.bind("<Double-1>", lambda e: _open_selected()) |
|
|
|
|
|
|
|
btn_row = ctk.CTkFrame(win) |
|
|
|
btn_row.pack(fill="x", padx=8, pady=8) |
|
|
|
ctk.CTkButton(btn_row, text="Open All", command=_open_all).pack(side="left", padx=6) |
|
|
|
ctk.CTkButton(btn_row, text="Close", fg_color="#888", hover_color="#666", command=win.destroy).pack(side="right", padx=6) |
|
|
|
|
|
|
|
def mark_selected_processed_today(self): |
|
|
|
r = self._get_first_selected_row_index() |
|
|
|
|