fix some display layer issue

This commit is contained in:
Zichao Lin 2024-06-22 23:28:59 +08:00
parent 291db1828c
commit 9ba1335546
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB

@ -185,7 +185,7 @@ def open_settings():
update_history_list() update_history_list()
def add_id(): def add_id():
new_id = simpledialog.askstring("新增学号", "请输入新的学号:") new_id = simpledialog.askstring("新增学号", "请输入新的学号:", parent=settings_window)
if new_id: if new_id:
if new_id.isdigit(): if new_id.isdigit():
new_id = int(new_id) new_id = int(new_id)
@ -197,6 +197,7 @@ def open_settings():
messagebox.showerror("错误", f"学号必须在 {min_id}{max_id} 之间") messagebox.showerror("错误", f"学号必须在 {min_id}{max_id} 之间")
else: else:
messagebox.showerror("错误", "请输入有效的学号") messagebox.showerror("错误", "请输入有效的学号")
settings_window.focus_force()
def delete_id(): def delete_id():
selected = history_list.curselection() selected = history_list.curselection()
@ -210,6 +211,7 @@ def open_settings():
history_list.select_set(index - 1) history_list.select_set(index - 1)
else: else:
messagebox.showerror("错误", "请选择一个学号进行删除") messagebox.showerror("错误", "请选择一个学号进行删除")
settings_window.focus_force()
def edit_id(): def edit_id():
selected = history_list.curselection() selected = history_list.curselection()
@ -217,7 +219,7 @@ def open_settings():
index = selected[0] index = selected[0]
current_id, _ = temp_selected_ids[index] current_id, _ = temp_selected_ids[index]
new_id = simpledialog.askstring( new_id = simpledialog.askstring(
"修改学号", "请输入新的学号:", initialvalue=str(current_id) "修改学号", "请输入新的学号:", initialvalue=str(current_id), parent=settings_window
) )
if new_id: if new_id:
if new_id.isdigit(): if new_id.isdigit():
@ -233,6 +235,7 @@ def open_settings():
messagebox.showerror("错误", "请输入有效的学号") messagebox.showerror("错误", "请输入有效的学号")
else: else:
messagebox.showerror("错误", "请选择一个学号进行修改") messagebox.showerror("错误", "请选择一个学号进行修改")
settings_window.focus_force()
def clear_all_ids(): def clear_all_ids():
global temp_selected_ids global temp_selected_ids