Fix: BackupContentFrame layout and style access
Corrected the parenting of BackupContentFrame in main_app.py to ensure it's a child of content_frame, aligning its layout behavior with SettingsFrame. Resolved AttributeError in BackupContentFrame by updating style lookup to use the top-level window's style object, ensuring correct background color retrieval.
This commit is contained in:
@@ -396,7 +396,7 @@ class MainApplication(tk.Tk):
|
||||
|
||||
def _setup_backup_content_frame(self):
|
||||
self.backup_content_frame = BackupContentFrame(
|
||||
self.content_frame, self.backup_manager, padding=10)
|
||||
self.content_frame, self.backup_manager, self.actions, padding=10)
|
||||
self.backup_content_frame.grid(row=2, column=0, sticky="nsew")
|
||||
self.backup_content_frame.grid_remove()
|
||||
|
||||
@@ -574,6 +574,9 @@ class MainApplication(tk.Tk):
|
||||
self.task_progress.stop()
|
||||
elif message_type == 'cancel_button_state':
|
||||
self.start_pause_button.config(state=value)
|
||||
elif message_type == 'deletion_complete':
|
||||
self.backup_content_frame.hide_deletion_status()
|
||||
self.backup_content_frame.system_backups_frame._load_backup_content()
|
||||
elif message_type == 'error':
|
||||
self.animated_icon.stop("DISABLE")
|
||||
self.start_pause_button["text"] = "Start"
|
||||
|
||||
@@ -4,12 +4,16 @@ from tkinter import ttk
|
||||
from pbp_app_config import Msg
|
||||
from pyimage_ui.system_backup_content_frame import SystemBackupContentFrame
|
||||
from pyimage_ui.user_backup_content_frame import UserBackupContentFrame
|
||||
from shared_libs.animated_icon import AnimatedIcon
|
||||
from shared_libs.logger import app_logger
|
||||
|
||||
|
||||
class BackupContentFrame(ttk.Frame):
|
||||
def __init__(self, master, backup_manager, **kwargs):
|
||||
def __init__(self, master, backup_manager, actions, **kwargs):
|
||||
super().__init__(master, **kwargs)
|
||||
self.backup_manager = backup_manager
|
||||
self.actions = actions # Store actions object
|
||||
self.master = master # Reference to MainApplication
|
||||
|
||||
self.backup_path = None
|
||||
|
||||
@@ -27,10 +31,24 @@ class BackupContentFrame(ttk.Frame):
|
||||
header_frame, text=Msg.STR["user_backup_info"], command=self.show_user_backups)
|
||||
self.user_button.pack(side=tk.LEFT, padx=5)
|
||||
|
||||
# Deletion Status UI (initially hidden)
|
||||
self.deletion_status_frame = ttk.Frame(header_frame)
|
||||
self.deletion_status_frame.pack(side=tk.LEFT, padx=15)
|
||||
|
||||
bg_color = self.winfo_toplevel().style.lookup('TFrame', 'background')
|
||||
self.deletion_animated_icon = AnimatedIcon(
|
||||
self.deletion_status_frame, width=20, height=20, use_pillow=True, bg=bg_color, animation_type="counter_arc")
|
||||
self.deletion_animated_icon.pack(side=tk.LEFT, padx=5)
|
||||
self.deletion_animated_icon.stop("DISABLE")
|
||||
|
||||
self.deletion_status_label = ttk.Label(
|
||||
self.deletion_status_frame, text="", font=("Ubuntu", 10, "bold"))
|
||||
self.deletion_status_label.pack(side=tk.LEFT, padx=5)
|
||||
|
||||
# --- Content Frames ---
|
||||
self.system_backups_frame = SystemBackupContentFrame(
|
||||
self, backup_manager)
|
||||
self.user_backups_frame = UserBackupContentFrame(self, backup_manager)
|
||||
self, backup_manager, actions)
|
||||
self.user_backups_frame = UserBackupContentFrame(self, backup_manager, actions)
|
||||
|
||||
self.system_backups_frame.grid(row=1, column=0, sticky=tk.NSEW)
|
||||
self.user_backups_frame.grid(row=1, column=0, sticky=tk.NSEW)
|
||||
@@ -54,3 +72,14 @@ class BackupContentFrame(ttk.Frame):
|
||||
def show_user_backups(self):
|
||||
self.user_backups_frame.grid()
|
||||
self.system_backups_frame.grid_remove()
|
||||
|
||||
def show_deletion_status(self, text: str):
|
||||
app_logger.log(f"Showing deletion status: {text}")
|
||||
self.deletion_status_label.config(text=text)
|
||||
self.deletion_animated_icon.start()
|
||||
self.deletion_status_frame.pack(side=tk.LEFT, padx=15)
|
||||
|
||||
def hide_deletion_status(self):
|
||||
app_logger.log("Hiding deletion status.")
|
||||
self.deletion_animated_icon.stop("DISABLE")
|
||||
self.deletion_status_frame.pack_forget()
|
||||
Reference in New Issue
Block a user