aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortassaron2017-08-12 22:51:46 -0400
committertassaron2017-08-12 22:51:46 -0400
commitd6b6083f80ae609c801ef63285718325cd71d0c9 (patch)
tree7616931b30c5031ef6d5fa5b4d6dd98b0ef0ae03 /src
parent282f1c4b12b485a567f0d055832a5bf4409404a3 (diff)
rv pointless optimization & remove circular imports (again...)
the last commit does showcase an enlightening bug however
Diffstat (limited to 'src')
-rw-r--r--src/core.py2
-rw-r--r--src/toolkit/ffmpeg.py2
-rw-r--r--src/toolkit/frame.py34
3 files changed, 16 insertions, 22 deletions
diff --git a/src/core.py b/src/core.py
index 4023542..2b85f7e 100644
--- a/src/core.py
+++ b/src/core.py
@@ -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
diff --git a/src/toolkit/ffmpeg.py b/src/toolkit/ffmpeg.py
index 6ab445c..afcb37c 100644
--- a/src/toolkit/ffmpeg.py
+++ b/src/toolkit/ffmpeg.py
@@ -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)
diff --git a/src/toolkit/frame.py b/src/toolkit/frame.py
index e4332eb..6174072 100644
--- a/src/toolkit/frame.py
+++ b/src/toolkit/frame.py
@@ -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