Skip to content

Commit

Permalink
Fix timeline update locking
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaker authored Apr 11, 2022
1 parent 455dbe9 commit 3b259cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cutselectionController.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def sceneChangeCallback(self,filename,timestamp,timestampEnd=None,kind='Mark'):
elif kind == 'Cut':
self.videoManager.registerNewSubclip(filename,timestamp,max(timestamp+0.01,timestampEnd-0.01))
self.updateProgressStatistics()
self.ui.setUiDirtyFlag()
self.ui.setUiDirtyFlag(withLock=True)

def askToUseRangeIfSet(self):
useRange=False
Expand Down
6 changes: 3 additions & 3 deletions src/cutselectionUi.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,12 +913,12 @@ def getIsPlaybackStarted(self):
return self.controller.getIsPlaybackStarted()

def update(self,withLock=True):
self.frameTimeLineFrame.updateCanvas(withLock=True)
self.frameTimeLineFrame.updateCanvas(withLock=False)

def setUiDirtyFlag(self):
def setUiDirtyFlag(self,withLock=False):
self.frameTimeLineFrame.setUiDirtyFlag()
try:
self.frameTimeLineFrame.updateCanvas()
self.frameTimeLineFrame.updateCanvas(withLock=withLock)
except Exception as e:
print(e)

Expand Down
14 changes: 12 additions & 2 deletions src/timeLineSelectionFrameUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@
import math

from contextlib import contextmanager
from contextlib import AbstractContextManager

class AbstractContextManager:

def __init__(self):
pass

def __enter__(self):
pass

def __exit__(self ,type, value, traceback):
pass


@contextmanager
Expand Down Expand Up @@ -785,7 +795,7 @@ def requestFrames(self,filename,startTime,Endtime,timelineWidth,frameWidth):
self.framesRequested=self.controller.requestTimelinePreviewFrames(filename,startTime,Endtime,frameWidth,timelineWidth,self.frameResponseCallback)

def updateCanvas(self,withLock=False):

if withLock:
updateLock = acquire_timeout(self.uiUpdateLock,0.1)
else:
Expand Down

0 comments on commit 3b259cd

Please sign in to comment.