renamed Original Audio Visualization to Classic Visualizer

This commit is contained in:
tassaron 2017-06-25 18:12:16 -04:00
parent f284acbf19
commit 252639e9a2
5 changed files with 30 additions and 9 deletions

View File

@ -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 []
'''

View File

@ -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)

View File

@ -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))

View File

@ -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

View File

@ -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