增加了返回首页的功能。
This commit is contained in:
@@ -254,6 +254,17 @@ class PreviewPanel(ctk.CTkFrame):
|
||||
page_frame = ctk.CTkFrame(bottom_frame)
|
||||
page_frame.pack(side="right", padx=10, pady=10)
|
||||
|
||||
self.first_page_btn = ctk.CTkButton(
|
||||
page_frame,
|
||||
text="首页",
|
||||
command=self._first_page,
|
||||
width=70,
|
||||
height=30,
|
||||
fg_color="#1f538d",
|
||||
hover_color="#14375e"
|
||||
)
|
||||
self.first_page_btn.pack(side="left", padx=5)
|
||||
|
||||
self.prev_btn = ctk.CTkButton(
|
||||
page_frame,
|
||||
text="上一页",
|
||||
@@ -352,6 +363,7 @@ class PreviewPanel(ctk.CTkFrame):
|
||||
self.page_label.configure(text=f"第 {self.current_page}/{total_pages} 页")
|
||||
|
||||
# 更新按钮状态
|
||||
self.first_page_btn.configure(state="normal" if self.current_page > 1 else "disabled")
|
||||
self.prev_btn.configure(state="normal" if self.current_page > 1 else "disabled")
|
||||
self.next_btn.configure(state="normal" if self.current_page < total_pages else "disabled")
|
||||
|
||||
@@ -544,6 +556,12 @@ class PreviewPanel(ctk.CTkFrame):
|
||||
|
||||
threading.Thread(target=load_large_image, daemon=True).start()
|
||||
|
||||
def _first_page(self):
|
||||
"""首页"""
|
||||
if self.current_page > 1:
|
||||
# 需要重新查询数据(在主应用中处理)
|
||||
pass
|
||||
|
||||
def _prev_page(self):
|
||||
"""上一页"""
|
||||
if self.current_page > 1:
|
||||
|
||||
Reference in New Issue
Block a user