parent
9c712d6310
commit
70d0e42fcd
@ -0,0 +1,77 @@
|
||||
import customtkinter as ctk
|
||||
|
||||
class TodoScheduleComponent:
|
||||
"""待办日程组件"""
|
||||
def __init__(self, parent_frame, app):
|
||||
self.parent_frame = parent_frame
|
||||
self.app = app
|
||||
self.todo_schedule_frame = None
|
||||
self.content_frame = None # 用于显示待办/日程/日志内容的框架
|
||||
|
||||
def _create_todo_schedule_interface(self):
|
||||
"""创建待办日程界面"""
|
||||
if self.todo_schedule_frame is None:
|
||||
self.todo_schedule_frame = ctk.CTkFrame(self.parent_frame, fg_color="#1e1e1e")
|
||||
|
||||
# 创建左侧按钮区域
|
||||
left_frame = ctk.CTkFrame(self.todo_schedule_frame, fg_color="#1e1e1e")
|
||||
left_frame.pack(side="left", fill="y", padx=10, pady=10)
|
||||
|
||||
# 创建待办按钮
|
||||
todo_btn = ctk.CTkButton(
|
||||
left_frame,
|
||||
text="我的待办",
|
||||
command=lambda: self.app.todo_manager.show_todos(self.content_frame),
|
||||
corner_radius=8,
|
||||
fg_color="#005a9e",
|
||||
hover_color="#004a80",
|
||||
width=150,
|
||||
height=40,
|
||||
font=ctk.CTkFont(family="Microsoft YaHei UI", size=14)
|
||||
)
|
||||
todo_btn.pack(pady=10, padx=10)
|
||||
|
||||
# 创建日程按钮
|
||||
schedule_btn = ctk.CTkButton(
|
||||
left_frame,
|
||||
text="我的日程",
|
||||
command=lambda: self.app.schedule_manager.show_schedules(self.content_frame),
|
||||
corner_radius=8,
|
||||
fg_color="#0078d4",
|
||||
hover_color="#106ebe",
|
||||
width=150,
|
||||
height=40,
|
||||
font=ctk.CTkFont(family="Microsoft YaHei UI", size=14)
|
||||
)
|
||||
schedule_btn.pack(pady=10, padx=10)
|
||||
|
||||
|
||||
|
||||
# 创建右侧内容显示区域
|
||||
self.content_frame = ctk.CTkFrame(self.todo_schedule_frame, fg_color="#1e1e1e")
|
||||
self.content_frame.pack(side="right", fill="both", expand=True, padx=10, pady=10)
|
||||
|
||||
def clear_content(self):
|
||||
"""清空内容显示区域"""
|
||||
if self.content_frame:
|
||||
for widget in self.content_frame.winfo_children():
|
||||
widget.destroy()
|
||||
|
||||
def get_content_frame(self):
|
||||
"""获取内容显示区域框架"""
|
||||
self._create_todo_schedule_interface() # 确保框架已创建
|
||||
return self.content_frame
|
||||
|
||||
def get_todo_schedule_frame(self):
|
||||
"""获取待办日程帧"""
|
||||
return self.todo_schedule_frame
|
||||
|
||||
def show(self):
|
||||
"""显示待办日程界面"""
|
||||
self._create_todo_schedule_interface()
|
||||
self.todo_schedule_frame.pack(side="left", fill="both", expand=True, padx=(5, 0))
|
||||
|
||||
def hide(self):
|
||||
"""隐藏待办日程界面"""
|
||||
if self.todo_schedule_frame:
|
||||
self.todo_schedule_frame.pack_forget()
|
||||
Loading…
Reference in new issue