From 3459521594855bc30d4158de3ef213dd0f41dc2a Mon Sep 17 00:00:00 2001 From: benya Date: Tue, 24 Feb 2026 22:42:19 +0300 Subject: [PATCH] Polish settings UI layout and spacing --- main.py | 113 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 64 insertions(+), 49 deletions(-) diff --git a/main.py b/main.py index 2c3cb4f..0a3f1cc 100644 --- a/main.py +++ b/main.py @@ -360,20 +360,17 @@ class BackgroundFileCopyApp: title_label.pack(pady=8) toolbar = ttk.Frame(settings_tab) - toolbar.pack(fill=tk.X, pady=4) + toolbar.pack(fill=tk.X, pady=2) toolbar_row1 = ttk.Frame(toolbar) - toolbar_row1.pack(fill=tk.X, pady=2) + toolbar_row1.pack(fill=tk.X, pady=1) toolbar_row2 = ttk.Frame(toolbar) - toolbar_row2.pack(fill=tk.X, pady=2) + toolbar_row2.pack(fill=tk.X, pady=1) ttk.Button(toolbar_row1, text="➕ Добавить", command=self.add_path_pair).pack(side=tk.LEFT, padx=4) ttk.Button(toolbar_row1, text="❌ Удалить", command=self.remove_selected_pair).pack(side=tk.LEFT, padx=4) ttk.Button(toolbar_row1, text="📂 Источник", command=lambda: self.pick_folder_for_item(self.selected_pair_id, "source", "Выберите папку источника")).pack(side=tk.LEFT, padx=4) ttk.Button(toolbar_row1, text="📂 Назначение", command=lambda: self.pick_folder_for_item(self.selected_pair_id, "dest", "Выберите папку назначения")).pack(side=tk.LEFT, padx=4) - ttk.Button(toolbar_row1, text="▶ Запустить", command=self.start_manual_copy).pack(side=tk.LEFT, padx=4) - ttk.Button(toolbar_row1, text="⏹ Остановить", command=self.stop_copying).pack(side=tk.LEFT, padx=4) - ttk.Button(toolbar_row1, text="💾 Сохранить", command=self.check_and_save).pack(side=tk.LEFT, padx=4) self.search_var = tk.StringVar(value="") self.filter_status_var = tk.StringVar(value="Все") @@ -412,7 +409,12 @@ class BackgroundFileCopyApp: schedule_frame = ttk.LabelFrame(settings_tab, text="Расписание и поведение", padding="10") schedule_frame.pack(fill=tk.X, pady=5) - time_frame = ttk.Frame(schedule_frame) + scheduler_box = ttk.LabelFrame(schedule_frame, text="Планировщик", padding="8") + scheduler_box.pack(fill=tk.X, pady=(0, 6)) + behavior_box = ttk.LabelFrame(schedule_frame, text="Параметры копирования", padding="8") + behavior_box.pack(fill=tk.X) + + time_frame = ttk.Frame(scheduler_box) time_frame.pack(fill=tk.X, pady=5) self.hour_var = tk.StringVar(value="03") @@ -429,19 +431,19 @@ class BackgroundFileCopyApp: font=("Arial", 9, "italic")) self.scheduler_status.pack(side=tk.LEFT, padx=10) - schedule_summary_frame = ttk.Frame(schedule_frame) + schedule_summary_frame = ttk.Frame(scheduler_box) schedule_summary_frame.pack(fill=tk.X, pady=4) self.schedule_summary_label = ttk.Label(schedule_summary_frame, text="Расписание: —") self.schedule_summary_label.pack(side=tk.LEFT) ttk.Button(schedule_summary_frame, text="Расписание...", command=self.open_schedule_dialog).pack(side=tk.LEFT, padx=8) - options_frame = ttk.Frame(schedule_frame) + options_frame = ttk.Frame(behavior_box) options_frame.pack(fill=tk.X, pady=5) options_row1 = ttk.Frame(options_frame) - options_row1.pack(fill=tk.X, pady=2) + options_row1.pack(fill=tk.X, pady=3) options_row2 = ttk.Frame(options_frame) - options_row2.pack(fill=tk.X, pady=2) + options_row2.pack(fill=tk.X, pady=3) self.autostart_check = ttk.Checkbutton( options_row1, @@ -449,64 +451,75 @@ class BackgroundFileCopyApp: variable=self.autostart_enabled, command=self.toggle_autostart ) - self.autostart_check.pack(side=tk.LEFT) - - ttk.Button(options_row1, text="?", width=2, - command=lambda: self.show_hint("Автозапуск", - "Добавляет программу в автозапуск Windows.")).pack(side=tk.LEFT, padx=4) - + autostart_help = ttk.Button( + options_row1, + text="?", + width=2, + command=lambda: self.show_hint("Автозапуск", "Добавляет программу в автозапуск Windows.") + ) self.minimize_check = ttk.Checkbutton( options_row1, text="Сворачивать в трей при закрытии", variable=self.minimize_to_tray_enabled ) - self.minimize_check.pack(side=tk.LEFT, padx=10) + minimize_help = ttk.Button( + options_row1, + text="?", + width=2, + command=lambda: self.show_hint("Сворачивание", "По крестику окно скрывается в трей.") + ) - ttk.Button(options_row1, text="?", width=2, - command=lambda: self.show_hint("Сворачивание", - "По крестику окно скрывается в трей.")).pack(side=tk.LEFT, padx=4) + self.autostart_check.grid(row=0, column=0, sticky="w", padx=(0, 4)) + autostart_help.grid(row=0, column=1, sticky="w", padx=(0, 12)) + self.minimize_check.grid(row=0, column=2, sticky="w", padx=(0, 4)) + minimize_help.grid(row=0, column=3, sticky="w") self.verify_check = ttk.Checkbutton( options_row2, text="Только проверка (без копирования)", variable=self.verify_only ) - self.verify_check.pack(side=tk.LEFT) - - ttk.Button(options_row2, text="?", width=2, - command=lambda: self.show_hint("Проверка", - "Проверяет совпадение контрольных сумм без копирования.")).pack(side=tk.LEFT, padx=4) - + verify_help = ttk.Button( + options_row2, + text="?", + width=2, + command=lambda: self.show_hint("Проверка", "Проверяет совпадение контрольных сумм без копирования.") + ) self.cleanup_check = ttk.Checkbutton( options_row2, text="Удалять старые файлы в назначении", variable=self.cleanup_old_var, command=self.on_cleanup_toggle ) - self.cleanup_check.pack(side=tk.LEFT, padx=10) + cleanup_help = ttk.Button( + options_row2, + text="?", + width=2, + command=lambda: self.show_hint("Очистка", "В режиме 'последний файл' удаляет старые файлы в папке назначения.") + ) - ttk.Button(options_row2, text="?", width=2, - command=lambda: self.show_hint("Очистка", - "В режиме 'последний файл' удаляет старые файлы в папке назначения.")).pack(side=tk.LEFT, padx=4) + self.verify_check.grid(row=0, column=0, sticky="w", padx=(0, 4)) + verify_help.grid(row=0, column=1, sticky="w", padx=(0, 12)) + self.cleanup_check.grid(row=0, column=2, sticky="w", padx=(0, 4)) + cleanup_help.grid(row=0, column=3, sticky="w") - ttk.Label(options_row2, text="Хранить последних:").pack(side=tk.LEFT, padx=(10, 4)) - self.keep_files_spin = ttk.Spinbox(options_row2, from_=1, to=999, width=4, textvariable=self.keep_files_var) - self.keep_files_spin.pack(side=tk.LEFT) + perf_frame = ttk.Frame(behavior_box) + perf_frame.pack(fill=tk.X, pady=4) + ttk.Label(perf_frame, text="Мин. свободно, ГБ:", width=20, anchor=tk.W).pack(side=tk.LEFT) + self.min_free_entry = ttk.Entry(perf_frame, textvariable=self.min_free_gb_var, width=6) + self.min_free_entry.pack(side=tk.LEFT, padx=(2, 6)) + self.min_free_entry.bind("", lambda _e: self.request_autosave()) + ttk.Label(perf_frame, text="Параллельных потоков:", width=23, anchor=tk.W).pack(side=tk.LEFT, padx=(4, 0)) + self.max_workers_entry = ttk.Entry(perf_frame, textvariable=self.max_workers_var, width=4) + self.max_workers_entry.pack(side=tk.LEFT, padx=(2, 6)) + self.max_workers_entry.bind("", lambda _e: self.request_autosave()) + ttk.Label(perf_frame, text="Хранить последних:", width=19, anchor=tk.W).pack(side=tk.LEFT, padx=(4, 0)) + self.keep_files_spin = ttk.Spinbox(perf_frame, from_=1, to=999, width=4, textvariable=self.keep_files_var) + self.keep_files_spin.pack(side=tk.LEFT, padx=(2, 0)) self.keep_files_spin.bind("", lambda _e: self.request_autosave()) self.keep_files_spin.bind("", lambda _e: self.request_autosave()) - perf_frame = ttk.Frame(schedule_frame) - perf_frame.pack(fill=tk.X, pady=4) - ttk.Label(perf_frame, text="Мин. свободно, ГБ:").pack(side=tk.LEFT) - self.min_free_entry = ttk.Entry(perf_frame, textvariable=self.min_free_gb_var, width=6) - self.min_free_entry.pack(side=tk.LEFT, padx=4) - self.min_free_entry.bind("", lambda _e: self.request_autosave()) - ttk.Label(perf_frame, text="Параллельных потоков:").pack(side=tk.LEFT, padx=8) - self.max_workers_entry = ttk.Entry(perf_frame, textvariable=self.max_workers_var, width=4) - self.max_workers_entry.pack(side=tk.LEFT, padx=4) - self.max_workers_entry.bind("", lambda _e: self.request_autosave()) - - masks_frame = ttk.Frame(schedule_frame) + masks_frame = ttk.Frame(behavior_box) masks_frame.pack(fill=tk.X, pady=4) ttk.Label(masks_frame, text="Включать маски:").pack(side=tk.LEFT) self.include_entry = ttk.Entry(masks_frame, textvariable=self.include_masks_var) @@ -518,15 +531,17 @@ class BackgroundFileCopyApp: self.exclude_entry.bind("", lambda _e: self.request_autosave()) ttk.Button(masks_frame, text="Шаблоны", command=self.show_mask_templates).pack(side=tk.LEFT, padx=6) - buttons_frame = ttk.Frame(schedule_frame) + buttons_frame = ttk.Frame(behavior_box) buttons_frame.pack(fill=tk.X, pady=5) ttk.Button(buttons_frame, text="🧭 Мастер настройки", command=self.open_wizard).pack(side=tk.LEFT, padx=5) - ttk.Button(buttons_frame, text="💾 Сохранить", - command=self.check_and_save).pack(side=tk.LEFT, padx=5) ttk.Button(buttons_frame, text="▶ Запустить сейчас", command=self.start_manual_copy).pack(side=tk.LEFT, padx=5) + ttk.Button(buttons_frame, text="⏹ Остановить", + command=self.stop_copying).pack(side=tk.LEFT, padx=5) + ttk.Button(buttons_frame, text="💾 Сохранить", + command=self.check_and_save).pack(side=tk.LEFT, padx=5) paths_frame = ttk.LabelFrame(settings_tab, text="Пары копирования", padding="10") paths_frame.pack(fill=tk.BOTH, expand=True, pady=5)