refactor(main.py): add debug prints for state file handling and seeking logic improvements

This commit is contained in:
2025-09-08 00:06:20 +02:00
parent d29d45d4fd
commit 252cda9ad3

View File

@@ -190,13 +190,20 @@ class VideoEditor:
def load_state(self) -> bool:
"""Load editor state from JSON file"""
state_file = self._get_state_file_path()
if not state_file or not state_file.exists():
if not state_file:
print("No state file path available")
return False
if not state_file.exists():
print(f"State file does not exist: {state_file}")
return False
print(f"Loading state from: {state_file}")
try:
with open(state_file, 'r') as f:
state = json.load(f)
print(f"State file contents: {state}")
# Restore state values
if 'current_frame' in state:
self.current_frame = state['current_frame']
@@ -214,8 +221,10 @@ class VideoEditor:
self.contrast = state['contrast']
if 'cut_start_frame' in state:
self.cut_start_frame = state['cut_start_frame']
print(f"Restored cut_start_frame: {self.cut_start_frame}")
if 'cut_end_frame' in state:
self.cut_end_frame = state['cut_end_frame']
print(f"Restored cut_end_frame: {self.cut_end_frame}")
if 'looping_between_markers' in state:
self.looping_between_markers = state['looping_between_markers']
if 'display_offset' in state:
@@ -517,11 +526,6 @@ class VideoEditor:
self, direction: int, shift_pressed: bool, ctrl_pressed: bool
):
"""Seek video with different frame counts based on modifiers and seek multiplier"""
# Don't allow seeking while rendering to prevent crashes
if self.is_rendering():
print("Cannot seek while rendering is in progress")
return
if ctrl_pressed:
base_frames = 60 # Ctrl: 60 frames
elif shift_pressed: