relative gradients & last good frame used for preview errors

This commit is contained in:
tassaron 2017-08-03 00:44:46 -04:00
parent 62431a3cfe
commit 6611492b30
5 changed files with 29 additions and 23 deletions

View File

@ -65,6 +65,11 @@ class Component(Component):
'y': 'y',
'sizeWidth': 'x',
'sizeHeight': 'y',
'RG_start': 'x',
'LG_start': 'x',
'RG_end': 'x',
'LG_end': 'x',
'RG_centre': 'x',
},
)

View File

@ -20,6 +20,7 @@ class Component(Component):
def widget(self, *args):
self.previewFrame = None
super().widget(*args)
self._image = BlankFrame(self.width, self.height)
self.chunkSize = 4 * self.width * self.height
self.changedOptions = True
@ -268,11 +269,15 @@ class Component(Component):
return changed
def finalizeFrame(self, imageData):
image = Image.frombytes(
'RGBA',
scale(self.scale, self.width, self.height, int),
imageData
)
try:
image = Image.frombytes(
'RGBA',
scale(self.scale, self.width, self.height, int),
imageData
)
self._image = image
except ValueError:
image = self._image
if self.scale != 100 \
or self.x != 0 or self.y != 0:
frame = BlankFrame(self.width, self.height)

View File

@ -17,8 +17,6 @@ class Component(Component):
def widget(self, *args):
super().widget(*args)
# height = int(self.settings.value('outputHeight'))
# width = int(self.settings.value('outputWidth'))
self.textColor = (255, 255, 255)
self.title = 'Text'
self.alignment = 1

View File

@ -16,12 +16,12 @@ class Component(Component):
def widget(self, *args):
self.videoPath = ''
self.badVideo = False
self.badAudio = False
self.x = 0
self.y = 0
self.loopVideo = False
super().widget(*args)
self._image = BlankFrame(self.width, self.height)
self.page.pushButton_video.clicked.connect(self.pickVideo)
self.trackWidgets(
{
@ -70,8 +70,6 @@ class Component(Component):
if not self.videoPath:
self.lockError("There is no video selected.")
elif self.badVideo:
self.lockError("Could not identify an audio stream in this video.")
elif not os.path.exists(self.videoPath):
self.lockError("The video selected does not exist!")
elif os.path.realpath(self.videoPath) == os.path.realpath(outputFile):
@ -199,14 +197,10 @@ class Component(Component):
'RGBA',
scale(self.scale, self.width, self.height, int),
imageData)
self._image = image
except ValueError:
print(
'### BAD VIDEO SELECTED ###\n'
'Video will not export with these settings'
)
self.badVideo = True
return BlankFrame(self.width, self.height)
# use last good frame
image = self._image
if self.scale != 100 \
or self.xPosition != 0 or self.yPosition != 0:
@ -214,5 +208,4 @@ class Component(Component):
frame.paste(image, box=(self.xPosition, self.yPosition))
else:
frame = image
self.badVideo = False
return frame

View File

@ -19,6 +19,7 @@ class Component(Component):
def widget(self, *args):
super().widget(*args)
self._image = BlankFrame(self.width, self.height)
self.page.lineEdit_color.setText('255,255,255')
@ -178,11 +179,15 @@ class Component(Component):
self.chunkSize = 4 * width * height
def finalizeFrame(self, imageData):
image = Image.frombytes(
'RGBA',
scale(self.scale, self.width, self.height, int),
imageData
)
try:
image = Image.frombytes(
'RGBA',
scale(self.scale, self.width, self.height, int),
imageData
)
self._image = image
except ValueError:
image = self._image
if self.scale != 100 \
or self.x != 0 or self.y != 0:
frame = BlankFrame(self.width, self.height)