diff options
| author | tassaron | 2017-08-03 00:44:46 -0400 |
|---|---|---|
| committer | tassaron | 2017-08-03 00:44:46 -0400 |
| commit | 6611492b30a7daf7bdbe77f6e12f9d322bdd90c1 (patch) | |
| tree | 57826b56646ccf81a7954af7daa4eb10632f2b32 /src | |
| parent | 62431a3cfebdc8490b7010d71b8e646dd6bd0d35 (diff) | |
relative gradients & last good frame used for preview errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/color.py | 5 | ||||
| -rw-r--r-- | src/components/spectrum.py | 15 | ||||
| -rw-r--r-- | src/components/text.py | 2 | ||||
| -rw-r--r-- | src/components/video.py | 15 | ||||
| -rw-r--r-- | src/components/waveform.py | 15 |
5 files changed, 29 insertions, 23 deletions
diff --git a/src/components/color.py b/src/components/color.py index 2b100d9..f5d618e 100644 --- a/src/components/color.py +++ b/src/components/color.py @@ -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', }, ) diff --git a/src/components/spectrum.py b/src/components/spectrum.py index 2cc641d..9a0c59a 100644 --- a/src/components/spectrum.py +++ b/src/components/spectrum.py @@ -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) diff --git a/src/components/text.py b/src/components/text.py index be4de4a..2a5d433 100644 --- a/src/components/text.py +++ b/src/components/text.py @@ -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 diff --git a/src/components/video.py b/src/components/video.py index 3569d17..2cd67c6 100644 --- a/src/components/video.py +++ b/src/components/video.py @@ -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 diff --git a/src/components/waveform.py b/src/components/waveform.py index a25116b..526e6fb 100644 --- a/src/components/waveform.py +++ b/src/components/waveform.py @@ -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) |
