吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2426|回复: 50
收起左侧

[Python 原创] 待办清单 todolist

  [复制链接]
hfol85 发表于 2025-2-28 00:53
本帖最后由 hfol85 于 2025-3-4 10:34 编辑


成品下载链接: https://pan.baidu.com/s/1QYWNMtI3Ut4HEco0NAt6zQ?pwd=52pj 提取码: 52pj

软件特点:
1、支持自动记录固定的大小
2、支持截止日期最后一天时提醒
3、支持优先级分类与工作、个人等其它分类方式
4、支持任务清单筛选
5、支持任务导出

image.png image.png
[Python] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
"""
待办事项清单应用
采用MVC架构设计,实现任务管理功能
"""
 
import tkinter as tk
from tkinter import ttk, messagebox
import json
from datetime import datetime, timedelta
from tkcalendar import DateEntry  # 需要先安装: pip install tkcalendar
from tkinter import font as tkfont  # 添加字体支持
import threading
import time
import sys
import os
 
# 常量定义
class AppConfig:
    """应用程序配置和常量"""
     
    # 界面颜色方案
    COLORS = {
        "bg": "#ffffff",           # 纯白背景
        "fg": "#2c3e50",          # 深蓝灰色文字
        "accent": "#3498db",       # 天蓝色主题
        "success": "#2ecc71",      # 翠绿色
        "warning": "#f1c40f",      # 金黄色
        "error": "#e74c3c",        # 红色
        "light_bg": "#f8f9fa",     # 浅灰背景
        "border": "#e9ecef"        # 浅色边框
    }
     
    # 默认配置
    DEFAULT_CONFIG = {
        "window_size": "1280x720",
        "transparency": 1.0
    }
     
    # 任务相关配置
    CATEGORIES = ["默认", "工作", "个人", "购物", "学习"]
    PRIORITIES = ["低", "普通", "高"]
    PRIORITY_ICONS = {
        "高": ("🔴", COLORS["error"]),
        "普通": ("🔵", COLORS["accent"]),
        "低": ("🟢", COLORS["success"])
    }
 
class FileManager:
    """文件操作管理类"""
     
    @staticmethod
    def get_resource_path(relative_path):
        """获取资源文件的绝对路径"""
        try:
            # 如果是打包后的exe,使用exe所在目录
            if getattr(sys, 'frozen', False):
                base_path = os.path.dirname(sys.executable)
            else:
                # 开发环境使用当前目录
                base_path = os.path.dirname(os.path.abspath(__file__))
             
            # 确保返回的是程序所在目录下的路径
            return os.path.join(base_path, relative_path)
             
        except Exception as e:
            print(f"获取路径失败: {e}")
            # 如果出错,返回当前目录下的路径
            return os.path.join(os.path.abspath("."), relative_path)
     
    @classmethod
    def load_json(cls, filename):
        """加载JSON文件"""
        try:
            path = cls.get_resource_path(filename)
            if os.path.exists(path):
                with open(path, "r", encoding="utf-8") as f:
                    return json.load(f)
            else:
                # 如果文件不存在,创建空文件
                if filename == "tasks.json":
                    cls.save_json([], filename)
                    return []
                elif filename == "config.json":
                    default_config = {
                        "window_size": "1280x720",
                        "transparency": 1.0
                    }
                    cls.save_json(default_config, filename)
                    return default_config
        except Exception as e:
            print(f"加载{filename}失败: {e}")
            return None
     
    @classmethod
    def save_json(cls, data, filename):
        """保存JSON文件"""
        try:
            path = cls.get_resource_path(filename)
            with open(path, "w", encoding="utf-8") as f:
                json.dump(data, f, ensure_ascii=False, indent=2)
            return True
        except Exception as e:
            print(f"保存{filename}失败: {e}")
            return False
 
class TaskModel:
    """任务数据模型"""
     
    def __init__(self):
        self.tasks = []
        self.filtered_indices = []
        self.load_tasks()
     
    def load_tasks(self):
        """加载任务数据"""
        tasks = FileManager.load_json("tasks.json")
        if tasks:
            for task in tasks:
                self._init_task_fields(task)
            self.tasks = tasks
        else:
            self.tasks = []
     
    def save_tasks(self):
        """保存任务数据"""
        return FileManager.save_json(self.tasks, "tasks.json")
     
    def add_task(self, task_data):
        """添加新任务"""
        task = {
            "task": task_data["task"],
            "priority": task_data["priority"],
            "due_date": task_data["due_date"],
            "category": task_data["category"],
            "completed": False,
            "reminded": False,
            "created_at": datetime.now().strftime("%Y-%m-%d %H:%M")
        }
        self.tasks.append(task)
        self.save_tasks()
     
    def _init_task_fields(self, task):
        """初始化任务字段"""
        task.setdefault("reminded", False)
        task.setdefault("priority", "普通")
        task.setdefault("category", "默认")
        task.setdefault("due_date", datetime.now().strftime("%Y-%m-%d"))
 
class TodoApp:
    """主应用类"""
     
    def __init__(self, root):
        self.root = root
        self.model = TaskModel()
        self.config = self._load_config()
         
        self._init_ui()
        self._setup_bindings()
        self._start_reminder_thread()
     
    def _init_ui(self):
        """初始化用户界面"""
        self.root.title("✨ 待办事项清单")
        self._setup_window()
        self._setup_styles()
        self._create_main_frame()
        self._create_menu()
        self.update_task_list()
        self.update_stats()
     
    def _setup_window(self):
        """设置窗口属性"""
        self.root.geometry(self.config.get("window_size", "1280x720"))
        self.root.minsize(512, 288)
        self.root.attributes("-alpha", self.config.get("transparency", 1.0))
         
        self.root.grid_rowconfigure(0, weight=1)
        self.root.grid_columnconfigure(0, weight=1)
     
    def _setup_styles(self):
        """设置界面样式"""
        style = ttk.Style()
        style.configure(".", font=('Microsoft YaHei UI', 10))
        style.configure("Title.TLabel",
                       font=('Microsoft YaHei UI', 18, 'bold'),
                       foreground=AppConfig.COLORS["fg"])
        style.configure("Accent.TButton",
                       padding=(10, 5),
                       font=('Microsoft YaHei UI', 9, 'bold'),
                       width=15)
     
    def _create_main_frame(self):
        """创建主框架"""
        self.main_frame = ttk.Frame(self.root, padding="20")
        self.main_frame.grid(row=0, column=0, sticky="nsew")
         
        # 配置主框架网格
        self.main_frame.grid_columnconfigure(0, weight=2)
        self.main_frame.grid_columnconfigure(1, weight=1)
        self.main_frame.grid_rowconfigure(0, weight=1)
         
        # 创建左右面板
        self._create_left_panel()
        self._create_right_panel()
     
    def _create_left_panel(self):
        """创建左侧面板"""
        # 左侧面板改用grid布局
        left_panel = ttk.Frame(self.main_frame)
        left_panel.grid(row=0, column=0, sticky="nsew", padx=(0, 20))
        left_panel.grid_columnconfigure(0, weight=1)
         
        # 配置左侧面板的网格权重
        left_panel.grid_columnconfigure(0, weight=1)
        left_panel.grid_rowconfigure(0, weight=0# 标题不伸缩
        left_panel.grid_rowconfigure(1, weight=0# 输入区域不伸缩
        left_panel.grid_rowconfigure(2, weight=1# 任务列表区域可以伸缩
         
        # 标题
        ttk.Label(left_panel, text="✨ 我的待办清单", style="Title.TLabel").grid(
            row=0, column=0, sticky="w", pady=(0, 20))
         
        # 任务输入区域改用 grid 布局
        input_frame = ttk.LabelFrame(left_panel, text="新建任务", padding=10)
        input_frame.grid(row=1, column=0, sticky="ew")
        input_frame.grid_columnconfigure(0, weight=1)
         
        # 任务输入框改用 grid
        self.task_var = tk.StringVar()
        self.task_entry = ttk.Entry(
            input_frame,
            textvariable=self.task_var,
            font=('Microsoft YaHei UI', 11)
        )
        self.task_entry.grid(row=0, column=0, sticky="ew", pady=(0, 10))
         
        # 任务属性选择区域改用 grid
        attrs_frame = ttk.Frame(input_frame)
        attrs_frame.grid(row=1, column=0, sticky="ew")
        attrs_frame.grid_columnconfigure(3, weight=1# 给最后一列添加权重
         
        # 优先级选择
        priority_frame = ttk.Frame(attrs_frame)
        priority_frame.grid(row=0, column=0, padx=(0, 15))
        ttk.Label(priority_frame, text="优先级").grid(row=0, column=0, padx=(0, 5))
        self.priority_var = tk.StringVar(value="普通")
        self.priority_combo = ttk.Combobox(
            priority_frame,
            textvariable=self.priority_var,
            values=["低", "普通", "高"],
            width=6,
            state="readonly"
        )
        self.priority_combo.grid(row=0, column=1)
         
        # 截止日期选择
        date_frame = ttk.Frame(attrs_frame)
        date_frame.grid(row=0, column=1, padx=(0, 15))
        ttk.Label(date_frame, text="截止日期").grid(row=0, column=0, padx=(0, 5))
        self.due_date = DateEntry(
            date_frame,
            width=10,
            background=AppConfig.COLORS["accent"],
            foreground="white",
            borderwidth=0
        )
        self.due_date.grid(row=0, column=1)
         
        # 分类选择
        category_frame = ttk.Frame(attrs_frame)
        category_frame.grid(row=0, column=2)
        ttk.Label(category_frame, text="分类").grid(row=0, column=0, padx=(0, 5))
        self.category_var = tk.StringVar(value="默认")
        self.category_combo = ttk.Combobox(
            category_frame,
            textvariable=self.category_var,
            values=["默认", "工作", "个人", "购物", "学习"],
            width=8,
            state="readonly"
        )
        self.category_combo.grid(row=0, column=1)
         
        # 添加按钮
        add_button = ttk.Button(
            input_frame,
            text="➕ 添加任务",
            command=self.add_task,
            style="Accent.TButton"
        )
        add_button.grid(row=2, column=0, sticky="ew", pady=(10, 0))
         
        # 绑定回车键到添加任务
        self.task_entry.bind('<Return>', lambda e: self.add_task())
         
        # 任务列表区域
        list_frame = ttk.Frame(left_panel)
        list_frame.grid(row=2, column=0, sticky="nsew", pady=10)
        list_frame.grid_columnconfigure(0, weight=1)
        list_frame.grid_rowconfigure(0, weight=1)
         
        # 任务列表和滚动条
        self.task_listbox = tk.Listbox(
            list_frame,
            font=('Microsoft YaHei UI', 10),
            selectmode=tk.SINGLE,
            activestyle='none',
            relief="flat",
            bg="white",
            fg=AppConfig.COLORS["fg"],
            selectbackground=AppConfig.COLORS["accent"],
            selectforeground="white",
            borderwidth=1,
            highlightthickness=1
        )
        self.task_listbox.grid(row=0, column=0, sticky="nsew")
         
        scrollbar = ttk.Scrollbar(list_frame, orient="vertical", command=self.task_listbox.yview)
        scrollbar.grid(row=0, column=1, sticky="ns")
        self.task_listbox.configure(yscrollcommand=scrollbar.set)
     
    def _create_right_panel(self):
        """创建右侧面板"""
        # 右侧面板改用grid布局
        right_panel = ttk.Frame(self.main_frame)
        right_panel.grid(row=0, column=1, sticky="nsew")
        right_panel.grid_columnconfigure(0, weight=1)
         
        # 配置右侧面板各部分的权重
        for i in range(6):  # 为所有行添加权重
            right_panel.grid_rowconfigure(i, weight=1)
         
        # 任务详情
        self.detail_frame = ttk.LabelFrame(right_panel, text="&#9997;&#65039; 任务详情", padding=10)
        self.detail_frame.grid(row=0, column=0, sticky="nsew", pady=(0, 10))
        self.detail_frame.grid_columnconfigure(1, weight=1)
         
        # 详情标签
        self.detail_labels = {}
        fields = [
            ("任务内容", "task"),
            ("创建时间", "created_at"),
            ("截止日期", "due_date"),
            ("优先级", "priority"),
            ("分类", "category"),
            ("状态", "completed")
        ]
         
        for i, (label, _) in enumerate(fields):
            ttk.Label(self.detail_frame, text=f"{label}:").grid(row=i, column=0, sticky="w", pady=2)
            self.detail_labels[label] = ttk.Label(self.detail_frame, text="")
            self.detail_labels[label].grid(row=i, column=1, sticky="w", pady=2, padx=5)
         
        # 统计信息
        self.stats_frame = ttk.LabelFrame(right_panel, text="&#128202; 统计信息", padding=10)
        self.stats_frame.grid(row=1, column=0, sticky="nsew", pady=(0, 10))
        self.stats_frame.grid_columnconfigure(0, weight=1)
         
        # 统计信息标签
        self.stats_labels = {}
        stats = [
            ("总任务", "&#128450;&#65039;"),
            ("已完成", "&#9989;"),
            ("未完成", "&#9203;"),
            ("今日截止", "&#128197;")
        ]
         
        for i, (label, icon) in enumerate(stats):
            frame = ttk.Frame(self.stats_frame)
            frame.grid(row=i, column=0, sticky="ew", pady=2)
            frame.grid_columnconfigure(1, weight=1)
            ttk.Label(frame, text=f"{icon} {label}:").grid(row=0, column=0, sticky="w")
            self.stats_labels[label] = ttk.Label(frame, text="0")
            self.stats_labels[label].grid(row=0, column=1, sticky="e")
         
        # 筛选框
        filter_frame = ttk.LabelFrame(right_panel, text="&#128269; 筛选", padding=10)
        filter_frame.grid(row=2, column=0, sticky="nsew", pady=(0, 10))
        filter_frame.grid_columnconfigure(0, weight=1# 让筛选框可以自适应宽度
         
        # 分类筛选
        category_filter_frame = ttk.Frame(filter_frame)
        category_filter_frame.grid(row=0, column=0, sticky="ew", pady=(0, 5))
        category_filter_frame.grid_columnconfigure(1, weight=1)
         
        ttk.Label(category_filter_frame, text="分类:").grid(row=0, column=0, padx=(0, 5))
        self.filter_category_var = tk.StringVar(value="全部")
        self.filter_category = ttk.Combobox(
            category_filter_frame,
            textvariable=self.filter_category_var,
            values=["全部", "默认", "工作", "个人", "购物", "学习"],
            width=8,
            state="readonly"
        )
        self.filter_category.grid(row=0, column=1, sticky="ew")
        self.filter_category.bind('<<ComboboxSelected>>', lambda e: self.update_task_list())
         
        # 添加状态筛选
        status_filter_frame = ttk.Frame(filter_frame)
        status_filter_frame.grid(row=1, column=0, sticky="ew")
        status_filter_frame.grid_columnconfigure(1, weight=1)
         
        ttk.Label(status_filter_frame, text="状态:").grid(row=0, column=0, padx=(0, 5))
        self.filter_status_var = tk.StringVar(value="全部")
        self.filter_status = ttk.Combobox(
            status_filter_frame,
            textvariable=self.filter_status_var,
            values=["全部", "已完成", "未完成"],
            width=8,
            state="readonly"
        )
        self.filter_status.grid(row=0, column=1, sticky="ew")
        self.filter_status.bind('<<ComboboxSelected>>', lambda e: self.update_task_list())
         
        # 操作按钮
        buttons_frame = ttk.LabelFrame(right_panel, text="操作", padding=10)
        buttons_frame.grid(row=3, column=0, sticky="nsew", pady=(0, 10))
        buttons_frame.grid_columnconfigure(0, weight=1)
         
        # 添加操作按钮
        self.mark_button = ttk.Button(
            buttons_frame,
            text="&#10003; 标记完成",
            command=self.mark_complete,
            style="Accent.TButton"
        )
        self.mark_button.grid(row=0, column=0, sticky="ew", pady=2)
         
        ttk.Button(
            buttons_frame,
            text="&#128465;&#65039; 删除任务",
            command=self.delete_task,
            style="Accent.TButton"
        ).grid(row=1, column=0, sticky="ew", pady=2)
         
        ttk.Button(
            buttons_frame,
            text="&#128203; 导出任务",
            command=self.export_tasks,
            style="Accent.TButton"
        ).grid(row=2, column=0, sticky="ew", pady=2)
         
        # 排序选项
        sort_frame = ttk.LabelFrame(right_panel, text="排序方式", padding=10)
        sort_frame.grid(row=4, column=0, sticky="nsew", pady=(0, 10))
        sort_frame.grid_columnconfigure(0, weight=1)
         
        self.sort_var = tk.StringVar(value="优先级")
        self.sort_combo = ttk.Combobox(
            sort_frame,
            textvariable=self.sort_var,
            values=["优先级", "创建时间", "截止日期", "分类"],
            state="readonly"
        )
        self.sort_combo.grid(row=0, column=0, sticky="ew")
        self.sort_combo.bind('<<ComboboxSelected>>', lambda e: self.update_task_list())
         
        # 绑定任务选择事件
        self.task_listbox.bind('<<ListboxSelect>>', self.show_task_details)
     
    def _setup_bindings(self):
        """设置事件绑定"""
        self.root.bind("<Configure>", self._on_window_configure)
        self.root.protocol("WM_DELETE_WINDOW", self._on_closing)
     
    def _start_reminder_thread(self):
        """启动提醒线程"""
        self.reminder_thread = threading.Thread(
            target=self._check_reminders,
            daemon=True
        )
        self.reminder_thread.start()
     
    def _load_config(self):
        """加载配置"""
        config = FileManager.load_json("config.json")
        return config if config else AppConfig.DEFAULT_CONFIG.copy()
     
    def _save_config(self):
        """保存配置"""
        FileManager.save_json(self.config, "config.json")
     
    def _on_window_configure(self, event):
        """窗口大小改变事件处理"""
        if event.widget == self.root:
            size = f"{self.root.winfo_width()}x{self.root.winfo_height()}"
            self.config["window_size"] = size
            self._save_config()
     
    def _on_closing(self):
        """程序关闭处理"""
        self.model.save_tasks()
        self._save_config()
        self.root.destroy()
     
    def _check_reminders(self):
        """检查任务提醒"""
        while True:
            try:
                today = datetime.now().strftime("%Y-%m-%d")
                for task in self.model.tasks:
                    if (not task["completed"] and
                        task["due_date"] == today and
                        not task.get("reminded", False)):
                         
                        self.root.after(0, lambda t=task: messagebox.showwarning(
                            "任务提醒",
                            f"任务「{t['task']}」将在今天截止!"
                        ))
                        task["reminded"] = True
                 
                time.sleep(300)
            except Exception as e:
                print(f"提醒检查出错: {e}")
                time.sleep(60)
 
    def add_task(self):
        task = self.task_var.get().strip()
        if task:
            current_time = datetime.now().strftime("%Y-%m-%d %H:%M")
            self.model.add_task({
                "task": task,
                "completed": False,
                "created_at": current_time,
                "priority": self.priority_var.get(),
                "due_date": self.due_date.get_date().strftime("%Y-%m-%d"),
                "category": self.category_var.get()
            })
            self.task_var.set("")
            self.priority_var.set("普通"# 重置为默认优先级
            self.update_task_list()
            self.update_stats()
        else:
            messagebox.showwarning("警告", "请输入任务内容!")
 
    def mark_complete(self):
        selection = self.task_listbox.curselection()
        if not selection:
            messagebox.showinfo("提示", "请先选择要标记的任务!")
            return
         
        filtered_index = selection[0]
        if 0 <= filtered_index < len(self.model.filtered_indices):
            original_index = self.model.filtered_indices[filtered_index]
            self.model.tasks[original_index]["completed"] = not self.model.tasks[original_index]["completed"]
        self.update_task_list()
        self.update_stats()
         
        # 重新选中该任务
        self.task_listbox.selection_clear(0, tk.END)
        self.task_listbox.selection_set(filtered_index)
        self.task_listbox.see(filtered_index)
        self.show_task_details()
 
    def delete_task(self):
        selection = self.task_listbox.curselection()
        if not selection:
            messagebox.showinfo("提示", "请先选择要删除的任务!")
            return
         
        # 获取当前选中的任务索引
        index = selection[0]
         
        # 确保索引有效
        if 0 <= index < len(self.model.tasks):
            # 确认删除
            task = self.model.tasks[index]
            if messagebox.askyesno("确认删除", f"确定要删除任务「{task['task']}」吗?"):
                del self.model.tasks[index]
                self.update_task_list()
                self.update_stats()
 
    def update_task_list(self):
        self.task_listbox.delete(0, tk.END)
        self.model.filtered_indices = []  # 重置索引映射
         
        filtered_tasks = self.model.tasks.copy()
         
        # 应用分类筛选
        if self.filter_category_var.get() != "全部":
            filtered_tasks = [t for t in filtered_tasks
                            if t["category"] == self.filter_category_var.get()]
         
        # 应用状态筛选
        if self.filter_status_var.get() != "全部":
            is_completed = self.filter_status_var.get() == "已完成"
            filtered_tasks = [t for t in filtered_tasks if t["completed"] == is_completed]
         
        # 应用排序
        sort_key = self.sort_var.get()
         
        if sort_key == "优先级":
            sorted_tasks = sorted(filtered_tasks,
                                key=lambda x: (not x["completed"],
                                             {"高": 0, "普通": 1, "低": 2}[x["priority"]]))
        elif sort_key == "创建时间":
            sorted_tasks = sorted(filtered_tasks,
                                key=lambda x: (not x["completed"], x["created_at"]))
        elif sort_key == "截止日期":
            sorted_tasks = sorted(filtered_tasks,
                                key=lambda x: (not x["completed"], x["due_date"]))
        else# 分类
            sorted_tasks = sorted(filtered_tasks,
                                key=lambda x: (not x["completed"], x["category"]))
         
        # 设置不同优先级的图标和颜色
        priority_settings = {
            "高": {
                "icon": "&#128308;",
                "color": AppConfig.COLORS["error"]
            },
            "普通": {
                "icon": "&#128309;",
                "color": AppConfig.COLORS["accent"]
            },
            "低": {
                "icon": "&#128994;",
                "color": AppConfig.COLORS["success"]
            }
        }
         
        # 添加任务时记录原始索引
        for i, task in enumerate(sorted_tasks, 1):
            original_index = self.model.tasks.index(task)
            self.model.filtered_indices.append(original_index)
            status = "&#10003;" if task["completed"] else "□"
            priority = task["priority"]
            settings = priority_settings[priority]
             
            # 组合任务显示文本,添加序号
            display_text = f"{i:02d}. {status} {settings['icon']} {task['task']} ({task['due_date']})"
            self.task_listbox.insert(tk.END, display_text)
             
            # 设置任务项的颜色
            if task["completed"]:
                self.task_listbox.itemconfig(i-1, fg="gray")
            else:
                self.task_listbox.itemconfig(i-1, fg=settings["color"])
 
    def update_stats(self):
        today = datetime.now().strftime("%Y-%m-%d")
        total = len(self.model.tasks)
        completed = sum(1 for task in self.model.tasks if task["completed"])
        due_today = sum(1 for task in self.model.tasks if task["due_date"] == today)
         
        self.stats_labels["总任务"].config(text=str(total))
        self.stats_labels["已完成"].config(text=str(completed))
        self.stats_labels["未完成"].config(text=str(total - completed))
        self.stats_labels["今日截止"].config(text=str(due_today))
 
    def export_tasks(self):
        filename = f"任务清单_{datetime.now().strftime('%Y%m%d_%H%M')}.txt"
        with open(filename, "w", encoding="utf-8") as f:
            f.write("=== 待办事项清单 ===\n\n")
            for task in self.model.tasks:
                status = "&#10003;" if task["completed"] else "&#11036;"
                f.write(f"{status} {task['task']}\n")
                f.write(f"   优先级: {task['priority']}\n")
                f.write(f"   分类: {task['category']}\n")
                f.write(f"   创建时间: {task['created_at']}\n")
                f.write(f"   截止日期: {task['due_date']}\n")
                f.write("\n")
        messagebox.showinfo("成功", f"任务已导出到 {filename}")
 
    def show_task_details(self, event=None):
        selection = self.task_listbox.curselection()
        if not selection:
            # 清空详情显示时也重置按钮文本
            self.mark_button.config(text="&#10003; 标记完成")
            for label in self.detail_labels.values():
                label.config(text="")
            return
         
        # 获取当前选中的任务索引
        filtered_index = selection[0]
        if 0 <= filtered_index < len(self.model.filtered_indices):
            original_index = self.model.filtered_indices[filtered_index]
            task = self.model.tasks[original_index]
             
            # 更新按钮文本
            button_text = "&#10003; 标记未完成" if task["completed"] else "&#10003; 标记完成"
            self.mark_button.config(text=button_text)
             
            # 更新详情标签
            self.detail_labels["任务内容"].config(text=task["task"])
            self.detail_labels["创建时间"].config(text=task["created_at"])
            self.detail_labels["截止日期"].config(text=task["due_date"])
            self.detail_labels["优先级"].config(text=task["priority"])
            self.detail_labels["分类"].config(text=task["category"])
            self.detail_labels["状态"].config(
                text="已完成" if task["completed"] else "未完成"
            )
 
    def show_help(self):
        help_text = """&#10024; 待办事项清单 使用说明 &#10024;
 
1. 添加任务
   - 在输入框中输入任务内容
   - 选择优先级、截止日期和分类
   - 点击"添加任务"按钮或按回车键
 
2. 标记任务完成
   - 选择任务后点击"&#10003; 标记完成"按钮
   - 或按空格键切换任务状态
 
3. 删除任务
   - 选择任务后点击"&#128465;&#65039; 删除任务"按钮
   - 或按Ctrl+D删除任务
 
4. 筛选和排序
   - 使用右侧的筛选条件过滤任务
   - 选择排序方式对任务进行排序
 
5. 导出任务
   - 点击"&#128203; 导出任务"按钮
   - 或按Ctrl+E将任务导出为文本文件
 
6. 其他功能
   - 右键点击任务可快速操作
   - 使用Ctrl+S保存任务
   - 任务将在截止日期当天提醒
"""
        messagebox.showinfo("使用说明", help_text)
 
    def _create_menu(self):
        """创建菜单栏"""
        menubar = tk.Menu(self.root)
        self.root.config(menu=menubar)
 
        # 添加视图菜单
        view_menu = tk.Menu(menubar, tearoff=0)
        view_menu.add_command(label="透明度调节", command=self.show_transparency_dialog)
        menubar.add_cascade(label="视图", menu=view_menu)
 
        # 添加帮助菜单
        help_menu = tk.Menu(menubar, tearoff=0)
        help_menu.add_command(label="使用说明", command=self.show_help)
        help_menu.add_separator()
        help_menu.add_command(label="关于", command=self.show_about)
        menubar.add_cascade(label="帮助", menu=help_menu)
 
    def show_transparency_dialog(self):
        """显示透明度调节对话框"""
        dialog = tk.Toplevel(self.root)
        dialog.title("透明度调节")
        dialog.transient(self.root)
        dialog.grab_set()
         
        # 透明度滑块
        transparency_label = ttk.Label(dialog, text="透明度:")
        transparency_label.grid(row=0, column=0, padx=5, pady=5)
         
        transparency_scale = ttk.Scale(
            dialog,
            from_=0.1,
            to=1.0,
            value=self.config.get("transparency", 1.0),
            command=self.set_transparency
        )
        transparency_scale.grid(row=0, column=1, padx=5, pady=5)
 
    def set_transparency(self, value):
        """设置窗口透明度"""
        try:
            value = float(value)
            self.root.attributes("-alpha", value)
            self.config["transparency"] = value
        except ValueError:
            pass
 
    def show_about(self):
        """显示关于对话框"""
        about_text = """&#10024; 待办事项清单 &#10024;
 
版本: 1.0
作者: Your Name
日期: 2024
 
一个简单易用的待办事项管理工具,
帮助你更好地规划和管理日常任务。
"""
        messagebox.showinfo("关于", about_text)
 
def main():
    """程序入口"""
    root = tk.Tk()
    app = TodoApp(root)
    root.mainloop()
 
if __name__ == "__main__":
    main()



重构版源码如下:
[Python] 纯文本查看 复制代码
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673
0674
0675
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
0829
0830
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844
0845
0846
0847
0848
0849
0850
0851
0852
0853
0854
0855
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866
0867
0868
0869
0870
0871
0872
0873
0874
0875
0876
0877
0878
0879
0880
0881
0882
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913
0914
0915
0916
0917
0918
0919
0920
0921
0922
0923
0924
0925
0926
0927
0928
0929
0930
0931
0932
0933
0934
0935
0936
0937
0938
0939
0940
0941
0942
0943
0944
0945
0946
0947
0948
0949
0950
0951
0952
0953
0954
0955
0956
0957
0958
0959
0960
0961
0962
0963
0964
0965
0966
0967
0968
0969
0970
0971
0972
0973
0974
0975
0976
0977
0978
0979
0980
0981
0982
0983
0984
0985
0986
0987
0988
0989
0990
0991
0992
0993
0994
0995
0996
0997
0998
0999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
"""
待办事项清单应用
采用MVC架构设计,实现事项管理功能
"""
 
import tkinter as tk
from tkinter import ttk, messagebox, filedialog
import json
from datetime import datetime, timedelta
from tkcalendar import DateEntry  # 需要先安装: pip install tkcalendar
from tkinter import font as tkfont  # 添加字体支持
import threading
import time
import sys
import os
 
# 常量定义
class AppConfig:
    """应用程序配置和常量"""
     
    # 颜色配置
    COLORS = {
        "bg": "#ffffff",           # 纯白背景
        "fg": "#333333",          # 深灰文字
        "accent": "#4a90e2",       # 清新蓝色主题
        "success": "#2ecc71",      # 薄荷绿
        "warning": "#f1c40f",      # 明黄色
        "error": "#e74c3c",        # 柔和红
        "light_bg": "#f5f6fa",     # 超浅灰背景
        "border": "#e1e4e8",       # 浅灰边框
        "listbox_bg": "#ffffff",   # 列表框背景
        "listbox_fg": "#333333",   # 列表框文字
        "hover": "#f8f9fa",        # 悬停背景色
        "disabled": "#dcdde1",     # 禁用状态色
        "progress_normal": "#4a90e2",  # 正常进度颜色
        "progress_warning": "#f1c40f",  # 警告进度颜色(75%以上)
        "progress_danger": "#e74c3c",   # 危险进度颜色(90%以上)
        "progress_bg": "#f5f6fa"        # 进度条背景色
    }
     
    # 默认配置
    DEFAULT_CONFIG = {
        "window_size": "1280x720",
        "transparency": 1.0
    }
     
    # 事项相关配置
    CATEGORIES = ["默认", "工作", "个人", "购物", "学习"]
    PRIORITIES = ["低", "普通", "高"]
    PRIORITY_ICONS = {
        "高": ("&#128308;", COLORS["error"]),
        "普通": ("&#128309;", COLORS["warning"]),
        "低": ("&#128994;", COLORS["success"])
    }
     
    # 添加支持的附件类型
    SUPPORTED_ATTACHMENTS = [
        ("所有文件", "*.*"),
        ("文本文件", "*.txt"),
        ("图片文件", "*.png *.jpg *.jpeg *.gif"),
        ("文档文件", "*.pdf *.doc *.docx"),
    ]
     
    # 添加附件存储目录
    ATTACHMENT_DIR = "attachments"
     
    # 进度条颜色映射
    PROGRESS_COLORS = {
        "normal": "progress_normal",
        "warning": "progress_warning",
        "danger": "progress_danger"
    }
 
class FileManager:
    """文件操作管理类"""
     
    @staticmethod
    def get_resource_path(relative_path):
        """获取资源文件的绝对路径"""
        try:
            # 使用更可靠的路径处理方式
            if getattr(sys, 'frozen', False):
                base_path = os.path.abspath(os.path.dirname(sys.executable))
            else:
                base_path = os.path.abspath('.')
             
            # 规范化路径,确保跨平台兼容性
            return os.path.abspath(os.path.normpath(os.path.join(base_path, relative_path)))
             
        except Exception as e:
            print(f"获取路径失败: {e},文件路径: {relative_path}", file=sys.stderr)
            return os.path.abspath(os.path.normpath(os.path.join(os.path.abspath("."), relative_path)))
     
    @classmethod
    def load_json(cls, filename):
        """加载JSON文件"""
        try:
            path = cls.get_resource_path(filename)
            # 确保目录存在
            os.makedirs(os.path.dirname(path), exist_ok=True)
             
            if os.path.exists(path):
                with open(path, "r", encoding="utf-8") as f:
                    try:
                        return json.load(f)
                    except json.JSONDecodeError as e:
                        print(f"JSON解析错误: {e},文件路径: {path}", file=sys.stderr)
                        return None
            else:
                # 如果文件不存在,创建空文件
                if filename == "tasks.json":
                    cls.save_json([], filename)
                    return []
                elif filename == "config.json":
                    # 使用 AppConfig 中的默认配置
                    default_config = AppConfig.DEFAULT_CONFIG.copy()
                    cls.save_json(default_config, filename)
                    return default_config
        except Exception as e:
            print(f"加载{filename}失败: {e},文件路径: {path}", file=sys.stderr)
            if filename == "config.json":
                return AppConfig.DEFAULT_CONFIG.copy()
            return None
     
    @classmethod
    def save_json(cls, data, filename):
        """保存JSON文件,带有文件锁和备份机制"""
        path = cls.get_resource_path(filename)
        backup_path = f"{path}.bak"
        temp_path = f"{path}.tmp"
         
        try:
            # 创建临时文件
            with open(temp_path, "w", encoding="utf-8") as f:
                json.dump(data, f, ensure_ascii=False, indent=2)
             
            # 如果原文件存在,创建备份
            if os.path.exists(path):
                try:
                    import shutil
                    shutil.copy2(path, backup_path)
                except Exception as e:
                    print(f"创建备份文件失败: {e}")
             
            # 使用原子操作替换原文件
            try:
                os.replace(temp_path, path)
                if os.path.exists(backup_path):
                    os.remove(backup_path)
                return True
            except Exception as e:
                # 如果替换失败,尝试恢复备份
                if os.path.exists(backup_path):
                    os.replace(backup_path, path)
                print(f"保存{filename}失败: {e}")
                return False
                 
        except Exception as e:
            print(f"保存{filename}失败: {e}")
            return False
        finally:
            # 清理临时文件
            if os.path.exists(temp_path):
                try:
                    os.remove(temp_path)
                except:
                    pass
 
class TaskModel:
    """事项数据模型"""
     
    def __init__(self):
        self.tasks = []
        self.filtered_indices = []
        self.load_tasks()
     
    def load_tasks(self):
        """加载事项数据"""
        tasks = FileManager.load_json("tasks.json")
        if tasks:
            for task in tasks:
                self._init_task_fields(task)
            self.tasks = tasks
        else:
            self.tasks = []
     
    def save_tasks(self):
        """保存事项数据"""
        return FileManager.save_json(self.tasks, "tasks.json")
     
    def add_task(self, task_data):
        """添加新事项"""
        task = {
            "task": task_data["task"],
            "priority": task_data["priority"],
            "due_date": task_data["due_date"],
            "category": task_data["category"],
            "completed": task_data.get("completed", False),
            "reminded": False,
            "created_at": task_data["created_at"],
            "attachments": task_data.get("attachments", []),
            "links": task_data.get("links", [])
        }
        self.tasks.append(task)
        self.save_tasks()
     
    def _init_task_fields(self, task):
        """初始化事项字段"""
        task.setdefault("reminded", False)
        task.setdefault("priority", "普通")
        task.setdefault("category", "默认")
        task.setdefault("due_date", datetime.now().strftime("%Y-%m-%d"))
        task.setdefault("attachments", [])  # 添加附件列表字段
        task.setdefault("links", [])  # 添加超链接列表字段
 
class TodoApp:
    """主应用类"""
     
    def __init__(self, root):
        self.root = root
        self.model = TaskModel()
        self.config = self._load_config()
         
        self.selected_task = None  # 添加选中事项的跟踪
        self.selected_frame = None  # 添加选中框架的跟踪
         
        # 添加线程锁
        import threading
        self.task_lock = threading.Lock()
         
        # 注册退出时的清理函数
        import atexit
        atexit.register(self.model.save_tasks)
         
        # 绑定窗口关闭事件
        self.root.protocol("WM_DELETE_WINDOW", self._on_closing)
         
        self._init_ui()
        self._setup_bindings()
        self._start_reminder_thread()
         
        # 启动时检查剩余时间不足1天的事项
        self._check_urgent_tasks()
     
    def _init_ui(self):
        """初始化用户界面"""
        self.root.title("&#10024; 待办事项清单")
        self._setup_window()
        self._setup_styles()
        self._create_main_frame()
        self._create_menu()
         
        # 初始化事项树的样式配置
        self.task_tree.tag_configure("priority_高", background=AppConfig.COLORS["error"])
        self.task_tree.tag_configure("priority_普通", background=AppConfig.COLORS["warning"])
        self.task_tree.tag_configure("priority_低", background=AppConfig.COLORS["success"])
         
        # 设置优先级文本颜色为白色,使其在彩色背景上更易读
        self.task_tree.tag_configure("priority_高", background=AppConfig.COLORS["error"], foreground="white")
        self.task_tree.tag_configure("priority_普通", background=AppConfig.COLORS["warning"], foreground="black")
        self.task_tree.tag_configure("priority_低", background=AppConfig.COLORS["success"], foreground="white")
         
        self.update_task_list()
        self.update_stats()
     
    def _setup_window(self):
        """设置窗口属性"""
        self.root.geometry(self.config.get("window_size", "1280x720"))
        self.root.minsize(512, 288)
        self.root.attributes("-alpha", self.config.get("transparency", 1.0))
         
        self.root.grid_rowconfigure(0, weight=1)
        self.root.grid_columnconfigure(0, weight=1)
     
    def _setup_styles(self):
        """设置界面样式"""
        style = ttk.Style()
        colors = AppConfig.COLORS
         
        # 基础字体设置
        style.configure(".",
                       font=('Microsoft YaHei UI', 10),
                       background=colors["bg"])
         
        # 配置 Treeview 的基础样式
        style.configure("Treeview",
                       rowheight=30,
                       foreground=colors["fg"])
         
        # 标题样式
        style.configure("Title.TLabel",
                       font=('Microsoft YaHei UI', 24, 'bold'),
                       foreground=colors["fg"],
                       background=colors["bg"],
                       padding=(0, 10))
         
        # 按钮样式
        style.configure("TButton",
                       padding=(10, 5),
                       font=('Microsoft YaHei UI', 10),
                       background=colors["light_bg"],
                       foreground=colors["fg"])
         
        style.map("TButton",
                  background=[("active", colors["hover"]),
                             ("pressed", colors["accent"])],
                  foreground=[("active", colors["fg"]),
                             ("pressed", colors["fg"])])
         
        # 强调按钮样式
        style.configure("Accent.TButton",
                       padding=(20, 10),
                       font=('Microsoft YaHei UI', 10, 'bold'),
                       background=colors["accent"],
                       foreground=colors["fg"])
         
        style.map("Accent.TButton",
                  background=[("active", colors["hover"]),
                             ("pressed", colors["accent"]),
                             ("disabled", colors["disabled"])],
                  foreground=[("disabled", colors["fg"]),
                             ("active", colors["fg"]),
                             ("pressed", colors["fg"])])
         
        # 输入框样式
        style.configure("TEntry",
                       fieldbackground=colors["light_bg"],
                       foreground=colors["fg"],
                       borderwidth=0,
                       relief="flat",
                       padding=(10, 8))
         
        # 下拉框样式
        style.configure("TCombobox",
                       background=colors["light_bg"],
                       fieldbackground=colors["light_bg"],
                       foreground=colors["fg"],
                       arrowcolor=colors["fg"],
                       padding=(5, 5))
         
        # 标签框架样式
        style.configure("TLabelframe",
                       background=colors["bg"],
                       borderwidth=1,
                       relief="solid")
         
        style.configure("TLabelframe.Label",
                       background=colors["bg"],
                       foreground=colors["fg"],
                       font=('Microsoft YaHei UI', 9))
         
        # 链接按钮样式
        style.configure("Link.TButton",
                       background=colors["bg"],
                       foreground=colors["accent"],
                       borderwidth=0,
                       font=('Microsoft YaHei UI', 9, 'underline'))
         
        style.map("Link.TButton",
                  background=[("active", colors["bg"]),
                             ("pressed", colors["bg"])],
                  foreground=[("active", colors["error"])])
         
        # 添加进度条样式
        style.configure("Normal.Horizontal.TProgressbar",
                       troughcolor=colors["progress_bg"],
                       background=colors["progress_normal"],
                       borderwidth=0,
                       thickness=6)
         
        style.configure("Warning.Horizontal.TProgressbar",
                       troughcolor=colors["progress_bg"],
                       background=colors["progress_warning"],
                       borderwidth=0,
                       thickness=6)
         
        style.configure("Danger.Horizontal.TProgressbar",
                       troughcolor=colors["progress_bg"],
                       background=colors["progress_danger"],
                       borderwidth=0,
                       thickness=6)
         
        # 添加进度条标签样式
        style.configure("Progress.TLabel",
                       font=('Microsoft YaHei UI', 9),
                       background=colors["bg"],
                       foreground=colors["fg"])
         
        # 添加选中事项的样式
        style.configure("Selected.TFrame",
                       background=colors["accent"],
                       relief="solid",
                       borderwidth=1)
         
        # 设置主题为clam以支持自定义样式
        style.theme_use("clam")
     
    def _create_main_frame(self):
        """创建主框架"""
        self.main_frame = ttk.Frame(self.root, padding="20")
        self.main_frame.grid(row=0, column=0, sticky="nsew")
        self.main_frame.grid_columnconfigure(0, weight=3)
        self.main_frame.grid_columnconfigure(1, weight=1)
        self.main_frame.grid_rowconfigure(0, weight=1)
         
        # 创建左右面板
        self._create_left_panel()
        self._create_right_panel()
     
    def _create_left_panel(self):
        """创建左侧面板"""
        # 左侧面板改用grid布局
        left_panel = ttk.Frame(self.main_frame)
        left_panel.grid(row=0, column=0, sticky="nsew", padx=(0, 20))
        left_panel.grid_columnconfigure(0, weight=1)
         
        # 配置左侧面板的网格权重
        left_panel.grid_columnconfigure(0, weight=1)
        left_panel.grid_rowconfigure(0, weight=0# 标题不伸缩
        left_panel.grid_rowconfigure(1, weight=0# 输入区域不伸缩
        left_panel.grid_rowconfigure(2, weight=1# 事项列表区域可以伸缩
         
        # 标题
        ttk.Label(left_panel, text="&#10024; 我的待办清单(重构版)", style="Title.TLabel").grid(
            row=0, column=0, sticky="w", pady=(0, 20))
         
        # 事项输入区域改用 grid 布局
        input_frame = ttk.LabelFrame(left_panel, text="新建事项", padding=10)
        input_frame.grid(row=1, column=0, sticky="ew")
        input_frame.grid_columnconfigure(0, weight=1)
         
        # 事项输入框改用 grid
        self.task_var = tk.StringVar()
        self.task_entry = ttk.Entry(
            input_frame,
            textvariable=self.task_var,
            font=('Microsoft YaHei UI', 11)
        )
        self.task_entry.grid(row=0, column=0, sticky="ew", pady=(0, 10))
         
        # 添加输入框右键菜单
        self.entry_menu = tk.Menu(self.task_entry, tearoff=0)
        self.entry_menu.add_command(label="剪切", command=lambda: self.entry_menu_action('cut'))
        self.entry_menu.add_command(label="复制", command=lambda: self.entry_menu_action('copy'))
        self.entry_menu.add_command(label="粘贴", command=lambda: self.entry_menu_action('paste'))
        self.entry_menu.add_separator()
        self.entry_menu.add_command(label="全选", command=lambda: self.entry_menu_action('select_all'))
         
        # 绑定右键事件
        self.task_entry.bind("<Button-3>", self.show_entry_menu)
         
        # 事项属性选择区域改用 grid
        attrs_frame = ttk.Frame(input_frame)
        attrs_frame.grid(row=1, column=0, sticky="ew")
        attrs_frame.grid_columnconfigure(3, weight=1# 给最后一列添加权重
         
        # 优先级选择
        priority_frame = ttk.Frame(attrs_frame)
        priority_frame.grid(row=0, column=0, padx=(0, 15))
        ttk.Label(priority_frame, text="优先级").grid(row=0, column=0, padx=(0, 5))
        self.priority_var = tk.StringVar(value="普通")
        self.priority_combo = ttk.Combobox(
            priority_frame,
            textvariable=self.priority_var,
            values=["低", "普通", "高"],
            width=6,
            state="readonly"
        )
        self.priority_combo.grid(row=0, column=1)
         
        # 截止日期选择
        date_frame = ttk.Frame(attrs_frame)
        date_frame.grid(row=0, column=1, padx=(0, 15))
        ttk.Label(date_frame, text="截止日期").grid(row=0, column=0, padx=(0, 5))
        self.due_date = DateEntry(
            date_frame,
            width=10,
            background=AppConfig.COLORS["accent"],
            foreground="white",
            borderwidth=0
        )
        self.due_date.grid(row=0, column=1)
         
        # 分类选择
        category_frame = ttk.Frame(attrs_frame)
        category_frame.grid(row=0, column=2)
        ttk.Label(category_frame, text="分类").grid(row=0, column=0, padx=(0, 5))
        self.category_var = tk.StringVar(value="默认")
        self.category_combo = ttk.Combobox(
            category_frame,
            textvariable=self.category_var,
            values=["默认", "工作", "个人", "购物", "学习"],
            width=8,
            state="readonly"
        )
        self.category_combo.grid(row=0, column=1)
         
        # 在事项属性选择区域添加附件和链接按钮
        buttons_frame = ttk.Frame(attrs_frame)
        buttons_frame.grid(row=0, column=3, padx=(10, 0))
         
        self.attachment_button = ttk.Button(
            buttons_frame,
            text="&#128206; 附件",
            command=self.add_attachment,
            width=8
        )
        self.attachment_button.grid(row=0, column=0, padx=(0, 5))
         
        self.link_button = ttk.Button(
            buttons_frame,
            text="&#128279; 链接",
            command=self.add_link,
            width=8
        )
        self.link_button.grid(row=0, column=1)
         
        # 修改预览区域的创建方式
        preview_frame = ttk.Frame(input_frame)
        preview_frame.grid(row=3, column=0, sticky="ew", pady=(10, 0))
         
        # 初始化附件和链接列表
        self.current_attachments = []
        self.current_links = []
         
        # 创建预览框架的占位符
        self.attachment_preview_frame = ttk.Frame(preview_frame)
        self.attachment_preview_frame.grid(row=0, column=0, sticky="w")
         
        self.link_preview_frame = ttk.Frame(preview_frame)
        self.link_preview_frame.grid(row=1, column=0, sticky="w")
         
        # 添加按钮
        add_button = ttk.Button(
            input_frame,
            text="&#10133; 添加事项",
            command=self.add_task,
            style="Accent.TButton"
        )
        add_button.grid(row=2, column=0, sticky="ew", pady=(10, 0))
         
        # 绑定回车键到添加事项
        self.task_entry.bind('<Return>', lambda e: self.add_task())
         
        # 修改事项列表区域
        list_frame = ttk.Frame(left_panel)
        list_frame.grid(row=2, column=0, sticky="nsew", pady=10)
        list_frame.grid_columnconfigure(0, weight=1)
        list_frame.grid_rowconfigure(0, weight=1)
         
        # 创建事项容器
        self.tasks_container = ttk.Frame(list_frame)
        self.tasks_container.grid(row=0, column=0, sticky="nsew")
        self.tasks_container.grid_columnconfigure(0, weight=1)
        self.tasks_container.grid_rowconfigure(0, weight=1)
         
        # 创建事项树形视图
        self.task_tree = ttk.Treeview(self.tasks_container, columns=("status", "priority", "task", "due_date", "category", "task_data"), show="headings")
        self.task_tree.grid(row=0, column=0, sticky="nsew")
         
        # 配置列标题
        self.task_tree.heading("status", text="状态", command=lambda: self._sort_by_column("status"))
        self.task_tree.heading("priority", text="优先级", command=lambda: self._sort_by_column("priority"))
        self.task_tree.heading("task", text="事项", command=lambda: self._sort_by_column("task"))
        self.task_tree.heading("due_date", text="剩余时间", command=lambda: self._sort_by_column("due_date"))
        self.task_tree.heading("category", text="分类", command=lambda: self._sort_by_column("category"))
        self.task_tree.heading("task_data", text="")
         
        # 配置列宽和换行
        self.task_tree.column("status", width=0, minwidth=60, stretch=True# 状态列自适应
        self.task_tree.column("priority", width=0, minwidth=60, stretch=True# 优先级列自适应
        self.task_tree.column("task", width=300, stretch=False# 固定事项列宽度为300像素
        self.task_tree.column("due_date", width=0, minwidth=80, stretch=True# 剩余时间列自适应
        self.task_tree.column("category", width=0, minwidth=60, stretch=True# 分类列自适应
        self.task_tree.column("task_data", width=0, stretch=False)
         
        # 设置事项列的换行显示
        style = ttk.Style()
        style.configure("Treeview", rowheight=25# 增加行高以适应换行内容
        style.configure("Treeview", wraplength=190# 设置文本换行宽度
         
        # 添加滚动条
        scrollbar = ttk.Scrollbar(list_frame, orient="vertical", command=self.task_tree.yview)
        scrollbar.grid(row=0, column=1, sticky="ns")
        self.task_tree.configure(yscrollcommand=scrollbar.set)
     
    def _on_canvas_configure(self, event):
        """处理Canvas大小改变事件"""
        self.canvas.itemconfig(1, width=event.width)  # 1 是事项容器的ID
 
    def _create_right_panel(self):
        """创建右侧面板"""
        # 右侧面板改用grid布局
        right_panel = ttk.Frame(self.main_frame)
        right_panel.grid(row=0, column=1, sticky="nsew")
        right_panel.grid_columnconfigure(0, weight=1)
         
        # 配置右侧面板各部分的权重
        for i in range(6):  # 为所有行添加权重
            right_panel.grid_rowconfigure(i, weight=1)
         
        # 事项详情
        self.detail_frame = ttk.LabelFrame(right_panel, text="&#9997;&#65039; 事项详情", padding=10)
        self.detail_frame.grid(row=0, column=0, sticky="nsew", pady=(0, 10))
        self.detail_frame.grid_columnconfigure(1, weight=1)
         
        # 详情标签
        self.detail_labels = {}
        fields = [
            ("事项内容", "task"),
            ("创建时间", "created_at"),
            ("截止日期", "due_date"),
            ("优先级", "priority"),
            ("分类", "category"),
            ("状态", "completed"),
            ("附件", "attachments"),
            ("链接", "links")
        ]
         
        for i, (label, _) in enumerate(fields):
            ttk.Label(self.detail_frame, text=f"{label}:").grid(row=i, column=0, sticky="w", pady=2)
            self.detail_labels[label] = ttk.Label(self.detail_frame, text="")
            self.detail_labels[label].grid(row=i, column=1, sticky="w", pady=2, padx=5)
         
        # 统计信息
        self.stats_frame = ttk.LabelFrame(right_panel, text="&#128202; 统计信息", padding=10)
        self.stats_frame.grid(row=1, column=0, sticky="nsew", pady=(0, 10))
        self.stats_frame.grid_columnconfigure(0, weight=1)
         
        # 统计信息标签
        self.stats_labels = {}
        stats = [
            ("总事项", "&#128450;&#65039;"),
            ("已完成", "&#9989;"),
            ("未完成", "&#9203;"),
            ("今日截止", "&#128197;")
        ]
         
        for i, (label, icon) in enumerate(stats):
            frame = ttk.Frame(self.stats_frame)
            frame.grid(row=i, column=0, sticky="ew", pady=2)
            frame.grid_columnconfigure(1, weight=1)
            ttk.Label(frame, text=f"{icon} {label}:").grid(row=0, column=0, sticky="w")
            self.stats_labels[label] = ttk.Label(frame, text="0")
            self.stats_labels[label].grid(row=0, column=1, sticky="e")
         
        # 筛选框
        filter_frame = ttk.LabelFrame(right_panel, text="&#128269; 筛选", padding=10)
        filter_frame.grid(row=2, column=0, sticky="nsew", pady=(0, 10))
        filter_frame.grid_columnconfigure(0, weight=1# 让筛选框可以自适应宽度
         
        # 分类筛选
        category_filter_frame = ttk.Frame(filter_frame)
        category_filter_frame.grid(row=0, column=0, sticky="ew", pady=(0, 5))
        category_filter_frame.grid_columnconfigure(1, weight=1)
         
        ttk.Label(category_filter_frame, text="分类:").grid(row=0, column=0, padx=(0, 5))
        self.filter_category_var = tk.StringVar(value="全部")
        self.filter_category = ttk.Combobox(
            category_filter_frame,
            textvariable=self.filter_category_var,
            values=["全部", "默认", "工作", "个人", "购物", "学习"],
            width=8,
            state="readonly"
        )
        self.filter_category.grid(row=0, column=1, sticky="ew")
        self.filter_category.bind('<<ComboboxSelected>>', lambda e: self.update_task_list())
         
        # 添加状态筛选
        status_filter_frame = ttk.Frame(filter_frame)
        status_filter_frame.grid(row=1, column=0, sticky="ew")
        status_filter_frame.grid_columnconfigure(1, weight=1)
         
        ttk.Label(status_filter_frame, text="状态:").grid(row=0, column=0, padx=(0, 5))
        self.filter_status_var = tk.StringVar(value="全部")
        self.filter_status = ttk.Combobox(
            status_filter_frame,
            textvariable=self.filter_status_var,
            values=["全部", "已完成", "未完成"],
            width=8,
            state="readonly"
        )
        self.filter_status.grid(row=0, column=1, sticky="ew")
        self.filter_status.bind('<<ComboboxSelected>>', lambda e: self.update_task_list())
         
        # 操作按钮
        buttons_frame = ttk.LabelFrame(right_panel, text="操作", padding=10)
        buttons_frame.grid(row=3, column=0, sticky="nsew", pady=(0, 10))
        buttons_frame.grid_columnconfigure(0, weight=1)
         
        # 添加操作按钮
        self.mark_button = ttk.Button(
            buttons_frame,
            text="&#10003; 标记完成",
            command=self.mark_complete,
            style="Accent.TButton"
        )
        self.mark_button.grid(row=0, column=0, sticky="ew", pady=2)
         
        ttk.Button(
            buttons_frame,
            text="&#128465;&#65039; 删除事项",
            command=self.delete_task,
            style="Accent.TButton"
        ).grid(row=1, column=0, sticky="ew", pady=2)
         
        ttk.Button(
            buttons_frame,
            text="&#128203; 导出事项",
            command=self.export_tasks,
            style="Accent.TButton"
        ).grid(row=2, column=0, sticky="ew", pady=2)
         
        # 排序选项
        sort_frame = ttk.LabelFrame(right_panel, text="排序方式", padding=10)
        sort_frame.grid(row=4, column=0, sticky="nsew", pady=(0, 10))
        sort_frame.grid_columnconfigure(0, weight=1)
         
        self.sort_var = tk.StringVar(value="优先级")
        self.sort_combo = ttk.Combobox(
            sort_frame,
            textvariable=self.sort_var,
            values=["优先级", "创建时间", "截止日期", "分类"],
            state="readonly"
        )
        self.sort_combo.grid(row=0, column=0, sticky="ew")
        self.sort_combo.bind('<<ComboboxSelected>>', lambda e: self.update_task_list())
         
        # 绑定事项选择事件到task_tree
        self.task_tree.bind('<<TreeviewSelect>>', self._on_tree_select)
         
        # 添加键盘上下键导航绑定
        self.task_tree.bind('<Up>', self._on_up_key)
        self.task_tree.bind('<Down>', self._on_down_key)
     
    def _setup_bindings(self):
        """设置事件绑定"""
        self.root.bind("<Configure>", self._on_window_configure)
        self.root.protocol("WM_DELETE_WINDOW", self._on_closing)
         
        # 在事项树上添加事件绑定
        self.task_tree.bind('<space>', self._on_tree_space)  # 添加空格键绑定
        self.task_tree.bind('<Delete>', self.delete_task)
        self.task_tree.bind('<Up>', self.select_previous_task)  # 添加上箭头键绑定
        self.task_tree.bind('<Down>', self.select_next_task)  # 添加下箭头键绑定
        self.task_tree.bind('<Double-1>', self._on_tree_double_click)  # 添加双击事件绑定
         
        # 创建右键菜单
        self.context_menu = tk.Menu(self.root, tearoff=0)
        self.context_menu.add_command(label="&#10003; 标记完成", command=self.mark_complete)
        self.context_menu.add_command(label="&#128465;&#65039; 删除事项", command=self.delete_task)
        self.context_menu.add_separator()
        self.context_menu.add_command(label="&#128203; 复制内容", command=self.copy_task_content)
         
        # 绑定右键菜单到事项树
        self.task_tree.bind('<Button-3>', self._show_context_menu)
         
    def _on_tree_space(self, event=None):
        """处理空格键事件"""
        selected_items = self.task_tree.selection()
        if selected_items:
            try:
                # 获取选中项的值
                item_id = selected_items[0]
                # 检查item是否存在
                if not self.task_tree.exists(item_id):
                    print(f"Item {item_id} not found.")
                    return
                values = self.task_tree.item(item_id, 'values')
                if values and len(values) > 0:
                    # 从隐藏列中获取完整的事项数据
                    task_data = json.loads(values[-1])
                    # 在原始事项列表中查找对应的事项并切换其状态
                    for task in self.model.tasks:
                        if task == task_data:
                            self.toggle_task_status(None, task)
                            break
            except (json.JSONDecodeError, IndexError) as e:
                print(f"Error processing task: {e}")
     
    def _on_tree_double_click(self, event):
        """处理双击事件"""
        item = self.task_tree.identify('item', event.x, event.y)
        if item:
            # 检查item是否存在
            if not self.task_tree.exists(item):
                print(f"Item {item} not found.")
                return
            item_index = self.task_tree.index(item)
            if 0 <= item_index < len(self.model.filtered_indices):
                try:
                    task = self.model.tasks[self.model.filtered_indices[item_index]]
                    self.toggle_task_status(None, task)
                    # 确保Treeview刷新完成
                    self.task_tree.update_idletasks()
                    # 确保在事项树中选中该事项
                    if self.task_tree.exists(item):
                        self.task_tree.selection_set(item)
                except IndexError as e:
                    print(f"Error processing task: {e}")
     
    def _show_context_menu(self, event):
        """显示右键菜单"""
        item = self.task_tree.identify('item', event.x, event.y)
        if item:
            # 选中被右键点击的项目
            self.task_tree.selection_set(item)
            # 获取事项数据
            item_index = self.task_tree.index(item)
            if 0 <= item_index < len(self.model.filtered_indices):
                # 更新选中的事项
                self.selected_task = self.model.tasks[self.model.filtered_indices[item_index]]
                # 更新菜单项文本
                button_text = "&#10003; 标记未完成" if self.selected_task["completed"] else "&#10003; 标记完成"
                self.context_menu.entryconfig(1, label=button_text)
                # 显示上下文菜单
                self.context_menu.tk_popup(event.x_root, event.y_root)
             
    def toggle_task_status(self, item=None, task=None):
        """切换事项状态
        Args:
            item: 树形视图中的项目
            task: 事项对象
        """
        target_task = None
         
        # 获取目标事项
        if task:
            target_task = task
        elif item:
            # 确保item存在
            if not self.task_tree.exists(item):
                print(f"Item {item} not found.")
                return
            values = self.task_tree.item(item, 'values')
            if values:
                task_data = json.loads(values[-1])
                for t in self.model.tasks:
                    if t == task_data:
                        target_task = t
                        break
         
        if target_task:
            # 切换事项状态
            target_task['completed'] = not target_task['completed']
            self.selected_task = target_task
             
            # 保存并更新界面
            self.model.save_tasks()
            self.update_task_list()
            self.update_stats()
            self.show_task_details()
             
            # 确保Treeview刷新完成
            self.task_tree.update_idletasks()
             
            # 重新选中事项
            for item_id in self.task_tree.get_children():
                if not self.task_tree.exists(item_id):
                    continue
                values = self.task_tree.item(item_id, 'values')
                if values and json.loads(values[-1]) == target_task:
                    self.task_tree.selection_set(item_id)
                    self.task_tree.see(item_id)
                    break
     
    def _safe_update_ui(self):
        """安全地更新UI,避免因异常导致程序崩溃"""
        try:
            self.update_task_list()
            self.update_stats()
        except Exception as e:
            print(f"UI更新出错: {e}")
 
    def _start_reminder_thread(self):
        """启动提醒线程"""
        # 添加线程锁,用于同步数据访问
        self.task_lock = threading.Lock()
        self.running = True  # 添加线程控制标志
         
        def update_progress():
            while self.running:
                try:
                    # 使用线程锁保护数据访问
                    with self.task_lock:
                        # 使用after_idle方法确保UI更新在主线程空闲时执行
                        if self.root and self.root.winfo_exists():
                            self.root.after_idle(self._safe_update_ui)
                    # 增加延迟时间,减少UI更新频率
                    time.sleep(120# 每2分钟更新一次
                except Exception as e:
                    print(f"更新进度出错: {e}")
                    # 发生错误时增加等待时间
                    time.sleep(180# 错误后等待3分钟再重试
         
        self.reminder_thread = threading.Thread(
            target=update_progress,
            daemon=True
        )
        self.reminder_thread.start()
     
    def _load_config(self):
        """加载配置文件"""
        config = FileManager.load_json("config.json")
        if config is None:
            # 如果加载失败,使用默认配置
            config = AppConfig.DEFAULT_CONFIG.copy()
            FileManager.save_json(config, "config.json")
        else:
            # 确保所有必要的配置项都存在
            for key, value in AppConfig.DEFAULT_CONFIG.items():
                config.setdefault(key, value)
        return config
     
    def _save_config(self):
        """保存配置"""
        FileManager.save_json(self.config, "config.json")
     
    def _on_window_configure(self, event):
        """窗口大小改变事件处理"""
        if event.widget == self.root:
            size = f"{self.root.winfo_width()}x{self.root.winfo_height()}"
            self.config["window_size"] = size
            self._save_config()
     
    def _on_closing(self):
        """处理窗口关闭事件,优化资源清理顺序和速度"""
        try:
            # 先禁用所有UI交互,防止用户在关闭过程中继续操作
            if self.root and self.root.winfo_exists():
                self.root.withdraw()
                self.root.update()
 
            # 立即停止后台线程,不等待其完成
            self.running = False
 
            # 使用线程来异步保存数据,避免阻塞UI
            def save_data():
                try:
                    self.model.save_tasks()
                except Exception as e:
                    print(f"保存事项数据失败: {e}", file=sys.stderr)
 
            save_thread = threading.Thread(target=save_data)
            save_thread.start()
 
            # 设置最大等待时间为0.5秒
            save_thread.join(timeout=0.5)
 
            # 快速清理UI资源
            for widget in [self.context_menu, self.entry_menu, self.task_tree]:
                try:
                    if hasattr(self, widget.__str__()) and widget:
                        widget.destroy()
                except Exception:
                    pass
 
            # 确保提醒线程停止
            if hasattr(self, 'reminder_thread') and self.reminder_thread.is_alive():
                self.reminder_thread.join(timeout=0.2)
 
            # 最后销毁主窗口
            if self.root and self.root.winfo_exists():
                self.root.destroy()
 
        except Exception as e:
            print(f"程序退出时清理资源失败: {e}", file=sys.stderr)
            # 确保窗口被销毁
            if self.root and self.root.winfo_exists():
                self.root.destroy()
     
    def _check_reminders(self):
        """检查事项提醒"""
        while True:
            try:
                today = datetime.now().strftime("%Y-%m-%d")
                for task in self.model.tasks:
                    if (not task["completed"] and
                        task["due_date"] == today and
                        not task.get("reminded", False)):
                         
                        self.root.after(0, lambda t=task: messagebox.showwarning(
                            "事项提醒",
                            f"事项「{t['task']}」将在今天截止!"
                        ))
                        task["reminded"] = True
                        self.model.save_tasks()  # 保存提醒状态
                     
                    # 添加对截止时间小于1天的事项提醒
                    due_date = datetime.strptime(task["due_date"], "%Y-%m-%d")
                    remaining_time = due_date - datetime.now()
                    if (not task["completed"] and
                        remaining_time.days == 0 and
                        remaining_time.seconds > 0 and
                        not task.get("reminded_1day", False)):
                         
                        self.root.after(0, lambda t=task: messagebox.showwarning(
                            "事项提醒",
                            f"事项「{t['task']}」将在1天内截止!"
                        ))
                        task["reminded_1day"] = True
                        self.model.save_tasks()  # 保存提醒状态
                 
                time.sleep(300)
            except Exception as e:
                print(f"提醒检查出错: {e}")
                time.sleep(60)
 
    def add_task(self):
        """修改添加事项方法"""
        task = self.task_var.get().strip()
        if task:
            current_time = datetime.now().strftime("%Y-%m-%d %H:%M")
            self.model.add_task({
                "task": task,
                "completed": False,
                "created_at": current_time,
                "priority": self.priority_var.get(),
                "due_date": self.due_date.get_date().strftime("%Y-%m-%d"),
                "category": self.category_var.get(),
                "attachments": self.current_attachments.copy(),  # 添加附件
                "links": self.current_links.copy()  # 添加链接
            })
             
            # 重置输入
            self.task_var.set("")
            self.priority_var.set("普通")
            self.current_attachments = []
            self.current_links = []
            self._update_attachment_preview()
            self._update_link_preview()
             
            self.update_task_list()
            self.update_stats()
        else:
            messagebox.showwarning("警告", "请输入事项内容!")
 
    def mark_complete(self):
        """标记事项完成/未完成"""
        if not self.selected_task:
            messagebox.showwarning("提示", "请先选择要标记的事项!")
            return
         
        # 在原始事项列表中找到对应的事项并更新状态
        for task in self.model.tasks:
            if task == self.selected_task:
                task["completed"] = not task["completed"]
                self.selected_task = task  # 更新选中的事项为最新的事项对象
                break
         
        self.model.save_tasks()
        self.update_task_list()
        self.update_stats()
        self.show_task_details()
 
    def delete_task(self, event=None):
        """删除选中的事项"""
        if not self.selected_task:
            messagebox.showinfo("提示", "请先选择要删除的事项!")
            return
         
        if messagebox.askyesno("确认删除", f"确定要删除事项「{self.selected_task['task']}」吗?"):
            self.model.tasks.remove(self.selected_task)
            self.model.save_tasks()
            self.selected_task = None
            self.selected_frame = None
            self.update_task_list()
            self.update_stats()
            self.show_task_details()
 
    def _calculate_remaining_time(self, task):
        """计算事项的剩余时间"""
        if task["completed"]:
            return "已完成"
         
        try:
            # 解析截止时间
            due_time = datetime.strptime(task["due_date"], "%Y-%m-%d")
            due_time = due_time.replace(hour=23, minute=59, second=59)
            current_time = datetime.now()
             
            # 计算时间差
            time_diff = due_time - current_time
             
            # 如果已经超时
            if time_diff.total_seconds() < 0:
                return "已超时"
             
            # 计算剩余天数和小时数
            days = time_diff.days
            hours = time_diff.seconds // 3600
             
            # 格式化显示
            if days > 0:
                if hours > 0:
                    return f"{days}天{hours}小时"
                return f"{days}天"
            elif hours > 0:
                return f"{hours}小时"
            else:
                return "不足1小时"
                 
        except Exception as e:
            print(f"计算剩余时间出错: {e}", file=sys.stderr)
            return "未知"
 
    def update_task_list(self):
        """更新事项列表显示"""
        # 保存当前选中的事项,以便更新后重新选中
        selected_task = self.selected_task
         
        # 清空现有事项
        for item in self.task_tree.get_children():
            self.task_tree.delete(item)
         
        # 配置列样式和视觉效果
        self.task_tree.column("priority", width=70, anchor="center")
         
        # 配置优先级标签样式
        self.task_tree.tag_configure("priority_高", background=AppConfig.COLORS["error"], foreground="white")
        self.task_tree.tag_configure("priority_普通", background=AppConfig.COLORS["warning"], foreground="black")
        self.task_tree.tag_configure("priority_低", background=AppConfig.COLORS["success"], foreground="white")
         
        # 配置行样式
        self.task_tree.tag_configure("evenrow", background="#f8f9fa")
        self.task_tree.tag_configure("oddrow", background="#ffffff")
         
        # 配置完成事项样式 - 使用统一的灰色背景和删除线效果
        self.task_tree.tag_configure("completed", foreground="#666666", background="#e0e0e0", font=("Microsoft YaHei UI", 10, "overstrike"))
         
        # 配置选中行样式
        self.task_tree.tag_configure("selected", background=AppConfig.COLORS["accent"], foreground="white")
         
        # 用于记录选中事项的item id
        selected_item_id = None
         
        # 应用筛选条件
        category_filter = self.filter_category_var.get()
        status_filter = self.filter_status_var.get()
         
        # 获取排序方式
        sort_by = self.sort_var.get()
         
        # 更新筛选后的索引列表
        self.model.filtered_indices = []
         
        # 创建已完成和未完成事项的列表
        completed_tasks = []
        incomplete_tasks = []
         
        # 先应用筛选条件并分类事项
        for i, task in enumerate(self.model.tasks):
            # 应用分类筛选
            if category_filter != "全部" and task["category"] != category_filter:
                continue
             
            # 应用状态筛选
            if status_filter == "已完成" and not task["completed"]:
                continue
            elif status_filter == "未完成" and task["completed"]:
                continue
             
            # 根据完成状态分类事项
            if task["completed"]:
                completed_tasks.append((i, task))
            else:
                incomplete_tasks.append((i, task))
         
        # 根据选择的排序方式对事项进行排序
        if sort_by == "优先级":
            # 优先级排序:高 > 普通 > 低
            priority_order = {"高": 0, "普通": 1, "低": 2}
            incomplete_tasks.sort(key=lambda x: priority_order[x[1]["priority"]])
            completed_tasks.sort(key=lambda x: priority_order[x[1]["priority"]])
        elif sort_by == "创建时间":
            # 创建时间排序:最新的在前面
            incomplete_tasks.sort(key=lambda x: x[1]["created_at"], reverse=True)
            completed_tasks.sort(key=lambda x: x[1]["created_at"], reverse=True)
        elif sort_by == "截止日期":
            # 截止日期排序:最近的在前面
            incomplete_tasks.sort(key=lambda x: x[1]["due_date"])
            completed_tasks.sort(key=lambda x: x[1]["due_date"])
        elif sort_by == "分类":
            # 分类排序:按字母顺序
            incomplete_tasks.sort(key=lambda x: x[1]["category"])
            completed_tasks.sort(key=lambda x: x[1]["category"])
             
        # 合并已完成和未完成事项列表,未完成事项在前面
        filtered_tasks = incomplete_tasks + completed_tasks
         
        # 更新筛选后的索引列表
        self.model.filtered_indices = [idx for idx, _ in filtered_tasks]
             
        # 遍历排序后的事项列表显示事项
        for i, (idx, task) in enumerate(filtered_tasks):
            # 设置事项标签
            tags = []
            # 首先添加completed标签,确保它的样式优先级最高
            if task["completed"]:
                tags.append("completed")
            else:
                # 只有在事项未完成时才应用交替行和优先级样式
                if i % 2:
                    tags.append("evenrow")
                else:
                    tags.append("oddrow")
                tags.append(f"priority_{task['priority']}")
             
            # 准备显示数据
            priority = task["priority"]
            status = "&#10003;" if task["completed"] else "&#9898;"
             
            # 插入事项
            item_id = self.task_tree.insert("", "end", values=(
                status,
                priority,
                task["task"],
                self._calculate_remaining_time(task),  # 修改这里,显示剩余时间
                task["category"],
                json.dumps(task)  # 将完整事项数据存储在隐藏列中
            ), tags=tags)
             
            # 如果这是之前选中的事项,记录其item id
            if selected_task and task == selected_task:
                selected_item_id = item_id
                self.selected_task = task  # 确保selected_task被更新为当前事项对象
 
        # 如果找到了之前选中的事项,重新选中它
        if selected_item_id:
            self.task_tree.selection_set(selected_item_id)
            self.task_tree.see(selected_item_id)  # 确保选中的项目可见
            self.show_task_details()  # 更新事项详情显示
             
    def _calculate_task_progress(self, task):
        """计算事项进度和状态"""
        # 如果事项已完成,直接返回完成状态
        if task.get("completed", False):
            return 100, "已完成"
         
        try:
            # 解析事项创建时间和截止时间
            created_time = datetime.strptime(task["created_at"], "%Y-%m-%d %H:%M")
            due_time = datetime.strptime(task["due_date"], "%Y-%m-%d")
            # 设置截止时间为当天结束时间
            due_time = due_time.replace(hour=23, minute=59, second=59)
             
            # 计算当前时间
            current_time = datetime.now()
             
            # 如果已经超过截止时间
            if current_time > due_time:
                return 100, "超时"
             
            # 计算总时间和已用时间
            total_time = (due_time - created_time).total_seconds()
            used_time = (current_time - created_time).total_seconds()
             
            # 计算进度百分比
            progress = min(100, int((used_time / total_time) * 100))
             
            # 根据进度返回状态
            if progress >= 90:
                return progress, "即将到期"
            elif progress >= 75:
                return progress, "进行中"
            else:
                return progress, "正常"
             
        except Exception as e:
            print(f"计算事项进度出错: {e},事项: {task['task']}", file=sys.stderr)
            return 0, "未知"
 
    def update_stats(self):
        today = datetime.now().strftime("%Y-%m-%d")
        total = len(self.model.tasks)
        completed = sum(1 for task in self.model.tasks if task["completed"])
        due_today = sum(1 for task in self.model.tasks if task["due_date"] == today)
         
        self.stats_labels["总事项"].config(text=str(total))
        self.stats_labels["已完成"].config(text=str(completed))
        self.stats_labels["未完成"].config(text=str(total - completed))
        self.stats_labels["今日截止"].config(text=str(due_today))
 
    def export_tasks(self):
        filename = f"事项清单_{datetime.now().strftime('%Y%m%d_%H%M')}.txt"
        with open(filename, "w", encoding="utf-8") as f:
            f.write("=== 待办事项清单 ===\n\n")
            for task in self.model.tasks:
                status = "&#10003;" if task["completed"] else "&#11036;"
                f.write(f"{status} {task['task']}\n")
                f.write(f"   优先级: {task['priority']}\n")
                f.write(f"   分类: {task['category']}\n")
                f.write(f"   创建时间: {task['created_at']}\n")
                f.write(f"   截止日期: {task['due_date']}\n")
                f.write("\n")
        messagebox.showinfo("成功", f"事项已导出到 {filename}")
 
    def show_task_details(self, event=None):
        """显示事项详情"""
        # 获取选中的事项项
        selected_items = self.task_tree.selection()
        if not selected_items:
            # 清空详情显示时也重置按钮文本
            self.mark_button.config(text="&#10003; 标记完成")
            for label in self.detail_labels.values():
                label.config(text="")
            self.selected_task = None  # 重置选中事项
            return
         
        # 获取选中项的事项数据
        values = self.task_tree.item(selected_items[0], 'values')
        if values:
            task_data = json.loads(values[-1])
            # 更新选中事项
            self.selected_task = task_data
             
            # 更新按钮文本
            button_text = "&#10003; 标记未完成" if self.selected_task["completed"] else "&#10003; 标记完成"
            self.mark_button.config(text=button_text)
             
            # 更新详情标签
            # 计算事项内容需要的行数
            task_content = self.selected_task["task"]
            line_count = len(task_content.split('\n'))
            # 每行预计高度为20像素,最小显示3行,最大显示10行
            content_height = max(3, min(10, line_count))
             
            # 将原来的Label替换为Text组件
            if not hasattr(self, 'task_content_text'):
                self.task_content_text = tk.Text(
                    self.detail_frame,
                    wrap=tk.WORD,
                    width=40,
                    height=content_height,
                    font=('Microsoft YaHei UI', 10),
                    background=AppConfig.COLORS["light_bg"],
                    foreground=AppConfig.COLORS["fg"]
                )
                self.task_content_text.grid(row=0, column=1, sticky="nsew", pady=2)
                 
                # 添加滚动条
                task_scrollbar = ttk.Scrollbar(self.detail_frame, orient="vertical", command=self.task_content_text.yview)
                task_scrollbar.grid(row=0, column=2, sticky="ns")
                self.task_content_text.configure(yscrollcommand=task_scrollbar.set)
            else:
                # 更新现有文本框的高度
                self.task_content_text.configure(height=content_height)
             
            # 更新文本内容
            self.task_content_text.config(state='normal')
            self.task_content_text.delete('1.0', tk.END)
            self.task_content_text.insert('1.0', self.selected_task["task"])
            self.task_content_text.config(state='disabled')
             
            self.detail_labels["创建时间"].config(text=self.selected_task["created_at"])
            self.detail_labels["截止日期"].config(text=self.selected_task["due_date"])
            self.detail_labels["优先级"].config(text=self.selected_task["priority"])
            self.detail_labels["分类"].config(text=self.selected_task["category"])
            self.detail_labels["状态"].config(
                text="已完成" if self.selected_task["completed"] else "未完成"
            )
         
        # 添加附件和链接信息(添加可点击的按钮)
        attachments = self.selected_task.get("attachments", [])
        links = self.selected_task.get("links", [])
         
        # 创建附件按钮框架
        if "attachment_frame" in self.__dict__:
            self.attachment_frame.destroy()
        self.attachment_frame = ttk.Frame(self.detail_frame)
        self.attachment_frame.grid(row=6, column=1, sticky="w", pady=2)
         
        if attachments:
            for i, attachment in enumerate(attachments):
                btn = ttk.Button(
                    self.attachment_frame,
                    text=f"&#128206; {attachment['name']}",
                    command=lambda a=attachment['path']: self.open_attachment(a),
                    style="Link.TButton"
                )
                btn.grid(row=0, column=i, padx=(0, 5))
        else:
            ttk.Label(self.attachment_frame, text="无").grid(row=0, column=0)
         
        # 创建链接按钮框架
        if "link_frame" in self.__dict__:
            self.link_frame.destroy()
        self.link_frame = ttk.Frame(self.detail_frame)
        self.link_frame.grid(row=7, column=1, sticky="w", pady=2)
         
        if links:
            for i, link in enumerate(links):
                btn = ttk.Button(
                    self.link_frame,
                    text=f"&#128279; {link['title']}",
                    command=lambda l=link: self.open_link(l['url']),
                    style="Link.TButton"
                )
                btn.grid(row=0, column=i, padx=(0, 5))
        else:
            ttk.Label(self.link_frame, text="无").grid(row=0, column=0)
 
    def show_help(self):
        """显示使用说明"""
        help_text = """&#10024; 待办事项清单 - 使用指南 &#10024;
 
基本操作
--------
1. 新建事项
   &#8226; 在输入框中输入事项内容
   &#8226; 设置优先级(高/普通/低)
   &#8226; 选择截止日期
   &#8226; 选择事项分类
   &#8226; 添加附件(支持任意文件类型)
   &#8226; 添加链接(支持网页链接)
   &#8226; 点击"添加事项"或按回车键确认
 
2. 管理事项
   &#8226; 点击事项可查看详细信息
   &#8226; 双击事项可快速标记完成/未完成
   &#8226; 右键事项可显示快捷菜单
   &#8226; 点击附件或链接可直接打开
 
快捷键
--------
&#8226; Enter     - 添加新事项
&#8226; Space     - 标记事项完成/未完成
&#8226; Delete    - 删除选中的事项
&#8226; ↑/↓       - 上下导航事项列表
 
事项筛选与排序
--------
&#8226; 按分类筛选(全部/默认/工作/个人/购物/学习)
&#8226; 按状态筛选(全部/未完成/已完成)
&#8226; 多种排序方式:
  - 优先级(高>普通>低)
  - 创建时间(最新在前)
  - 截止日期(最近在前)
  - 分类(字母顺序)
 
其他功能
--------
&#8226; 自动事项提醒
  - 事项到期当天提醒
  - 剩余时间不足1天提醒
&#8226; 进度条显示剩余时间
&#8226; 支持文件附件和网页链接
&#8226; 事项导出为文本文件
&#8226; 窗口透明度调节
&#8226; 数据自动保存
 
提示:所有数据会自动保存,程序重启后将保持上次的状态。
您可以随时添加、修改、删除事项,系统会自动处理所有更改。"""
 
        # 创建说明对话框
        dialog = tk.Toplevel(self.root)
        dialog.title("使用说明")
        dialog.geometry("480x600")
        dialog.transient(self.root)
        dialog.grab_set()
         
        # 创建文本框显示说明内容
        text = tk.Text(dialog,
                       wrap=tk.WORD,
                       padx=20,
                       pady=20,
                       font=('Microsoft YaHei UI', 10),
                       background=AppConfig.COLORS["light_bg"],
                       foreground=AppConfig.COLORS["fg"])
        text.pack(fill=tk.BOTH, expand=True)
        text.insert('1.0', help_text)
        text.config(state='disabled'# 设置为只读
         
        # 添加确定按钮
        ttk.Button(dialog,
                   text="确定",
                   command=dialog.destroy,
                   style="Accent.TButton").pack(pady=10)
 
    def _create_menu(self):
        """创建菜单栏"""
        menubar = tk.Menu(self.root)
        self.root.config(menu=menubar)
 
        # 添加视图菜单
        view_menu = tk.Menu(menubar, tearoff=0)
        view_menu.add_command(label="透明度调节", command=self.show_transparency_dialog)
        menubar.add_cascade(label="视图", menu=view_menu)
 
        # 添加帮助菜单
        help_menu = tk.Menu(menubar, tearoff=0)
        help_menu.add_command(label="使用说明", command=self.show_help)
        help_menu.add_separator()
        help_menu.add_command(label="关于", command=self.show_about)
        menubar.add_cascade(label="帮助", menu=help_menu)
 
    def show_transparency_dialog(self):
        """显示透明度调节对话框"""
        dialog = tk.Toplevel(self.root)
        dialog.title("透明度调节")
        dialog.transient(self.root)
        dialog.grab_set()
         
        # 透明度滑块
        transparency_label = ttk.Label(dialog, text="透明度:")
        transparency_label.grid(row=0, column=0, padx=5, pady=5)
         
        transparency_scale = ttk.Scale(
            dialog,
            from_=0.1,
            to=1.0,
            value=self.config.get("transparency", 1.0),
            command=self.set_transparency
        )
        transparency_scale.grid(row=0, column=1, padx=5, pady=5)
 
    def set_transparency(self, value):
        """设置窗口透明度"""
        try:
            value = float(value)
            self.root.attributes("-alpha", value)
            self.config["transparency"] = value
        except ValueError:
            pass
 
    def show_about(self):
        """显示关于对话框"""
        about_text = """&#10024; 待办事项清单 &#10024;
 
版本:待办事项清单2.0.0  (重构版)
作者:hfol  @吾爱破解论坛
发布日期:2025年3月
 
这是一个简洁而功能完善的待办事项管理工具。
它能帮助你更好地规划和管理日常事项,提高
工作效率。
 
主要特点:
&#8226; 简洁优雅的界面设计
&#8226; 事项分类与优先级管理
&#8226; 截止日期提醒功能
&#8226; 自动保存数据
&#8226; 支持导出事项列表
 
感谢使用!
"""
        # 创建关于对话框
        dialog = tk.Toplevel(self.root)
        dialog.title("关于")
        dialog.geometry("400x450")
        dialog.transient(self.root)
        dialog.grab_set()
         
        # 创建文本框显示关于信息
        text = tk.Text(dialog,
                       wrap=tk.WORD,
                       padx=20,
                       pady=20,
                       font=('Microsoft YaHei UI', 10),
                       background=AppConfig.COLORS["light_bg"],
                       foreground=AppConfig.COLORS["fg"])
        text.pack(fill=tk.BOTH, expand=True)
        text.insert('1.0', about_text)
        text.config(state='disabled'# 设置为只读
         
        # 添加确定按钮
        ttk.Button(dialog,
                   text="确定",
                   command=dialog.destroy,
                   style="Accent.TButton").pack(pady=10)
 
    def _show_context_menu(self, event):
        """显示右键菜单"""
        item = self.task_tree.identify('item', event.x, event.y)
        if item:
            # 选中被右键点击的项目
            self.task_tree.selection_set(item)
            # 获取事项数据
            values = self.task_tree.item(item)['values']
            if values:
                try:
                    # 解析事项数据
                    task_data = json.loads(values[5])
                    self.selected_task = task_data
                     
                    # 更新标记完成按钮的文本
                    self.context_menu.entryconfig(
                        0# 第一个菜单项的索引
                        label="&#11093; 取消完成" if task_data["completed"] else "&#10003; 标记完成"
                    )
                     
                    # 显示上下文菜单
                    self.context_menu.tk_popup(event.x_root, event.y_root)
                except (json.JSONDecodeError, IndexError) as e:
                    print(f"解析事项数据出错: {e}")
                finally:
                    # 确保菜单正确关闭
                    self.context_menu.grab_release()
 
    def copy_task_content(self):
        """复制事项内容到剪贴板"""
        if not self.selected_task:
            messagebox.showinfo("提示", "请先选择要复制的事项!")
            return
         
        # 复制到剪贴板
        self.root.clipboard_clear()
        self.root.clipboard_append(self.selected_task["task"])
        messagebox.showinfo("提示", "已复制事项内容到剪贴板")
 
    def show_entry_menu(self, event):
        """显示输入框右键菜单"""
        try:
            # 检查是否有选中的文本
            has_selection = self.task_entry.selection_present()
             
            # 检查剪贴板是否有内容
            try:
                clipboard = bool(self.root.clipboard_get())
            except:
                clipboard = False
             
            # 根据当前状态设置菜单项状态
            self.entry_menu.entryconfig("剪切", state="normal" if has_selection else "disabled")
            self.entry_menu.entryconfig("复制", state="normal" if has_selection else "disabled")
            self.entry_menu.entryconfig("粘贴", state="normal" if clipboard else "disabled")
             
            # 显示菜单
            self.entry_menu.post(event.x_root, event.y_root)
        except Exception as e:
            print(f"显示输入框菜单出错: {e}")
 
    def entry_menu_action(self, action):
        """处理输入框右键菜单动作"""
        try:
            if action == 'cut':
                # 剪切选中的文本
                self.root.clipboard_clear()
                self.root.clipboard_append(self.task_entry.selection_get())
                self.task_entry.delete("sel.first", "sel.last")
             
            elif action == 'copy':
                # 复制选中的文本
                self.root.clipboard_clear()
                self.root.clipboard_append(self.task_entry.selection_get())
             
            elif action == 'paste':
                # 粘贴文本
                try:
                    # 如果有选中文本,先删除
                    self.task_entry.delete("sel.first", "sel.last")
                except:
                    pass
                # 在当前光标位置插入剪贴板内容
                self.task_entry.insert("insert", self.root.clipboard_get())
             
            elif action == 'select_all':
                # 全选
                self.task_entry.select_range(0, tk.END)
                self.task_entry.icursor(tk.END)
         
        except Exception as e:
            print(f"输入框菜单操作出错: {e}")
 
    def toggle_task_status(self, event=None, task=None):
        """切换事项状态"""
        if task:
            with self.task_lock:
                task['completed'] = not task['completed']
                self.model.save_tasks()
                # 记住当前事项
                self.selected_task = task
            self.update_task_list()
            self.show_task_details()  # 更新事项详情显示
 
    def add_attachment(self):
        """添加附件"""
        # 确保附件目录存在
        attachment_dir = FileManager.get_resource_path(AppConfig.ATTACHMENT_DIR)
        os.makedirs(attachment_dir, exist_ok=True)
         
        # 选择文件
        file_path = filedialog.askopenfilename(
            title="选择附件",
            filetypes=AppConfig.SUPPORTED_ATTACHMENTS
        )
         
        if file_path:
            try:
                # 生成唯一的文件名
                file_name = os.path.basename(file_path)
                timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
                new_file_name = f"{timestamp}_{file_name}"
                new_file_path = os.path.join(attachment_dir, new_file_name)
                 
                # 复制文件到附件目录
                import shutil
                shutil.copy2(file_path, new_file_path)
                 
                # 添加到当前附件列表
                self.current_attachments.append({
                    "name": file_name,
                    "path": new_file_name
                })
                 
                # 更新预览
                self._update_attachment_preview()
                 
            except Exception as e:
                messagebox.showerror("错误", f"添加附件失败:{str(e)}")
     
    def add_link(self):
        """添加超链接"""
        dialog = tk.Toplevel(self.root)
        dialog.title("添加链接")
        dialog.transient(self.root)
        dialog.grab_set()
         
        # 链接标题
        ttk.Label(dialog, text="链接标题:").grid(row=0, column=0, padx=5, pady=5)
        title_var = tk.StringVar()
        title_entry = ttk.Entry(dialog, textvariable=title_var)
        title_entry.grid(row=0, column=1, padx=5, pady=5)
         
        # 链接地址
        ttk.Label(dialog, text="链接地址:").grid(row=1, column=0, padx=5, pady=5)
        url_var = tk.StringVar()
        url_entry = ttk.Entry(dialog, textvariable=url_var)
        url_entry.grid(row=1, column=1, padx=5, pady=5)
         
        def save_link():
            title = title_var.get().strip()
            url = url_var.get().strip()
            if title and url:
                self.current_links.append({"title": title, "url": url})
                self._update_link_preview()
                dialog.destroy()
            else:
                messagebox.showwarning("警告", "请输入链接标题和地址!")
         
        ttk.Button(dialog, text="确定", command=save_link).grid(
            row=2, column=0, columnspan=2, pady=10)
     
    def _update_attachment_preview(self):
        """更新附件预览"""
        # 清除现有预览
        if hasattr(self, 'attachment_preview_frame'):
            self.attachment_preview_frame.destroy()
         
        # 创建新的预览框架
        self.attachment_preview_frame = ttk.Frame(self.main_frame)
        self.attachment_preview_frame.grid(row=3, column=0, sticky="w", pady=(5, 0))
         
        if self.current_attachments:
            ttk.Label(self.attachment_preview_frame,
                     text="&#128206; 已添加附件:",
                     font=('Microsoft YaHei UI', 9, 'bold')).grid(  # 加粗标题
                row=0, column=0, sticky="w", pady=(0, 5))
             
            for i, filename in enumerate(self.current_attachments):
                frame = ttk.Frame(self.attachment_preview_frame)
                frame.grid(row=i+1, column=0, sticky="w", pady=2)
                 
                # 使用链接样式显示文件名
                ttk.Button(frame,
                          text=filename,
                          style="Link.TButton",
                          command=lambda f=filename: self.open_attachment(f)).grid(
                    row=0, column=0, padx=(20, 5))
                 
                # 美化删除按钮
                ttk.Button(frame,
                          text="&#10060;",
                          width=3,
                          style="Link.TButton",
                          command=lambda f=filename: self._remove_attachment(f)).grid(
                    row=0, column=1)
 
    def _update_link_preview(self):
        """更新链接预览"""
        # 清除现有预览
        if hasattr(self, 'link_preview_frame'):
            self.link_preview_frame.destroy()
         
        # 创建新的预览框架
        self.link_preview_frame = ttk.Frame(self.main_frame)
        self.link_preview_frame.grid(row=4, column=0, sticky="w", pady=(5, 0))
         
        if self.current_links:
            ttk.Label(self.link_preview_frame,
                     text="&#128279; 已添加链接:",
                     font=('Microsoft YaHei UI', 9, 'bold')).grid(  # 加粗标题
                row=0, column=0, sticky="w", pady=(0, 5))
             
            for i, link in enumerate(self.current_links):
                frame = ttk.Frame(self.link_preview_frame)
                frame.grid(row=i+1, column=0, sticky="w", pady=2)
                 
                # 使用链接样式显示链接标题
                ttk.Button(frame,
                          text=f"{link['title']}",
                          style="Link.TButton",
                          command=lambda l=link: self.open_link(l['url'])).grid(
                    row=0, column=0, padx=(20, 5))
                 
                # 显示链接地址
                ttk.Label(frame,
                         text=f"({link['url']})",
                         font=('Microsoft YaHei UI', 8),
                         foreground=AppConfig.COLORS["fg"]).grid(
                    row=0, column=1, padx=(0, 5))
                 
                # 美化删除按钮
                ttk.Button(frame,
                          text="&#10060;",
                          width=3,
                          style="Link.TButton",
                          command=lambda l=link: self._remove_link(l)).grid(
                    row=0, column=2)
 
    def _remove_attachment(self, filename):
        """删除附件"""
        self.current_attachments.remove(filename)
        self._update_attachment_preview()
 
    def _remove_link(self, link):
        """删除链接"""
        self.current_links.remove(link)
        self._update_link_preview()
 
    def open_attachment(self, attachment):
        """打开附件"""
        import os
        import platform
        import subprocess
         
        try:
            # 处理新版本(字典格式)和旧版本的附件格式
            if isinstance(attachment, dict):
                filename = attachment['path']
            else:
                filename = attachment
             
            attachment_path = os.path.join(
                FileManager.get_resource_path(AppConfig.ATTACHMENT_DIR),
                filename
            )
             
            if not os.path.exists(attachment_path):
                messagebox.showerror("错误", f"附件文件 {filename} 不存在!")
                return
             
            if platform.system() == 'Windows':
                os.startfile(attachment_path)
            elif platform.system() == 'Darwin'# macOS
                subprocess.run(['open', attachment_path])
            else# Linux
                subprocess.run(['xdg-open', attachment_path])
             
        except Exception as e:
            messagebox.showerror("错误", f"打开附件失败: {e}")
 
 
    def open_link(self, url):
        """打开超链接"""
        import webbrowser
        try:
            webbrowser.open(url)
        except Exception as e:
            messagebox.showerror("错误", f"打开链接失败: {e}")
 
    def _on_tree_select(self, event):
        """处理表格行选择事件"""
        selection = self.task_tree.selection()
        if selection:
            try:
                # 获取选中项的值
                item_id = selection[0]
                values = self.task_tree.item(item_id)['values']
                if values and len(values) >= 6:
                    # 从隐藏列获取完整的事项数据
                    task_data = json.loads(values[5])
                    # 更新选中状态
                    self.selected_task = task_data
                    # 更新事项详情
                    self.show_task_details()
                    # 确保Treeview获得焦点以接收键盘事件
                    self.task_tree.focus_set()
                else:
                    self.selected_task = None
            except (json.JSONDecodeError, IndexError):
                # 如果解析事项数据失败,重置选中状态
                self.selected_task = None
        else:
            self.selected_task = None
     
    def _on_up_key(self, event):
        """处理向上键事件"""
        selection = self.task_tree.selection()
        if selection:
            # 获取当前选中项的索引
            current_index = self.task_tree.index(selection[0])
            if current_index > 0:
                # 选择上一项
                prev_item = self.task_tree.get_children()[current_index - 1]
                self.task_tree.selection_set(prev_item)
                self.task_tree.see(prev_item)  # 确保选中项可见
        elif self.task_tree.get_children():  # 如果没有选中项但有事项
            # 选择最后一项
            last_item = self.task_tree.get_children()[-1]
            self.task_tree.selection_set(last_item)
            self.task_tree.see(last_item)
     
    def _on_down_key(self, event):
        """处理向下键事件"""
        selection = self.task_tree.selection()
        if selection:
            # 获取当前选中项的索引
            current_index = self.task_tree.index(selection[0])
            children = self.task_tree.get_children()
            if current_index < len(children) - 1:
                # 选择下一项
                next_item = children[current_index + 1]
                self.task_tree.selection_set(next_item)
                self.task_tree.see(next_item)  # 确保选中项可见
        elif self.task_tree.get_children():  # 如果没有选中项但有事项
            # 选择第一项
            first_item = self.task_tree.get_children()[0]
            self.task_tree.selection_set(first_item)
            self.task_tree.see(first_item)
     
    def _on_tree_double_click(self, event):
        """处理双击事件"""
        item = self.task_tree.identify('item', event.x, event.y)
        if item:
            # 先选中被双击的事项
            self.task_tree.selection_set(item)
            # 获取事项数据
            values = self.task_tree.item(item, 'values')
            if values and len(values) > 0:
                try:
                    # 从隐藏列中获取完整的事项数据
                    task_data = json.loads(values[-1])
                    # 在原始事项列表中查找对应的事项并切换其状态
                    for task in self.model.tasks:
                        if task == task_data:
                            self.toggle_task_status(None, task)
                            break
                except (json.JSONDecodeError, IndexError):
                    pass
     
    def _on_tree_space(self, event=None):
        """处理空格键事件"""
        selected_items = self.task_tree.selection()
        if not selected_items:
            return
             
        try:
            # 获取选中项的事项数据
            item_id = selected_items[0]
            values = self.task_tree.item(item_id, 'values')
            if not values:
                return
                 
            # 从隐藏列中获取完整的事项数据
            task_data = json.loads(values[-1])
             
            # 在原始事项列表中查找对应的事项并切换其状态
            for task in self.model.tasks:
                if task == task_data:
                    # 切换事项状态 - toggle_task_status会调用update_task_list
                    # update_task_list会处理选中状态的恢复,所以这里不需要再设置选中状态
                    self.toggle_task_status(None, task)
                    break
        except (json.JSONDecodeError, IndexError, ValueError) as e:
            print(f"处理事项状态切换时出错: {e}")
            pass
     
    def _sort_by_column(self, column):
        """按列排序事项"""
        # 获取所有事项
        tasks = []
        for item in self.task_tree.get_children():
            values = self.task_tree.item(item, 'values')
            task_data = json.loads(values[-1])
            tasks.append((values, task_data))
 
        # 分离已完成和未完成事项
        completed_tasks = [t for t in tasks if t[1]['completed']]
        incomplete_tasks = [t for t in tasks if not t[1]['completed']]
 
        # 定义排序键函数
        def get_sort_key(item):
            values, task_data = item
            if column == 'status':
                return task_data['completed']
            elif column == 'priority':
                priority_order = {'高': 0, '普通': 1, '低': 2}
                return priority_order[task_data['priority']]
            elif column == 'task':
                return task_data['task'].lower()
            elif column == 'due_date':
                return task_data['due_date']
            elif column == 'category':
                return task_data['category']
            return ''
 
        # 对未完成事项进行排序
        incomplete_tasks.sort(key=get_sort_key)
 
        # 更新显示
        for item in self.task_tree.get_children():
            self.task_tree.delete(item)
 
        # 先显示未完成事项
        for values, task_data in incomplete_tasks:
            tags = ['priority_' + task_data['priority']]
            self.task_tree.insert('', 'end', values=values, tags=tags)
 
        # 再显示已完成事项
        for values, task_data in completed_tasks:
            self.task_tree.insert('', 'end', values=values, tags=['completed'])
 
        # 更新事项详情显示
        self.show_task_details()
 
    def _on_tree_right_click(self, event):
        """处理右键点击事件"""
        # 获取点击位置的item
        item_id = self.task_tree.identify_row(event.y)
        if item_id:
            # 检查item是否存在
            if not self.task_tree.exists(item_id):
                print(f"Item {item_id} not found.")
                return
            # 选中被右键点击的行
            self.task_tree.selection_set(item_id)
            item_index = self.task_tree.index(item_id)
            if 0 <= item_index < len(self.model.filtered_indices):
                try:
                    task = self.model.tasks[self.model.filtered_indices[item_index]]
                    self._show_context_menu(event, task, None)
                except IndexError as e:
                    print(f"Error processing task: {e}")
     
    def _apply_row_style(self):
        """应用行样式,为每行添加虚线分隔"""
        # 清除交替行颜色,设置为透明
        self.task_tree.tag_configure("oddrow", background="transparent")
        self.task_tree.tag_configure("evenrow", background="transparent")
         
        # 配置行样式,添加底部虚线
        style = ttk.Style()
        style.configure("Treeview", rowheight=36, borderwidth=1, relief="solid")
     
    def select_previous_task(self, event=None):
        """选择上一个事项"""
        if not self.model.filtered_indices:
            return
         
        if not self.selected_task:
            # 如果没有选中的事项,选择最后一个事项
            last_index = self.model.filtered_indices[-1]
            last_task = self.model.tasks[last_index]
            children = self.tasks_container.winfo_children()
            if children and len(children) > 0:
                last_frame = children[-1]
                self.selected_task = last_task
                self.show_task_details()
            return
         
        # 获取当前事项在过滤后列表中的位置
        current_index = self.model.tasks.index(self.selected_task)
        try:
            current_position = self.model.filtered_indices.index(current_index)
            if current_position > 0:
                # 选择上一个事项
                prev_index = self.model.filtered_indices[current_position - 1]
                prev_task = self.model.tasks[prev_index]
                children = self.tasks_container.winfo_children()
                if children and current_position - 1 >= 0 and current_position - 1 < len(children):
                    prev_frame = children[current_position - 1]
                    self.selected_task = prev_task
                    self.show_task_details()
        except ValueError:
            pass
     
    def select_next_task(self, event=None):
        """选择下一个事项"""
        if not self.model.filtered_indices:
            return
         
        if not self.selected_task:
            # 如果没有选中的事项,选择第一个事项
            first_index = self.model.filtered_indices[0]
            first_task = self.model.tasks[first_index]
            children = self.tasks_container.winfo_children()
            if children and len(children) > 0:
                first_frame = children[0]
                self.selected_task = first_task
                self.show_task_details()
            return
         
        # 获取当前事项在过滤后列表中的位置
        current_index = self.model.tasks.index(self.selected_task)
        try:
            current_position = self.model.filtered_indices.index(current_index)
            if current_position < len(self.model.filtered_indices) - 1:
                # 选择下一个事项
                next_index = self.model.filtered_indices[current_position + 1]
                next_task = self.model.tasks[next_index]
                children = self.tasks_container.winfo_children()
                if children and current_position + 1 < len(children):
                    next_frame = children[current_position + 1]
                    self.selected_task = next_task
                    self.show_task_details()
        except ValueError:
            pass
 
    def _check_urgent_tasks(self):
        """启动时检查剩余时间不足1天的事项"""
        try:
            for task in self.model.tasks:
                if not task["completed"]:
                    due_date = datetime.strptime(task["due_date"], "%Y-%m-%d")
                    due_date = due_date.replace(hour=23, minute=59, second=59)
                    remaining_time = due_date - datetime.now()
                     
                    if remaining_time.days == 0 and remaining_time.seconds > 0:
                        messagebox.showwarning(
                            "事项提醒",
                            f"事项「{task['task']}」将在1天内截止!"
                        )
        except Exception as e:
            print(f"检查紧急事项出错: {e}", file=sys.stderr)
 
    def _create_progress_frame(self, parent, progress, style):
        """创建进度条框架"""
        frame = ttk.Frame(parent)
         
        # 创建进度条
        progress_bar = ttk.Progressbar(
            frame,
            style=style,
            length=100,
            mode='determinate',
            value=progress
        )
        progress_bar.pack(side='left', padx=(0, 5), fill='x', expand=True)
         
        # 创建百分比标签,显示整数
        progress_label = ttk.Label(
            frame,
            text=f"{int(progress)}%",
            style="Progress.TLabel"
        )
        progress_label.pack(side='right')
         
        return frame
 
def main():
    """程序入口"""
    root = tk.Tk()
    app = TodoApp(root)
    root.mainloop()
 
if __name__ == "__main__":
    main()

image.png
image.png

免费评分

参与人数 9威望 +1 吾爱币 +28 热心值 +7 收起 理由
yishujia0011 + 1 我很赞同!
geydnf + 1 + 1 我很赞同!
motuo86 + 1 + 1 谢谢@Thanks!
CoderFU + 1 我很赞同!
苏紫方璇 + 1 + 20 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
chxlawer + 1 + 1 用心讨论,共获提升!
Doublevv + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
pyjiujiu + 1 + 1 用心讨论,共获提升!
laozhang4201 + 1 + 1 我很赞同!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

skzhaixing 发表于 2025-2-28 10:18
我也做了一个成品
huangjinjia08 发表于 2025-2-28 08:41
gujunhk 发表于 2025-2-28 01:40
tohyueyun 发表于 2025-2-28 03:00
有种传统复古的感觉。给楼主点个赞
63557477 发表于 2025-2-28 07:22
给楼主点个赞
arg10 发表于 2025-2-28 08:30
厉害  支持原创
wangdeshui 发表于 2025-2-28 09:04
支持原创!
smallmouse228 发表于 2025-2-28 09:04
看着挺好用,希望打包好发下!!
zlzx01 发表于 2025-2-28 09:06
看起来不错啊
ch7115 发表于 2025-2-28 09:23
期待成品中
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-4-26 07:21

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表