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

View File

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

View File

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