rv pointless optimization & remove circular imports (again...)

the last commit does showcase an enlightening bug however
This commit is contained in:
tassaron 2017-08-12 22:51:46 -04:00
parent 282f1c4b12
commit d6b6083f80
3 changed files with 16 additions and 22 deletions

View File

@ -10,7 +10,6 @@ from importlib import import_module
import logging import logging
import toolkit import toolkit
import video_thread
log = logging.getLogger('AVP.Core') log = logging.getLogger('AVP.Core')
@ -418,6 +417,7 @@ class Core:
def newVideoWorker(self, loader, audioFile, outputPath): def newVideoWorker(self, loader, audioFile, outputPath):
'''loader is MainWindow or Command object which must own the thread''' '''loader is MainWindow or Command object which must own the thread'''
import video_thread
self.videoThread = QtCore.QThread(loader) self.videoThread = QtCore.QThread(loader)
videoWorker = video_thread.Worker( videoWorker = video_thread.Worker(
loader, audioFile, outputPath, self.selectedComponents loader, audioFile, outputPath, self.selectedComponents

View File

@ -12,7 +12,6 @@ import logging
import core import core
from toolkit.common import checkOutput, pipeWrapper from toolkit.common import checkOutput, pipeWrapper
from component import ComponentError
log = logging.getLogger('AVP.Toolkit.Ffmpeg') log = logging.getLogger('AVP.Toolkit.Ffmpeg')
@ -91,6 +90,7 @@ class FfmpegVideo:
self.frameBuffer.task_done() self.frameBuffer.task_done()
def fillBuffer(self): def fillBuffer(self):
from component import ComponentError
logFilename = os.path.join( logFilename = os.path.join(
core.Core.logDir, 'render_%s.log' % str(self.component.compPos)) core.Core.logDir, 'render_%s.log' % str(self.component.compPos))
log.debug('Creating ffmpeg process (log at %s)' % logFilename) log.debug('Creating ffmpeg process (log at %s)' % logFilename)

View File

@ -86,31 +86,25 @@ def FloodFrame(width, height, RgbaTuple):
@defaultSize @defaultSize
def BlankFrame(width, height, blankFrames={}): def BlankFrame(width, height):
'''The base frame used by each component to start drawing.''' '''The base frame used by each component to start drawing.'''
try: newFrame = FloodFrame(width, height, (0, 0, 0, 0))
return blankFrames[(width, height)] blankFrames[(width, height)] = newFrame
except KeyError: return newFrame
newFrame = FloodFrame(width, height, (0, 0, 0, 0))
blankFrames[(width, height)] = newFrame
return newFrame
@defaultSize @defaultSize
def Checkerboard(width, height, checkerboards={}): def Checkerboard(width, height):
''' '''
A checkerboard to represent transparency to the user. A checkerboard to represent transparency to the user.
TODO: Would be cool to generate this image with numpy instead. TODO: Would be cool to generate this image with numpy instead.
''' '''
try: log.debug('Creating new %s*%s checkerboard' % (width, height))
return checkerboards[(width, height)] image = FloodFrame(1920, 1080, (0, 0, 0, 0))
except KeyError: image.paste(Image.open(
log.debug('Creating new %s*%s checkerboard' % (width, height)) os.path.join(core.Core.wd, "background.png")),
image = FloodFrame(1920, 1080, (0, 0, 0, 0)) (0, 0)
image.paste(Image.open( )
os.path.join(core.Core.wd, "background.png")), image = image.resize((width, height))
(0, 0) checkerboards[(width, height)] = image
) return image
image = image.resize((width, height))
checkerboards[(width, height)] = image
return image