更新 ui/task/subfolder_editor.py
This commit is contained in:
@@ -5,6 +5,7 @@ Node Editor Module
|
||||
-----------------
|
||||
A canvas-based node editor for creating and managing folder structures.
|
||||
"""
|
||||
import os
|
||||
import tkinter as tk
|
||||
import customtkinter as ctk
|
||||
import time
|
||||
@@ -1029,8 +1030,10 @@ class NodeEditor(tk.Canvas):
|
||||
|
||||
# 居中显示
|
||||
dialog.update_idletasks()
|
||||
x = (dialog.winfo_screenwidth() // 2) - (400 // 2)
|
||||
y = (dialog.winfo_screenheight() // 2) - (180 // 2)
|
||||
# 从常量中解析宽度和高度
|
||||
width, height = map(int, DIALOG_NODE_RENAME_SIZE.split('x'))
|
||||
x = (dialog.winfo_screenwidth() // 2) - (width // 2)
|
||||
y = (dialog.winfo_screenheight() // 2) - (height // 2)
|
||||
dialog.geometry(f"{DIALOG_NODE_RENAME_SIZE}+{x}+{y}")
|
||||
|
||||
# 设置深色标题栏和图标的组合函数
|
||||
@@ -1051,39 +1054,31 @@ class NodeEditor(tk.Canvas):
|
||||
dialog.after(100, lambda: dialog.iconbitmap(icon_path) if os.path.exists(icon_path) else None)
|
||||
dialog.after(200, lambda: dialog.iconbitmap(icon_path) if os.path.exists(icon_path) else None)
|
||||
|
||||
# 主框架
|
||||
main_frame = ctk.CTkFrame(dialog, fg_color=DIALOG_BG_COLOR)
|
||||
main_frame.pack(fill="both", expand=True, padx=0, pady=0)
|
||||
|
||||
# 内容框架
|
||||
content_frame = ctk.CTkFrame(main_frame, fg_color="transparent")
|
||||
content_frame.pack(fill="both", expand=True, padx=20, pady=20)
|
||||
|
||||
# 标签
|
||||
label = ctk.CTkLabel(
|
||||
content_frame,
|
||||
dialog,
|
||||
text="新名称:",
|
||||
font=("Segoe UI", 12),
|
||||
text_color=DIALOG_TEXT_COLOR
|
||||
)
|
||||
label.pack(pady=(10, 5))
|
||||
label.pack(pady=(30, 10))
|
||||
|
||||
# 输入框
|
||||
name_var = tk.StringVar(value=self.selected_node.name)
|
||||
entry = ctk.CTkEntry(
|
||||
content_frame,
|
||||
dialog,
|
||||
textvariable=name_var,
|
||||
font=("Segoe UI", 12),
|
||||
width=350,
|
||||
height=35
|
||||
)
|
||||
entry.pack(pady=5)
|
||||
entry.pack(pady=(0, 20))
|
||||
entry.select_range(0, 'end')
|
||||
entry.focus_set()
|
||||
|
||||
# 按钮框架
|
||||
button_frame = ctk.CTkFrame(main_frame, fg_color="transparent")
|
||||
button_frame.pack(pady=(0, 15))
|
||||
button_frame = ctk.CTkFrame(dialog, fg_color="transparent")
|
||||
button_frame.pack(pady=(0, 20))
|
||||
|
||||
def on_ok():
|
||||
new_name = name_var.get().strip()
|
||||
|
||||
Reference in New Issue
Block a user