aboutsummaryrefslogtreecommitdiff
path: root/src/components/waveform.py
diff options
context:
space:
mode:
authortassaron2017-08-01 17:57:39 -0400
committertassaron2017-08-01 17:57:39 -0400
commit3c1b52205f183e9a2c943c5f666ed2c01db3aaf5 (patch)
tree0b92d6d2a1a21b87bd9f2f19181da15c09a1408b /src/components/waveform.py
parenta472246dab69d0676c3c78ecd61659e432c960b4 (diff)
component class now tracks colorwidgets
so adding new color-selection widgets is now simple
Diffstat (limited to 'src/components/waveform.py')
-rw-r--r--src/components/waveform.py40
1 files changed, 5 insertions, 35 deletions
diff --git a/src/components/waveform.py b/src/components/waveform.py
index 6c5133d..9c3cf86 100644
--- a/src/components/waveform.py
+++ b/src/components/waveform.py
@@ -7,7 +7,7 @@ import subprocess
from component import Component
from toolkit.frame import BlankFrame, scale
-from toolkit import checkOutput, rgbFromString, pickColor
+from toolkit import checkOutput
from toolkit.ffmpeg import (
openPipe, closePipe, getAudioDuration, FfmpegVideo, exampleSound
)
@@ -18,15 +18,9 @@ class Component(Component):
version = '1.0.0'
def widget(self, *args):
- self.color = (255, 255, 255)
super().widget(*args)
- self.page.lineEdit_color.setText('%s,%s,%s' % self.color)
- btnStyle = "QPushButton { background-color : %s; outline: none; }" \
- % QColor(*self.color).name()
- self.page.pushButton_color.setStyleSheet(btnStyle)
- self.page.pushButton_color.clicked.connect(lambda: self.pickColor())
- self.page.spinBox_scale.valueChanged.connect(self.updateChunksize)
+ self.page.lineEdit_color.setText('255,255,255')
if hasattr(self.parent, 'window'):
self.parent.window.lineEdit_audioFile.textChanged.connect(
@@ -35,6 +29,7 @@ class Component(Component):
self.trackWidgets(
{
+ 'color': self.page.lineEdit_color,
'mode': self.page.comboBox_mode,
'amplitude': self.page.comboBox_amplitude,
'x': self.page.spinBox_x,
@@ -44,36 +39,11 @@ class Component(Component):
'opacity': self.page.spinBox_opacity,
'compress': self.page.checkBox_compress,
'mono': self.page.checkBox_mono,
+ }, colorWidgets={
+ 'color': self.page.pushButton_color,
}
)
- def update(self):
- self.color = rgbFromString(self.page.lineEdit_color.text())
- btnStyle = "QPushButton { background-color : %s; outline: none; }" \
- % QColor(*self.color).name()
- self.page.pushButton_color.setStyleSheet(btnStyle)
- super().update()
-
- def loadPreset(self, pr, *args):
- super().loadPreset(pr, *args)
-
- self.page.lineEdit_color.setText('%s,%s,%s' % pr['color'])
- btnStyle = "QPushButton { background-color : %s; outline: none; }" \
- % QColor(*pr['color']).name()
- self.page.pushButton_color.setStyleSheet(btnStyle)
-
- def savePreset(self):
- saveValueStore = super().savePreset()
- saveValueStore['color'] = self.color
- return saveValueStore
-
- def pickColor(self):
- RGBstring, btnStyle = pickColor()
- if not RGBstring:
- return
- self.page.lineEdit_color.setText(RGBstring)
- self.page.pushButton_color.setStyleSheet(btnStyle)
-
def previewRender(self):
self.updateChunksize()
frame = self.getPreviewFrame(self.width, self.height)