commit part 3 canvas edit on default settings
This commit is contained in:
25
main_app.py
25
main_app.py
@@ -296,6 +296,23 @@ class MainApplication(tk.Tk):
|
||||
last_mode = self.config_manager.get_setting("last_mode", "backup")
|
||||
|
||||
# Pre-load data from config before initializing the UI
|
||||
backup_source_path = self.config_manager.get_setting("backup_source_path")
|
||||
if backup_source_path and os.path.isdir(backup_source_path):
|
||||
folder_name = next((name for name, path_obj in AppConfig.FOLDER_PATHS.items() if str(path_obj) == backup_source_path), None)
|
||||
|
||||
if folder_name:
|
||||
icon_name = self.buttons_map[folder_name]['icon']
|
||||
else:
|
||||
# Handle custom folder path
|
||||
folder_name = os.path.basename(backup_source_path.rstrip('/'))
|
||||
icon_name = 'folder_extralarge' # A generic folder icon
|
||||
|
||||
self.backup_left_canvas_data.update({
|
||||
'icon': icon_name,
|
||||
'folder': folder_name,
|
||||
'path_display': backup_source_path,
|
||||
})
|
||||
|
||||
backup_dest_path = self.config_manager.get_setting(
|
||||
"backup_destination_path")
|
||||
if backup_dest_path and os.path.isdir(backup_dest_path):
|
||||
@@ -337,7 +354,7 @@ class MainApplication(tk.Tk):
|
||||
self.navigation.initialize_ui_for_mode(last_mode)
|
||||
|
||||
# Trigger calculations if needed
|
||||
if last_mode == 'backup' and backup_dest_path:
|
||||
if last_mode == 'backup':
|
||||
self.after(100, self.actions.on_sidebar_button_click,
|
||||
self.backup_left_canvas_data.get('folder', 'Computer'))
|
||||
elif last_mode == 'restore':
|
||||
@@ -439,6 +456,12 @@ class MainApplication(tk.Tk):
|
||||
self.config_manager.set_setting("last_mode", self.mode)
|
||||
|
||||
# Save paths from the data dictionaries
|
||||
if self.backup_left_canvas_data.get('path_display'):
|
||||
self.config_manager.set_setting(
|
||||
"backup_source_path", self.backup_left_canvas_data['path_display'])
|
||||
else:
|
||||
self.config_manager.set_setting("backup_source_path", None)
|
||||
|
||||
if self.backup_right_canvas_data.get('path_display'):
|
||||
self.config_manager.set_setting(
|
||||
"backup_destination_path", self.backup_right_canvas_data['path_display'])
|
||||
|
Reference in New Issue
Block a user