Add refresh_progress_data method in ProjectView and update VideoEditor to call it on state save. This ensures progress data is up-to-date when the editor state changes, enhancing user experience and project management.

This commit is contained in:
2025-09-16 10:06:44 +02:00
parent c8dfcca954
commit f0d540be27

View File

@@ -108,6 +108,10 @@ class ProjectView:
except Exception as e: except Exception as e:
print(f"Error loading progress for {video_path.name}: {e}") print(f"Error loading progress for {video_path.name}: {e}")
def refresh_progress_data(self):
"""Refresh progress data from JSON files (call when editor state changes)"""
self._load_progress_data()
def get_progress_for_video(self, video_path: Path) -> float: def get_progress_for_video(self, video_path: Path) -> float:
"""Get progress (0.0 to 1.0) for a video""" """Get progress (0.0 to 1.0) for a video"""
if video_path in self.progress_data: if video_path in self.progress_data:
@@ -564,6 +568,11 @@ class VideoEditor:
with open(state_file, 'w') as f: with open(state_file, 'w') as f:
json.dump(state, f, indent=2) json.dump(state, f, indent=2)
print(f"State saved to {state_file}") print(f"State saved to {state_file}")
# Refresh project view progress data if project view is active
if self.project_view_mode and self.project_view:
self.project_view.refresh_progress_data()
return True return True
except Exception as e: except Exception as e:
print(f"Error saving state: {e}") print(f"Error saving state: {e}")