aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authortassaron2017-07-11 06:06:22 -0400
committertassaron2017-07-11 06:06:22 -0400
commit2e37dafd7036973a315b525f131850a6fb6d0b35 (patch)
tree090e5b29c706f38945209e33161b4cc9713782f2 /src/components
parent4c3920e6309b4e67e3d8d809dd0b5b6cd245fd0c (diff)
fixed various bugs
Diffstat (limited to 'src/components')
-rw-r--r--src/components/image.py10
-rw-r--r--src/components/sound.py8
-rw-r--r--src/components/text.py10
-rw-r--r--src/components/video.py21
-rw-r--r--src/components/video.ui17
5 files changed, 48 insertions, 18 deletions
diff --git a/src/components/image.py b/src/components/image.py
index 94dcb83..07abc3f 100644
--- a/src/components/image.py
+++ b/src/components/image.py
@@ -47,7 +47,15 @@ class Component(Component):
return self.drawFrame(width, height)
def properties(self):
- return ['static']
+ props = ['static']
+ if not os.path.exists(self.imagePath):
+ props.append('error')
+ return props
+
+ def error(self):
+ if not os.path.exists(self.imagePath):
+ return "The image path selected on " \
+ "layer %s no longer exists!" % str(self.compPos)
def frameRender(self, layerNo, frameNo):
width = int(self.worker.core.settings.value('outputWidth'))
diff --git a/src/components/sound.py b/src/components/sound.py
index 1f43c83..9c114a8 100644
--- a/src/components/sound.py
+++ b/src/components/sound.py
@@ -28,7 +28,7 @@ class Component(Component):
def previewRender(self, previewWorker):
width = int(previewWorker.core.settings.value('outputWidth'))
height = int(previewWorker.core.settings.value('outputHeight'))
- return self.frameRender(self.compPos, 0)
+ return BlankFrame(width, height)
def preFrameRender(self, **kwargs):
pass
@@ -37,7 +37,7 @@ class Component(Component):
return ['static', 'audio']
def audio(self):
- return self.sound
+ return (self.sound, {})
def pickSound(self):
sndDir = self.settings.value("componentDir", os.path.expanduser("~"))
@@ -50,8 +50,8 @@ class Component(Component):
self.update()
def frameRender(self, layerNo, frameNo):
- width = int(self.core.settings.value('outputWidth'))
- height = int(self.core.settings.value('outputHeight'))
+ width = int(self.settings.value('outputWidth'))
+ height = int(self.settings.value('outputHeight'))
return BlankFrame(width, height)
def loadPreset(self, pr, presetName=None):
diff --git a/src/components/text.py b/src/components/text.py
index fb6a90e..ed50064 100644
--- a/src/components/text.py
+++ b/src/components/text.py
@@ -75,15 +75,15 @@ class Component(Component):
'''Returns true x, y after considering alignment settings'''
fm = QtGui.QFontMetrics(self.titleFont)
if self.alignment == 0: # Left
- x = self.xPosition
+ x = int(self.xPosition)
if self.alignment == 1: # Middle
offset = fm.width(self.title)/2
- x = self.xPosition - offset
+ x = int(self.xPosition - offset)
if self.alignment == 2: # Right
offset = fm.width(self.title)
- x = self.xPosition - offset
+ x = int(self.xPosition - offset)
return x, self.yPosition
def loadPreset(self, pr, presetName=None):
@@ -128,12 +128,12 @@ class Component(Component):
return self.addText(width, height)
def addText(self, width, height):
- x, y = self.getXY()
- image = FramePainter(width, height)
+ image = FramePainter(width, height)
self.titleFont.setPixelSize(self.fontSize)
image.setFont(self.titleFont)
image.setPen(self.textColor)
+ x, y = self.getXY()
image.drawText(x, y, self.title)
return image.finalize()
diff --git a/src/components/video.py b/src/components/video.py
index e6890e0..5303e3a 100644
--- a/src/components/video.py
+++ b/src/components/video.py
@@ -123,6 +123,7 @@ class Component(Component):
page.pushButton_video.clicked.connect(self.pickVideo)
page.checkBox_loop.stateChanged.connect(self.update)
page.checkBox_distort.stateChanged.connect(self.update)
+ page.checkBox_useAudio.stateChanged.connect(self.update)
page.spinBox_scale.valueChanged.connect(self.update)
page.spinBox_x.valueChanged.connect(self.update)
page.spinBox_y.valueChanged.connect(self.update)
@@ -133,6 +134,7 @@ class Component(Component):
def update(self):
self.videoPath = self.page.lineEdit_video.text()
self.loopVideo = self.page.checkBox_loop.isChecked()
+ self.useAudio = self.page.checkBox_useAudio.isChecked()
self.distort = self.page.checkBox_distort.isChecked()
self.scale = self.page.spinBox_scale.value()
self.xPosition = self.page.spinBox_x.value()
@@ -151,6 +153,23 @@ class Component(Component):
else:
return frame
+ def properties(self):
+ props = []
+ if self.useAudio:
+ # props.append('audio')
+ pass
+ if not os.path.exists(self.videoPath):
+ props.append('error')
+ return props
+
+ def error(self):
+ if not os.path.exists(self.videoPath):
+ return "The video path selected on " \
+ "layer %s no longer exists!" % str(self.compPos)
+
+ def audio(self):
+ return (self.videoPath, {})
+
def preFrameRender(self, **kwargs):
super().preFrameRender(**kwargs)
width = int(self.worker.core.settings.value('outputWidth'))
@@ -175,6 +194,7 @@ class Component(Component):
super().loadPreset(pr, presetName)
self.page.lineEdit_video.setText(pr['video'])
self.page.checkBox_loop.setChecked(pr['loop'])
+ self.page.checkBox_useAudio.setChecked(pr['useAudio'])
self.page.checkBox_distort.setChecked(pr['distort'])
self.page.spinBox_scale.setValue(pr['scale'])
self.page.spinBox_x.setValue(pr['x'])
@@ -185,6 +205,7 @@ class Component(Component):
'preset': self.currentPreset,
'video': self.videoPath,
'loop': self.loopVideo,
+ 'useAudio': self.useAudio,
'distort': self.distort,
'scale': self.scale,
'x': self.xPosition,
diff --git a/src/components/video.ui b/src/components/video.ui
index f05e8a5..97b7d6f 100644
--- a/src/components/video.ui
+++ b/src/components/video.ui
@@ -190,16 +190,20 @@
</widget>
</item>
<item>
- <spacer name="horizontalSpacer_10">
+ <widget class="QCheckBox" name="checkBox_useAudio">
+ <property name="text">
+ <string>Use Audio</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
<property name="sizeHint" stdset="0">
<size>
- <width>5</width>
+ <width>40</width>
<height>20</height>
</size>
</property>
@@ -256,9 +260,6 @@
</property>
</spacer>
</item>
- <item>
- <widget class="QWidget" name="widget" native="true"/>
- </item>
</layout>
</widget>
<resources/>