backup view corrected

This commit is contained in:
2025-09-10 18:56:19 +02:00
parent 9fd032e9b4
commit 8a70fe2320
2 changed files with 35 additions and 14 deletions

View File

@@ -35,7 +35,7 @@ class SystemBackupContentFrame(ttk.Frame):
def show(self, backup_path, system_backups):
self.backup_path = backup_path
self.system_backups_list = system_backups
self.system_backups_list = sorted(system_backups, key=lambda b: (b.get('is_encrypted'), b.get('folder_name', '')))
self._load_backup_content()
def _load_backup_content(self):
@@ -45,16 +45,26 @@ class SystemBackupContentFrame(ttk.Frame):
if not self.system_backups_list:
return
colors = ["#0078D7", "#E8740C", "#107C10", "#8B107C", "#005A9E"]
color_index = -1
current_color_tag = ""
colors = ["#0078D7", "#7e4818", "#8B107C", "#005A9E", "#2b3e4e"]
last_full_backup_tag = {}
color_index = 0
for backup_info in self.system_backups_list:
is_encrypted = backup_info.get("is_encrypted")
group_key = (is_encrypted,)
current_color_tag = ""
for i, backup_info in enumerate(self.system_backups_list):
if backup_info.get("backup_type_base") == "Full":
color_index = (color_index + 1) % len(colors)
current_color_tag = f"color_{color_index}"
self.content_tree.tag_configure(
current_color_tag, foreground=colors[color_index])
current_color_tag, foreground=colors[color_index % len(colors)])
color_index += 1
last_full_backup_tag[group_key] = current_color_tag
else:
if group_key in last_full_backup_tag:
current_color_tag = last_full_backup_tag[group_key]
else:
current_color_tag = ""
backup_type_display = backup_info.get("type", "N/A")
if backup_info.get("backup_type_base") != "Full":

View File

@@ -38,7 +38,7 @@ class UserBackupContentFrame(ttk.Frame):
def show(self, backup_path, user_backups):
self.backup_path = backup_path
self.user_backups_list = user_backups
self.user_backups_list = sorted(user_backups, key=lambda b: (b.get('source', ''), b.get('is_encrypted'), b.get('folder_name', '')))
self._load_backup_content()
def _load_backup_content(self):
@@ -48,16 +48,27 @@ class UserBackupContentFrame(ttk.Frame):
if not self.user_backups_list:
return
colors = ["#0078D7", "#E8740C", "#107C10", "#8B107C", "#005A9E"]
color_index = -1
current_color_tag = ""
colors = ["#0078D7", "#854710", "#8B107C", "#005A9E", "#2b3e4e"]
last_full_backup_tag = {}
color_index = 0
for backup_info in self.user_backups_list:
source = backup_info.get("source")
is_encrypted = backup_info.get("is_encrypted")
group_key = (source, is_encrypted)
current_color_tag = ""
for i, backup_info in enumerate(self.user_backups_list):
if backup_info.get("backup_type_base") == "Full":
color_index = (color_index + 1) % len(colors)
current_color_tag = f"color_{color_index}"
self.content_tree.tag_configure(
current_color_tag, foreground=colors[color_index])
current_color_tag, foreground=colors[color_index % len(colors)])
color_index += 1
last_full_backup_tag[group_key] = current_color_tag
else:
if group_key in last_full_backup_tag:
current_color_tag = last_full_backup_tag[group_key]
else:
current_color_tag = ""
backup_type_display = backup_info.get("type", "N/A")
if backup_info.get("backup_type_base") != "Full":