aboutsummaryrefslogtreecommitdiff
path: root/src/component.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/component.py')
-rw-r--r--src/component.py36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/component.py b/src/component.py
index eea82d7..2b297d1 100644
--- a/src/component.py
+++ b/src/component.py
@@ -24,7 +24,9 @@ class Component(QtCore.QObject):
return self.__doc__
def version(self):
- # change this number to identify new versions of a component
+ '''
+ Change this number to identify new versions of a component
+ '''
return 1
def properties(self):
@@ -42,15 +44,22 @@ class Component(QtCore.QObject):
return
def cancel(self):
- # please stop any lengthy process in response to this variable
+ '''
+ Stop any lengthy process in response to this variable
+ '''
self.canceled = True
def reset(self):
self.canceled = False
def update(self):
- self.modified.emit(self.compPos, self.savePreset())
- # read your widget values, then call super().update()
+ '''
+ Read your widget values from self.page, then call super().update()
+ '''
+ self.parent.drawPreview()
+ saveValueStore = self.savePreset()
+ saveValueStore['preset'] = self.currentPreset
+ self.modified.emit(self.compPos, saveValueStore)
def loadPreset(self, presetDict, presetName):
'''
@@ -72,8 +81,8 @@ class Component(QtCore.QObject):
Use the latter two signals to update the MainWindow if needed
for a long initialization procedure (i.e., for a visualizer)
'''
- for var, value in kwargs.items():
- exec('self.%s = value' % var)
+ for key, value in kwargs.items():
+ setattr(self, key, value)
def command(self, arg):
'''
@@ -143,16 +152,11 @@ class Component(QtCore.QObject):
def widget(self, parent):
self.parent = parent
- page = uic.loadUi(os.path.join(
- os.path.dirname(os.path.realpath(__file__)), 'example.ui'))
+ page = self.loadUi('example.ui')
# --- connect widget signals here ---
self.page = page
return page
- def update(self):
- self.parent.drawPreview()
- super().update()
-
def previewRender(self, previewWorker):
width = int(previewWorker.core.settings.value('outputWidth'))
height = int(previewWorker.core.settings.value('outputHeight'))
@@ -170,8 +174,12 @@ class Component(QtCore.QObject):
def audio(self):
\'''
- Return audio to mix into master as a string (path to audio file),
- or an object that returns raw audio data [future feature].
+ Return audio to mix into master as a tuple with two elements:
+ The first element can be:
+ - A string (path to audio file),
+ - Or an object that returns audio data through a pipe
+ The second element must be a dictionary of ffmpeg parameters
+ to apply to the input stream.
\'''
@classmethod