aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authortassaron2017-07-13 17:03:25 -0400
committertassaron2017-07-13 17:03:25 -0400
commit06c27a48bc3f52e15c15445d822e8a6f523ab98f (patch)
treed238a05980dddef9c76786a755de04c33028088c /src/components
parentb7931572a73d408dceecc4b17b784a0338e0e35b (diff)
more error messages for blank components
Diffstat (limited to 'src/components')
-rw-r--r--src/components/image.py7
-rw-r--r--src/components/sound.py11
-rw-r--r--src/components/text.py8
-rw-r--r--src/components/video.py13
4 files changed, 31 insertions, 8 deletions
diff --git a/src/components/image.py b/src/components/image.py
index 6465bc9..6a70424 100644
--- a/src/components/image.py
+++ b/src/components/image.py
@@ -48,14 +48,15 @@ class Component(Component):
def properties(self):
props = ['static']
- if self.imagePath and not os.path.exists(self.imagePath):
+ if not os.path.exists(self.imagePath):
props.append('error')
return props
def error(self):
+ if not self.imagePath:
+ return "There is no image selected."
if not os.path.exists(self.imagePath):
- return "The image selected on " \
- "layer %s does not exist!" % str(self.compPos)
+ return "The image selected does not exist!"
def frameRender(self, layerNo, frameNo):
width = int(self.settings.value('outputWidth'))
diff --git a/src/components/sound.py b/src/components/sound.py
index 9c114a8..2ffb682 100644
--- a/src/components/sound.py
+++ b/src/components/sound.py
@@ -34,7 +34,16 @@ class Component(Component):
pass
def properties(self):
- return ['static', 'audio']
+ props = ['static', 'audio']
+ if not os.path.exists(self.sound):
+ props.append('error')
+ return props
+
+ def error(self):
+ if not self.sound:
+ return "No audio file selected."
+ if not os.path.exists(self.sound):
+ return "The audio file selected no longer exists!"
def audio(self):
return (self.sound, {})
diff --git a/src/components/text.py b/src/components/text.py
index 4435b80..c52bdc5 100644
--- a/src/components/text.py
+++ b/src/components/text.py
@@ -121,7 +121,13 @@ class Component(Component):
return self.addText(width, height)
def properties(self):
- return ['static']
+ props = ['static']
+ if not self.title:
+ props.append('error')
+ return props
+
+ def error(self):
+ return "No text provided."
def frameRender(self, layerNo, frameNo):
width = int(self.settings.value('outputWidth'))
diff --git a/src/components/video.py b/src/components/video.py
index 53487b1..8861d70 100644
--- a/src/components/video.py
+++ b/src/components/video.py
@@ -115,6 +115,7 @@ class Component(Component):
self.settings = parent.settings
page = self.loadUi('video.ui')
self.videoPath = ''
+ self.badVideo = False
self.x = 0
self.y = 0
self.loopVideo = False
@@ -156,14 +157,18 @@ class Component(Component):
props = []
if self.useAudio:
props.append('audio')
- if self.videoPath and not os.path.exists(self.videoPath):
+ if not self.videoPath or self.badVideo \
+ or not os.path.exists(self.videoPath):
props.append('error')
return props
def error(self):
+ if not self.videoPath:
+ return "There is no video selected."
if not os.path.exists(self.videoPath):
- return "The video selected on " \
- "layer %s does not exist!" % str(self.compPos)
+ return "The video selected does not exist!"
+ if self.badVideo:
+ return "The video selected is corrupt!"
def audio(self):
return (self.videoPath, {'map': '-v'})
@@ -300,6 +305,7 @@ def finalizeFrame(self, imageData, width, height):
'### BAD VIDEO SELECTED ###\n'
'Video will not export with these settings'
)
+ self.badVideo = True
return BlankFrame(width, height)
if self.scale != 100 \
@@ -308,4 +314,5 @@ def finalizeFrame(self, imageData, width, height):
frame.paste(image, box=(self.xPosition, self.yPosition))
else:
frame = image
+ self.badVideo = False
return frame