refactor(main.py): add debug prints for state file handling and seeking logic improvements
This commit is contained in:
@@ -190,13 +190,20 @@ class VideoEditor:
|
|||||||
def load_state(self) -> bool:
|
def load_state(self) -> bool:
|
||||||
"""Load editor state from JSON file"""
|
"""Load editor state from JSON file"""
|
||||||
state_file = self._get_state_file_path()
|
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
|
return False
|
||||||
|
|
||||||
|
print(f"Loading state from: {state_file}")
|
||||||
try:
|
try:
|
||||||
with open(state_file, 'r') as f:
|
with open(state_file, 'r') as f:
|
||||||
state = json.load(f)
|
state = json.load(f)
|
||||||
|
|
||||||
|
print(f"State file contents: {state}")
|
||||||
|
|
||||||
# Restore state values
|
# Restore state values
|
||||||
if 'current_frame' in state:
|
if 'current_frame' in state:
|
||||||
self.current_frame = state['current_frame']
|
self.current_frame = state['current_frame']
|
||||||
@@ -214,8 +221,10 @@ class VideoEditor:
|
|||||||
self.contrast = state['contrast']
|
self.contrast = state['contrast']
|
||||||
if 'cut_start_frame' in state:
|
if 'cut_start_frame' in state:
|
||||||
self.cut_start_frame = state['cut_start_frame']
|
self.cut_start_frame = state['cut_start_frame']
|
||||||
|
print(f"Restored cut_start_frame: {self.cut_start_frame}")
|
||||||
if 'cut_end_frame' in state:
|
if 'cut_end_frame' in state:
|
||||||
self.cut_end_frame = state['cut_end_frame']
|
self.cut_end_frame = state['cut_end_frame']
|
||||||
|
print(f"Restored cut_end_frame: {self.cut_end_frame}")
|
||||||
if 'looping_between_markers' in state:
|
if 'looping_between_markers' in state:
|
||||||
self.looping_between_markers = state['looping_between_markers']
|
self.looping_between_markers = state['looping_between_markers']
|
||||||
if 'display_offset' in state:
|
if 'display_offset' in state:
|
||||||
@@ -517,11 +526,6 @@ class VideoEditor:
|
|||||||
self, direction: int, shift_pressed: bool, ctrl_pressed: bool
|
self, direction: int, shift_pressed: bool, ctrl_pressed: bool
|
||||||
):
|
):
|
||||||
"""Seek video with different frame counts based on modifiers and seek multiplier"""
|
"""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:
|
if ctrl_pressed:
|
||||||
base_frames = 60 # Ctrl: 60 frames
|
base_frames = 60 # Ctrl: 60 frames
|
||||||
elif shift_pressed:
|
elif shift_pressed:
|
||||||
|
Reference in New Issue
Block a user