aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortassaron2017-06-25 18:12:16 -0400
committertassaron2017-06-25 18:12:16 -0400
commit252639e9a2ab69e0aceb0caa6ae3ca0a3dfad686 (patch)
tree0ffb9813f0a2636f0fe4047a61e516dc631711a2
parentf284acbf19ca3549b4aa2c3cab226e5254cdf936 (diff)
renamed Original Audio Visualization to Classic Visualizer
-rw-r--r--src/components/__base__.py5
-rw-r--r--src/components/original.py6
-rw-r--r--src/core.py19
-rw-r--r--src/main.py4
-rw-r--r--src/mainwindow.py5
5 files changed, 30 insertions, 9 deletions
diff --git a/src/components/__base__.py b/src/components/__base__.py
index 84d41c8..9b04157 100644
--- a/src/components/__base__.py
+++ b/src/components/__base__.py
@@ -144,6 +144,11 @@ class Component(QtCore.QObject):
height = int(self.worker.core.settings.value('outputHeight'))
image = Image.new("RGBA", (width, height), (0,0,0,0))
return image
+
+ @classmethod
+ def names(cls):
+ # Alternative names for renaming a component between project files
+ return []
'''
diff --git a/src/components/original.py b/src/components/original.py
index 0185e0d..8450aa1 100644
--- a/src/components/original.py
+++ b/src/components/original.py
@@ -9,10 +9,14 @@ from copy import copy
class Component(__base__.Component):
- '''Original Audio Visualization'''
+ '''Classic Visualizer'''
modified = QtCore.pyqtSignal(int, dict)
+ @classmethod
+ def names(cls):
+ return ['Original Audio Visualization']
+
def widget(self, parent):
self.parent = parent
self.visColor = (255, 255, 255)
diff --git a/src/core.py b/src/core.py
index 47fa01a..b3c5640 100644
--- a/src/core.py
+++ b/src/core.py
@@ -1,5 +1,4 @@
import sys
-import io
import os
from PyQt5 import QtCore, QtGui, uic
from os.path import expanduser
@@ -81,8 +80,15 @@ class Core():
import_module('components.%s' % name)
for name in findComponents()
]
+ # store canonical module names and indexes
self.moduleIndexes = [i for i in range(len(self.modules))]
self.compNames = [mod.Component.__doc__ for mod in self.modules]
+ self.altCompNames = []
+ # store alternative names for modules
+ for i, mod in enumerate(self.modules):
+ if hasattr(mod.Component, 'names'):
+ for name in mod.Component.names():
+ self.altCompNames.append((name, i))
def componentListChanged(self):
for i, component in enumerate(self.selectedComponents):
@@ -132,8 +138,13 @@ class Core():
self.selectedComponents[i].update()
def moduleIndexFor(self, compName):
- index = self.compNames.index(compName)
- return self.moduleIndexes[index]
+ try:
+ index = self.compNames.index(compName)
+ return self.moduleIndexes[index]
+ except ValueError:
+ for altName, modI in self.altCompNames:
+ if altName == compName:
+ return self.moduleIndexes[modI]
def clearPreset(self, compIndex):
self.selectedComponents[compIndex].currentPreset = None
@@ -247,7 +258,7 @@ class Core():
print('file missing value: %s' % value)
return
if hasattr(loader, 'createNewProject'):
- loader.createNewProject()
+ loader.createNewProject(prompt=False)
import traceback
msg = '%s: %s\n\nTraceback:\n' % (typ.__name__, value)
msg += "\n".join(traceback.format_tb(tb))
diff --git a/src/main.py b/src/main.py
index 5b54fc7..fd32b13 100644
--- a/src/main.py
+++ b/src/main.py
@@ -8,11 +8,11 @@ import video_thread
def disableWhenEncoding(func):
- def decorator(*args):
+ def decorator(*args, **kwargs):
if args[0].encoding:
return
else:
- return func(*args)
+ return func(*args, **kwargs)
return decorator
diff --git a/src/mainwindow.py b/src/mainwindow.py
index 203992b..a39f344 100644
--- a/src/mainwindow.py
+++ b/src/mainwindow.py
@@ -644,8 +644,9 @@ class MainWindow(QtWidgets.QMainWindow):
field.blockSignals(False)
@disableWhenEncoding
- def createNewProject(self):
- self.openSaveChangesDialog('starting a new project')
+ def createNewProject(self, prompt=True):
+ if prompt:
+ self.openSaveChangesDialog('starting a new project')
self.clear()
self.currentProject = None