From 252cda9ad3735590e520d6b5de65317bd984550f Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Mon, 8 Sep 2025 00:06:20 +0200 Subject: [PATCH] refactor(main.py): add debug prints for state file handling and seeking logic improvements --- croppa/main.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/croppa/main.py b/croppa/main.py index ad04de4..7226729 100644 --- a/croppa/main.py +++ b/croppa/main.py @@ -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: