fix(ui): Testlauf-Button nach inkrementeller Berechnung freigeben
Der Button für den Testlauf wurde nicht freigegeben, wenn die inkrementelle Berechnung abgeschlossen war. Dies wurde behoben, indem der Status des Buttons in der UI-Refresh-Funktion korrekt gesetzt wird. fix(logging): Logger früher initialisieren Der Logger wurde zu spät initialisiert, was dazu führte, dass einige Log-Meldungen auf der Konsole statt im Log-Fenster ausgegeben wurden. Die Initialisierung wurde vorgezogen, um alle Meldungen abzufangen. refactor: Variablen umbenennen Einige Variablen wurden für eine bessere Lesbarkeit und Konsistenz im gesamten Code umbenannt (z.B. `testlauf_var` zu `test_run_var`).
This commit is contained in:
25
main_app.py
25
main_app.py
@@ -52,9 +52,11 @@ class MainApplication(tk.Tk):
|
||||
|
||||
self.style.configure("Green.Sidebar.TButton", foreground="green")
|
||||
|
||||
self.style.configure("Switch2.TCheckbutton", background="#2b3e4f", foreground="white")
|
||||
self.style.configure("Switch2.TCheckbutton",
|
||||
background="#2b3e4f", foreground="white")
|
||||
self.style.map("Switch2.TCheckbutton",
|
||||
background=[("active", "#2b3e4f"), ("selected", "#2b3e4f"), ("disabled", "#2b3e4f")],
|
||||
background=[("active", "#2b3e4f"), ("selected",
|
||||
"#2b3e4f"), ("disabled", "#2b3e4f")],
|
||||
foreground=[("active", "white"), ("selected", "white"), ("disabled", "#737373")])
|
||||
|
||||
main_frame = ttk.Frame(self)
|
||||
@@ -79,6 +81,8 @@ class MainApplication(tk.Tk):
|
||||
self.content_frame.grid_rowconfigure(6, weight=0)
|
||||
self.content_frame.grid_columnconfigure(0, weight=1)
|
||||
|
||||
self._setup_log_window()
|
||||
|
||||
self.backup_manager = BackupManager(app_logger, self)
|
||||
self.queue = Queue()
|
||||
|
||||
@@ -93,10 +97,10 @@ class MainApplication(tk.Tk):
|
||||
self.navigation = Navigation(self)
|
||||
self.actions = Actions(self)
|
||||
|
||||
self.vollbackup_var = tk.BooleanVar()
|
||||
self.full_backup_var = tk.BooleanVar()
|
||||
self.inkrementell_var = tk.BooleanVar()
|
||||
self.genaue_berechnung_var = tk.BooleanVar()
|
||||
self.testlauf_var = tk.BooleanVar()
|
||||
self.test_run_var = tk.BooleanVar()
|
||||
self.compressed_var = tk.BooleanVar()
|
||||
self.encrypted_var = tk.BooleanVar()
|
||||
self.bypass_security_var = tk.BooleanVar()
|
||||
@@ -168,7 +172,7 @@ class MainApplication(tk.Tk):
|
||||
self.settings_button.pack(fill=tk.X, pady=10)
|
||||
|
||||
self.test_run_cb = ttk.Checkbutton(self.sidebar_buttons_frame, text=Msg.STR["test_run"],
|
||||
variable=self.testlauf_var, style="Switch2.TCheckbutton")
|
||||
variable=self.test_run_var, style="Switch2.TCheckbutton")
|
||||
self.test_run_cb.pack(fill=tk.X, pady=10)
|
||||
self.bypass_security_cb = ttk.Checkbutton(self.sidebar_buttons_frame, text=Msg.STR["bypass_security"],
|
||||
variable=self.bypass_security_var, style="Switch2.TCheckbutton")
|
||||
@@ -245,7 +249,6 @@ class MainApplication(tk.Tk):
|
||||
self.right_canvas.bind(
|
||||
"<Button-1>", self.actions.on_right_canvas_click)
|
||||
|
||||
self._setup_log_window()
|
||||
self._setup_scheduler_frame()
|
||||
self._setup_settings_frame()
|
||||
self._setup_backup_content_frame()
|
||||
@@ -373,8 +376,6 @@ class MainApplication(tk.Tk):
|
||||
if hasattr(self, 'header_frame'):
|
||||
self.header_frame.refresh_status()
|
||||
|
||||
|
||||
|
||||
restore_src_path = self.config_manager.get_setting(
|
||||
"restore_source_path")
|
||||
if restore_src_path and os.path.isdir(restore_src_path):
|
||||
@@ -470,7 +471,7 @@ class MainApplication(tk.Tk):
|
||||
accurate_size_frame.pack(side=tk.LEFT, padx=20)
|
||||
|
||||
self.accurate_size_btn = ttk.Button(accurate_size_frame, text=Msg.STR["accurate_size_cb_label"],
|
||||
command=self.actions.on_accurate_size_calc)
|
||||
command=self.actions.on_accurate_size_calc)
|
||||
self.accurate_size_btn.pack(side=tk.LEFT, padx=5)
|
||||
|
||||
accurate_size_info_label = ttk.Label(
|
||||
@@ -481,7 +482,7 @@ class MainApplication(tk.Tk):
|
||||
checkbox_frame.pack(fill=tk.X, pady=5)
|
||||
|
||||
self.full_backup_cb = ttk.Checkbutton(checkbox_frame, text=Msg.STR["full_backup"],
|
||||
variable=self.vollbackup_var, command=lambda: self.actions.handle_backup_type_change('voll'), style="Switch.TCheckbutton")
|
||||
variable=self.full_backup_var, command=lambda: self.actions.handle_backup_type_change('voll'), style="Switch.TCheckbutton")
|
||||
self.full_backup_cb.pack(side=tk.LEFT, padx=5)
|
||||
self.incremental_cb = ttk.Checkbutton(checkbox_frame, text=Msg.STR["incremental"],
|
||||
variable=self.inkrementell_var, command=lambda: self.actions.handle_backup_type_change('inkrementell'), style="Switch.TCheckbutton")
|
||||
@@ -786,12 +787,12 @@ class MainApplication(tk.Tk):
|
||||
"force_incremental_backup", False)
|
||||
|
||||
if force_full:
|
||||
self.vollbackup_var.set(True)
|
||||
self.full_backup_var.set(True)
|
||||
self.inkrementell_var.set(False)
|
||||
self.full_backup_cb.config(state="disabled")
|
||||
self.incremental_cb.config(state="disabled")
|
||||
elif force_incremental:
|
||||
self.vollbackup_var.set(False)
|
||||
self.full_backup_var.set(False)
|
||||
self.inkrementell_var.set(True)
|
||||
self.full_backup_cb.config(state="disabled")
|
||||
self.incremental_cb.config(state="disabled")
|
||||
|
||||
@@ -20,10 +20,10 @@ class Actions:
|
||||
|
||||
def _set_backup_type(self, backup_type: str):
|
||||
if backup_type == "full":
|
||||
self.app.vollbackup_var.set(True)
|
||||
self.app.full_backup_var.set(True)
|
||||
self.app.inkrementell_var.set(False)
|
||||
elif backup_type == "incremental":
|
||||
self.app.vollbackup_var.set(False)
|
||||
self.app.full_backup_var.set(False)
|
||||
self.app.inkrementell_var.set(True)
|
||||
|
||||
def _update_backup_type_controls(self):
|
||||
@@ -33,7 +33,7 @@ class Actions:
|
||||
if not is_system_backup:
|
||||
self.app.full_backup_cb.config(state='normal')
|
||||
self.app.incremental_cb.config(state='normal')
|
||||
else: # System backup
|
||||
else: # System backup
|
||||
self.app.full_backup_cb.config(state='normal')
|
||||
self.app.incremental_cb.config(state='normal')
|
||||
|
||||
@@ -53,7 +53,7 @@ class Actions:
|
||||
return
|
||||
|
||||
is_encrypted = self.app.encrypted_var.get()
|
||||
|
||||
|
||||
profile_name = "system" if is_system_backup else source_name
|
||||
|
||||
full_backup_exists = self.app.backup_manager.check_for_full_backup(
|
||||
@@ -73,21 +73,27 @@ class Actions:
|
||||
self.app.incremental_cb.config(state="normal")
|
||||
self.app.compressed_cb.config(state="normal")
|
||||
self.app.encrypted_cb.config(state="normal")
|
||||
self.app.test_run_cb.config(state="normal")
|
||||
self.app.accurate_size_btn.config(state="normal")
|
||||
|
||||
# Apply specific logic based on current states
|
||||
if self.app.compressed_var.get():
|
||||
self.app.inkrementell_var.set(False) # If compressed, cannot be incremental
|
||||
self.app.vollbackup_var.set(True) # Force full if compressed
|
||||
# If compressed, cannot be incremental
|
||||
self.app.inkrementell_var.set(False)
|
||||
self.app.full_backup_var.set(True) # Force full if compressed
|
||||
self.app.incremental_cb.config(state="disabled")
|
||||
self.app.encrypted_var.set(False) # If compressed, cannot be encrypted
|
||||
# If compressed, cannot be encrypted
|
||||
self.app.encrypted_var.set(False)
|
||||
self.app.encrypted_cb.config(state="disabled")
|
||||
self.app.accurate_size_btn.config(state="disabled") # Accurate size not applicable for compressed
|
||||
# Accurate size not applicable for compressed
|
||||
self.app.accurate_size_btn.config(state="disabled")
|
||||
elif self.app.encrypted_var.get():
|
||||
self.app.compressed_var.set(False) # If encrypted, cannot be compressed
|
||||
# If encrypted, cannot be compressed
|
||||
self.app.compressed_var.set(False)
|
||||
self.app.compressed_cb.config(state="disabled")
|
||||
elif self.app.inkrementell_var.get():
|
||||
self.app.compressed_var.set(False) # If incremental, cannot be compressed
|
||||
# If incremental, cannot be compressed
|
||||
self.app.compressed_var.set(False)
|
||||
self.app.compressed_cb.config(state="disabled")
|
||||
|
||||
# Update backup type controls (full/incremental) based on current state
|
||||
@@ -95,7 +101,7 @@ class Actions:
|
||||
|
||||
def handle_backup_type_change(self, changed_var_name):
|
||||
if changed_var_name == 'voll':
|
||||
if self.app.vollbackup_var.get():
|
||||
if self.app.full_backup_var.get():
|
||||
self._set_backup_type("full")
|
||||
elif changed_var_name == 'inkrementell':
|
||||
if self.app.inkrementell_var.get():
|
||||
@@ -149,7 +155,7 @@ class Actions:
|
||||
is_system = (button_text == "Computer")
|
||||
source_name = "system" if is_system else button_text
|
||||
is_encrypted = self.app.encrypted_var.get()
|
||||
|
||||
|
||||
exclude_files = []
|
||||
if AppConfig.GENERATED_EXCLUDE_LIST_PATH.exists():
|
||||
exclude_files.append(AppConfig.GENERATED_EXCLUDE_LIST_PATH)
|
||||
@@ -352,7 +358,7 @@ class Actions:
|
||||
size_str = f"{used / (1024**3):.2f} GB / {total / (1024**3):.2f} GB"
|
||||
|
||||
self.app.right_canvas_data.update({
|
||||
'folder': os.path.basename(path.rstrip('/')),
|
||||
'folder': os.path.basename(path.rstrip('/')),
|
||||
'path_display': path,
|
||||
'size': size_str
|
||||
})
|
||||
@@ -368,7 +374,7 @@ class Actions:
|
||||
|
||||
elif self.app.mode == "restore":
|
||||
self.app.right_canvas_data.update({
|
||||
'folder': os.path.basename(path.rstrip('/')),
|
||||
'folder': os.path.basename(path.rstrip('/')),
|
||||
'path_display': path,
|
||||
'size': ''
|
||||
})
|
||||
@@ -383,8 +389,7 @@ class Actions:
|
||||
title=Msg.STR["error"], text=Msg.STR["path_not_found"].format(path=path)).show()
|
||||
|
||||
def reset_to_default_settings(self):
|
||||
|
||||
|
||||
|
||||
self.app.config_manager.set_setting("backup_destination_path", None)
|
||||
self.app.config_manager.set_setting("restore_source_path", None)
|
||||
self.app.config_manager.set_setting("restore_destination_path", None)
|
||||
@@ -599,7 +604,7 @@ class Actions:
|
||||
|
||||
if source_folder == "Computer":
|
||||
self.app.last_backup_was_system = True
|
||||
mode = "full" if self.app.vollbackup_var.get() else "incremental"
|
||||
mode = "full" if self.app.full_backup_var.get() else "incremental"
|
||||
self._start_system_backup(mode, source_size_bytes)
|
||||
else:
|
||||
self.app.last_backup_was_system = False
|
||||
@@ -632,7 +637,7 @@ class Actions:
|
||||
if AppConfig.MANUAL_EXCLUDE_LIST_PATH.exists():
|
||||
exclude_file_paths.append(AppConfig.MANUAL_EXCLUDE_LIST_PATH)
|
||||
|
||||
is_dry_run = self.app.testlauf_var.get()
|
||||
is_dry_run = self.app.test_run_var.get()
|
||||
is_compressed = self.app.compressed_var.get()
|
||||
|
||||
self.app.backup_manager.start_backup(
|
||||
@@ -664,9 +669,9 @@ class Actions:
|
||||
|
||||
is_encrypted = self.app.encrypted_var.get()
|
||||
|
||||
mode = "full" if self.app.vollbackup_var.get() else "incremental"
|
||||
mode = "full" if self.app.full_backup_var.get() else "incremental"
|
||||
|
||||
is_dry_run = self.app.testlauf_var.get()
|
||||
is_dry_run = self.app.test_run_var.get()
|
||||
is_compressed = self.app.compressed_var.get()
|
||||
use_trash_bin = self.app.config_manager.get_setting(
|
||||
"use_trash_bin", False)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import tkinter as tk
|
||||
from tkinter import ttk, messagebox
|
||||
|
||||
|
||||
class PasswordDialog(tk.Toplevel):
|
||||
def __init__(self, parent, title="Password Required", confirm=True):
|
||||
super().__init__(parent)
|
||||
@@ -13,7 +14,8 @@ class PasswordDialog(tk.Toplevel):
|
||||
self.transient(parent)
|
||||
self.grab_set()
|
||||
|
||||
ttk.Label(self, text="Please enter the password for the encrypted backup:").pack(padx=20, pady=10)
|
||||
ttk.Label(self, text="Please enter the password for the encrypted backup:").pack(
|
||||
padx=20, pady=10)
|
||||
self.password_entry = ttk.Entry(self, show="*")
|
||||
self.password_entry.pack(padx=20, pady=5, fill="x", expand=True)
|
||||
self.password_entry.focus_set()
|
||||
@@ -23,7 +25,8 @@ class PasswordDialog(tk.Toplevel):
|
||||
self.confirm_entry = ttk.Entry(self, show="*")
|
||||
self.confirm_entry.pack(padx=20, pady=5, fill="x", expand=True)
|
||||
|
||||
self.save_to_keyring_cb = ttk.Checkbutton(self, text="Save password to system keyring", variable=self.save_to_keyring)
|
||||
self.save_to_keyring_cb = ttk.Checkbutton(
|
||||
self, text="Save password to system keyring", variable=self.save_to_keyring)
|
||||
self.save_to_keyring_cb.pack(padx=20, pady=10)
|
||||
|
||||
button_frame = ttk.Frame(self)
|
||||
@@ -31,7 +34,8 @@ class PasswordDialog(tk.Toplevel):
|
||||
|
||||
ok_button = ttk.Button(button_frame, text="OK", command=self.on_ok)
|
||||
ok_button.pack(side="left", padx=5)
|
||||
cancel_button = ttk.Button(button_frame, text="Cancel", command=self.on_cancel)
|
||||
cancel_button = ttk.Button(
|
||||
button_frame, text="Cancel", command=self.on_cancel)
|
||||
cancel_button.pack(side="left", padx=5)
|
||||
|
||||
self.bind("<Return>", lambda event: self.on_ok())
|
||||
@@ -41,15 +45,17 @@ class PasswordDialog(tk.Toplevel):
|
||||
|
||||
def on_ok(self):
|
||||
password = self.password_entry.get()
|
||||
|
||||
|
||||
if not password:
|
||||
messagebox.showerror("Error", "Password cannot be empty.", parent=self)
|
||||
messagebox.showerror(
|
||||
"Error", "Password cannot be empty.", parent=self)
|
||||
return
|
||||
|
||||
if self.confirm:
|
||||
confirm = self.confirm_entry.get()
|
||||
if password != confirm:
|
||||
messagebox.showerror("Error", "Passwords do not match.", parent=self)
|
||||
messagebox.showerror(
|
||||
"Error", "Passwords do not match.", parent=self)
|
||||
return
|
||||
|
||||
self.password = password
|
||||
@@ -60,4 +66,4 @@ class PasswordDialog(tk.Toplevel):
|
||||
self.destroy()
|
||||
|
||||
def get_password(self):
|
||||
return self.password, self.save_to_keyring.get()
|
||||
return self.password, self.save_to_keyring.get()
|
||||
|
||||
Reference in New Issue
Block a user