feat(ui): Improve "Backup Content" view default behavior

Implements a more intuitive default view for the "Backup Content" screen based on user context.

- After a backup is completed, the "Backup Content" view will now automatically open the tab corresponding to the type of backup just performed (System or User).
- On a fresh application start, the "Backup Content" view will now always default to showing the "System" backups tab.
- This is achieved by adding state variables to the main app and modifying the navigation logic, while removing the previous behavior of saving the last-viewed tab to the config.
This commit is contained in:
2025-09-09 02:54:34 +02:00
parent a646b9d13a
commit 474930e6d0
4 changed files with 20 additions and 8 deletions

View File

@@ -91,6 +91,8 @@ class MainApplication(tk.Tk):
self.mode = "backup" # Default mode
self.backup_is_running = False
self.start_time = None
self.last_backup_was_system = True
self.next_backup_content_view = 'system'
self.calculation_thread = None
self.calculation_stop_event = None
@@ -688,6 +690,12 @@ class MainApplication(tk.Tk):
elif status_info is None:
status = 'success'
if status in ['success', 'warning']:
if self.last_backup_was_system:
self.next_backup_content_view = 'system'
else:
self.next_backup_content_view = 'user'
if status == 'success':
self.info_label.config(
text=Msg.STR["backup_finished_successfully"])

View File

@@ -623,9 +623,11 @@ class Actions:
return
if source_folder == "Computer":
self.app.last_backup_was_system = True
mode = "full" if self.app.vollbackup_var.get() else "incremental"
self._start_system_backup(mode, source_size_bytes)
else:
self.app.last_backup_was_system = False
self._start_user_backup()
else: # restore mode
# Restore logic would go here

View File

@@ -119,8 +119,6 @@ class BackupContentFrame(ttk.Frame):
def _switch_view(self, index):
self.current_view_index = index
config_key = "last_encrypted_backup_content_view" if self.viewing_encrypted else "last_backup_content_view"
self.app.config_manager.set_setting(config_key, index)
self.update_nav_buttons(index)
if index == 0:

View File

@@ -269,7 +269,7 @@ class Navigation:
self.app.top_bar.grid()
self._update_task_bar_visibility("settings")
def toggle_backup_content_frame(self, initial_tab_index=0):
def toggle_backup_content_frame(self, _=None): # Accept argument but ignore it
self._cancel_calculation()
self.app.drawing.update_nav_buttons(2) # Index 2 for Backup Content
@@ -291,12 +291,16 @@ class Navigation:
self.app.restore_size_frame_before.grid_remove()
self.app.restore_size_frame_after.grid_remove()
is_encrypted = self.app.backup_manager.encryption_manager.is_encrypted(
self.app.destination_path)
config_key = "last_encrypted_backup_content_view" if is_encrypted else "last_backup_content_view"
last_view_index = self.app.config_manager.get_setting(config_key, 0)
if self.app.next_backup_content_view == 'user':
initial_tab_index = 1
else: # Default to system
initial_tab_index = 0
self.app.backup_content_frame.show(
self.app.destination_path, last_view_index)
self.app.destination_path, initial_tab_index)
# Reset to default for next time
self.app.next_backup_content_view = 'system'
self.app.top_bar.grid()
self._update_task_bar_visibility("scheduler")