remove % from log calls
This commit is contained in:
parent
c07f2426ce
commit
d4b63e4d46
|
@ -40,11 +40,11 @@ class ComponentMetaclass(type(QtCore.QObject)):
|
||||||
def renderWrapper(func):
|
def renderWrapper(func):
|
||||||
def renderWrapper(self, *args, **kwargs):
|
def renderWrapper(self, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
log.verbose('### %s #%s renders%s frame %s###' % (
|
log.verbose('### %s #%s renders%s frame %s###',
|
||||||
self.__class__.name, str(self.compPos),
|
self.__class__.name, str(self.compPos),
|
||||||
'' if args else ' a preview',
|
'' if args else ' a preview',
|
||||||
'' if not args else '%s ' % args[0],
|
'' if not args else '%s ' % args[0],
|
||||||
))
|
)
|
||||||
return func(self, *args, **kwargs)
|
return func(self, *args, **kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
try:
|
try:
|
||||||
|
@ -170,7 +170,7 @@ class ComponentMetaclass(type(QtCore.QObject)):
|
||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
for widgetList in self.comp._allWidgets.values():
|
for widgetList in self.comp._allWidgets.values():
|
||||||
for widget in widgetList:
|
for widget in widgetList:
|
||||||
log.verbose('Connecting %s' % str(
|
log.verbose('Connecting %s', str(
|
||||||
widget.__class__.__name__))
|
widget.__class__.__name__))
|
||||||
connectWidget(widget, self.comp.update)
|
connectWidget(widget, self.comp.update)
|
||||||
|
|
||||||
|
@ -230,16 +230,18 @@ class ComponentMetaclass(type(QtCore.QObject)):
|
||||||
try:
|
try:
|
||||||
if 'version' not in attrs:
|
if 'version' not in attrs:
|
||||||
log.error(
|
log.error(
|
||||||
'No version attribute in %s. Defaulting to 1' %
|
'No version attribute in %s. Defaulting to 1',
|
||||||
attrs['name'])
|
attrs['name'])
|
||||||
attrs['version'] = 1
|
attrs['version'] = 1
|
||||||
else:
|
else:
|
||||||
attrs['version'] = int(attrs['version'].split('.')[0])
|
attrs['version'] = int(attrs['version'].split('.')[0])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
log.critical('%s component has an invalid version string:\n%s' % (
|
log.critical(
|
||||||
attrs['name'], str(attrs['version'])))
|
'%s component has an invalid version string:\n%s',
|
||||||
|
attrs['name'], str(attrs['version'])
|
||||||
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.critical('%s component has no version string.' % attrs['name'])
|
log.critical('%s component has no version string.', attrs['name'])
|
||||||
else:
|
else:
|
||||||
return super().__new__(cls, name, parents, attrs)
|
return super().__new__(cls, name, parents, attrs)
|
||||||
quit(1)
|
quit(1)
|
||||||
|
@ -384,9 +386,9 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass):
|
||||||
'''
|
'''
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.settings = parent.settings
|
self.settings = parent.settings
|
||||||
log.verbose('Creating UI for %s #%s\'s widget' % (
|
log.verbose('Creating UI for %s #%s\'s widget',
|
||||||
self.name, self.compPos
|
self.name, self.compPos
|
||||||
))
|
)
|
||||||
self.page = self.loadUi(self.__class__.ui)
|
self.page = self.loadUi(self.__class__.ui)
|
||||||
|
|
||||||
# Find all normal widgets which will be connected after subclass method
|
# Find all normal widgets which will be connected after subclass method
|
||||||
|
@ -702,7 +704,7 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass):
|
||||||
can make determining the 'previous' value tricky.
|
can make determining the 'previous' value tricky.
|
||||||
'''
|
'''
|
||||||
if self.oldAttrs is not None:
|
if self.oldAttrs is not None:
|
||||||
log.verbose('Using nonstandard oldAttr for %s' % attr)
|
log.verbose('Using nonstandard oldAttr for %s', attr)
|
||||||
return self.oldAttrs[attr]
|
return self.oldAttrs[attr]
|
||||||
else:
|
else:
|
||||||
return getattr(self, attr)
|
return getattr(self, attr)
|
||||||
|
@ -723,8 +725,9 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass):
|
||||||
and oldRelativeVal != newRelativeVal:
|
and oldRelativeVal != newRelativeVal:
|
||||||
# Float changed without pixel value changing, which
|
# Float changed without pixel value changing, which
|
||||||
# means the pixel value needs to be updated
|
# means the pixel value needs to be updated
|
||||||
log.debug('Updating %s #%s\'s relative widget: %s' % (
|
log.debug(
|
||||||
self.name, self.compPos, attr))
|
'Updating %s #%s\'s relative widget: %s',
|
||||||
|
self.name, self.compPos, attr)
|
||||||
with blockSignals(self._trackedWidgets[attr]):
|
with blockSignals(self._trackedWidgets[attr]):
|
||||||
self.updateRelativeWidgetMaximum(attr)
|
self.updateRelativeWidgetMaximum(attr)
|
||||||
pixelVal = self.pixelValForAttr(attr, oldRelativeVal)
|
pixelVal = self.pixelValForAttr(attr, oldRelativeVal)
|
||||||
|
@ -828,9 +831,8 @@ class ComponentUpdate(QtWidgets.QUndoCommand):
|
||||||
self.modifiedVals[attr] = val
|
self.modifiedVals[attr] = val
|
||||||
else:
|
else:
|
||||||
log.warning(
|
log.warning(
|
||||||
'%s component settings changed at once. (%s)' % (
|
'%s component settings changed at once. (%s)',
|
||||||
len(self.modifiedVals), repr(self.modifiedVals)
|
len(self.modifiedVals), repr(self.modifiedVals)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def id(self):
|
def id(self):
|
||||||
|
|
19
src/core.py
19
src/core.py
|
@ -77,7 +77,8 @@ class Core:
|
||||||
if type(component) is int:
|
if type(component) is int:
|
||||||
# create component using module index in self.modules
|
# create component using module index in self.modules
|
||||||
moduleIndex = int(component)
|
moduleIndex = int(component)
|
||||||
log.debug('Creating new component from module #%s' % moduleIndex)
|
log.debug(
|
||||||
|
'Creating new component from module #%s', str(moduleIndex))
|
||||||
component = self.modules[moduleIndex].Component(
|
component = self.modules[moduleIndex].Component(
|
||||||
moduleIndex, compPos, self
|
moduleIndex, compPos, self
|
||||||
)
|
)
|
||||||
|
@ -85,7 +86,7 @@ class Core:
|
||||||
else:
|
else:
|
||||||
moduleIndex = -1
|
moduleIndex = -1
|
||||||
log.debug(
|
log.debug(
|
||||||
'Inserting previously-created %s component' % component.name)
|
'Inserting previously-created %s component', component.name)
|
||||||
|
|
||||||
component._error.connect(
|
component._error.connect(
|
||||||
loader.videoThreadError
|
loader.videoThreadError
|
||||||
|
@ -117,8 +118,9 @@ class Core:
|
||||||
self.componentListChanged()
|
self.componentListChanged()
|
||||||
|
|
||||||
def updateComponent(self, i):
|
def updateComponent(self, i):
|
||||||
log.debug('Auto-updating %s #%s' % (
|
log.debug(
|
||||||
self.selectedComponents[i], str(i)))
|
'Auto-updating %s #%s',
|
||||||
|
self.selectedComponents[i], str(i))
|
||||||
self.selectedComponents[i].update(auto=True)
|
self.selectedComponents[i].update(auto=True)
|
||||||
|
|
||||||
def moduleIndexFor(self, compName):
|
def moduleIndexFor(self, compName):
|
||||||
|
@ -146,9 +148,8 @@ class Core:
|
||||||
)
|
)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
log.warning(
|
log.warning(
|
||||||
'%s #%s\'s preset is missing value: %s' % (
|
'%s #%s\'s preset is missing value: %s',
|
||||||
comp.name, str(compIndex), str(e)
|
comp.name, str(compIndex), str(e)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.savedPresets[presetName] = dict(saveValueStore)
|
self.savedPresets[presetName] = dict(saveValueStore)
|
||||||
|
@ -266,7 +267,7 @@ class Core:
|
||||||
Returns dictionary with section names as the keys, each one
|
Returns dictionary with section names as the keys, each one
|
||||||
contains a list of tuples: (compName, version, compPresetDict)
|
contains a list of tuples: (compName, version, compPresetDict)
|
||||||
'''
|
'''
|
||||||
log.debug('Parsing av file: %s' % filepath)
|
log.debug('Parsing av file: %s', filepath)
|
||||||
validSections = (
|
validSections = (
|
||||||
'Components',
|
'Components',
|
||||||
'Settings',
|
'Settings',
|
||||||
|
@ -385,7 +386,7 @@ class Core:
|
||||||
|
|
||||||
def createProjectFile(self, filepath, window=None):
|
def createProjectFile(self, filepath, window=None):
|
||||||
'''Create a project file (.avp) using the current program state'''
|
'''Create a project file (.avp) using the current program state'''
|
||||||
log.info('Creating %s' % filepath)
|
log.info('Creating %s', filepath)
|
||||||
settingsKeys = [
|
settingsKeys = [
|
||||||
'componentDir',
|
'componentDir',
|
||||||
'inputDir',
|
'inputDir',
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
'''
|
'''
|
||||||
from PyQt5.QtWidgets import QUndoCommand
|
from PyQt5.QtWidgets import QUndoCommand
|
||||||
import os
|
import os
|
||||||
|
from copy import copy
|
||||||
|
|
||||||
from core import Core
|
from core import Core
|
||||||
|
|
||||||
|
@ -132,7 +133,7 @@ class OpenPreset(QUndoCommand):
|
||||||
|
|
||||||
comp = self.parent.core.selectedComponents[compI]
|
comp = self.parent.core.selectedComponents[compI]
|
||||||
self.store = comp.savePreset()
|
self.store = comp.savePreset()
|
||||||
self.store['preset'] = str(comp.currentPreset)
|
self.store['preset'] = copy(comp.currentPreset)
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self.parent._openPreset(self.presetName, self.compI)
|
self.parent._openPreset(self.presetName, self.compI)
|
||||||
|
|
|
@ -387,30 +387,46 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int, dict)
|
@QtCore.pyqtSlot(int, dict)
|
||||||
def updateComponentTitle(self, pos, presetStore=False):
|
def updateComponentTitle(self, pos, presetStore=False):
|
||||||
|
'''
|
||||||
|
Sets component title to modified or unmodified when given boolean.
|
||||||
|
If given a preset dict, compares it against the component to
|
||||||
|
determine if it is modified.
|
||||||
|
A component with no preset is always unmodified.
|
||||||
|
'''
|
||||||
if type(presetStore) is dict:
|
if type(presetStore) is dict:
|
||||||
name = presetStore['preset']
|
name = presetStore['preset']
|
||||||
if name is None or name not in self.core.savedPresets:
|
if name is None or name not in self.core.savedPresets:
|
||||||
modified = False
|
modified = False
|
||||||
else:
|
else:
|
||||||
modified = (presetStore != self.core.savedPresets[name])
|
modified = (presetStore != self.core.savedPresets[name])
|
||||||
|
if modified:
|
||||||
|
log.verbose(
|
||||||
|
'Differing values between presets: %s',
|
||||||
|
", ".join([
|
||||||
|
'%s: %s' % item for item in presetStore.items()
|
||||||
|
if val != self.core.savedPresets[name][key]
|
||||||
|
])
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
modified = bool(presetStore)
|
modified = bool(presetStore)
|
||||||
if pos < 0:
|
if pos < 0:
|
||||||
pos = len(self.core.selectedComponents)-1
|
pos = len(self.core.selectedComponents)-1
|
||||||
name = str(self.core.selectedComponents[pos])
|
name = self.core.selectedComponents[pos].name
|
||||||
title = str(name)
|
title = str(name)
|
||||||
if self.core.selectedComponents[pos].currentPreset:
|
if self.core.selectedComponents[pos].currentPreset:
|
||||||
title += ' - %s' % self.core.selectedComponents[pos].currentPreset
|
title += ' - %s' % self.core.selectedComponents[pos].currentPreset
|
||||||
if modified:
|
if modified:
|
||||||
title += '*'
|
title += '*'
|
||||||
if type(presetStore) is bool:
|
if type(presetStore) is bool:
|
||||||
log.debug('Forcing %s #%s\'s modified status to %s: %s' % (
|
log.debug(
|
||||||
|
'Forcing %s #%s\'s modified status to %s: %s',
|
||||||
name, pos, modified, title
|
name, pos, modified, title
|
||||||
))
|
)
|
||||||
else:
|
else:
|
||||||
log.debug('Setting %s #%s\'s title: %s' % (
|
log.debug(
|
||||||
|
'Setting %s #%s\'s title: %s',
|
||||||
name, pos, title
|
name, pos, title
|
||||||
))
|
)
|
||||||
self.window.listWidget_componentList.item(pos).setText(title)
|
self.window.listWidget_componentList.item(pos).setText(title)
|
||||||
|
|
||||||
def updateCodecs(self):
|
def updateCodecs(self):
|
||||||
|
|
|
@ -210,7 +210,7 @@ class PresetManager(QtWidgets.QDialog):
|
||||||
def _openPreset(self, presetName, index):
|
def _openPreset(self, presetName, index):
|
||||||
selectedComponents = self.core.selectedComponents
|
selectedComponents = self.core.selectedComponents
|
||||||
|
|
||||||
componentName = str(selectedComponents[index]).strip()
|
componentName = selectedComponents[index].name.strip()
|
||||||
version = selectedComponents[index].version
|
version = selectedComponents[index].version
|
||||||
dirname = os.path.join(self.presetDir, componentName, str(version))
|
dirname = os.path.join(self.presetDir, componentName, str(version))
|
||||||
filepath = os.path.join(dirname, presetName)
|
filepath = os.path.join(dirname, presetName)
|
||||||
|
|
|
@ -29,15 +29,19 @@ class blockSignals:
|
||||||
)
|
)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
log.verbose('Blocking signals for %s' % ", ".join([
|
log.verbose(
|
||||||
str(w.__class__.__name__) for w in self.widgets
|
'Blocking signals for %s',
|
||||||
]))
|
", ".join([
|
||||||
|
str(w.__class__.__name__) for w in self.widgets
|
||||||
|
])
|
||||||
|
)
|
||||||
self.oldStates = [w.signalsBlocked() for w in self.widgets]
|
self.oldStates = [w.signalsBlocked() for w in self.widgets]
|
||||||
for w in self.widgets:
|
for w in self.widgets:
|
||||||
w.blockSignals(True)
|
w.blockSignals(True)
|
||||||
|
|
||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
log.verbose('Resetting blockSignals to %s' % sum(self.oldStates))
|
log.verbose(
|
||||||
|
'Resetting blockSignals to %s', str(bool(sum(self.oldStates))))
|
||||||
for w, state in zip(self.widgets, self.oldStates):
|
for w, state in zip(self.widgets, self.oldStates):
|
||||||
w.blockSignals(state)
|
w.blockSignals(state)
|
||||||
|
|
||||||
|
@ -153,7 +157,7 @@ def connectWidget(widget, func):
|
||||||
elif type(widget) == QtWidgets.QComboBox:
|
elif type(widget) == QtWidgets.QComboBox:
|
||||||
widget.currentIndexChanged.connect(func)
|
widget.currentIndexChanged.connect(func)
|
||||||
else:
|
else:
|
||||||
log.warning('Failed to connect %s ' % str(widget.__class__.__name__))
|
log.warning('Failed to connect %s ', str(widget.__class__.__name__))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -171,7 +175,7 @@ def setWidgetValue(widget, val):
|
||||||
elif type(widget) == QtWidgets.QComboBox:
|
elif type(widget) == QtWidgets.QComboBox:
|
||||||
widget.setCurrentIndex(val)
|
widget.setCurrentIndex(val)
|
||||||
else:
|
else:
|
||||||
log.warning('Failed to set %s ' % str(widget.__class__.__name__))
|
log.warning('Failed to set %s ', str(widget.__class__.__name__))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class FfmpegVideo:
|
||||||
from component import ComponentError
|
from component import ComponentError
|
||||||
logFilename = os.path.join(
|
logFilename = os.path.join(
|
||||||
core.Core.logDir, 'render_%s.log' % str(self.component.compPos))
|
core.Core.logDir, 'render_%s.log' % str(self.component.compPos))
|
||||||
log.debug('Creating ffmpeg process (log at %s)' % logFilename)
|
log.debug('Creating ffmpeg process (log at %s)', logFilename)
|
||||||
with open(logFilename, 'w') as logf:
|
with open(logFilename, 'w') as logf:
|
||||||
logf.write(" ".join(self.command) + '\n\n')
|
logf.write(" ".join(self.command) + '\n\n')
|
||||||
with open(logFilename, 'a') as logf:
|
with open(logFilename, 'a') as logf:
|
||||||
|
|
|
@ -179,7 +179,7 @@ class Worker(QtCore.QObject):
|
||||||
for num, component in enumerate(reversed(self.components))
|
for num, component in enumerate(reversed(self.components))
|
||||||
])
|
])
|
||||||
print('Loaded Components:', initText)
|
print('Loaded Components:', initText)
|
||||||
log.info('Calling preFrameRender for %s' % initText)
|
log.info('Calling preFrameRender for %s', initText)
|
||||||
self.staticComponents = {}
|
self.staticComponents = {}
|
||||||
for compNo, comp in enumerate(reversed(self.components)):
|
for compNo, comp in enumerate(reversed(self.components)):
|
||||||
try:
|
try:
|
||||||
|
@ -221,12 +221,13 @@ class Worker(QtCore.QObject):
|
||||||
|
|
||||||
if self.canceled:
|
if self.canceled:
|
||||||
if canceledByComponent:
|
if canceledByComponent:
|
||||||
log.error('Export cancelled by component #%s (%s): %s' % (
|
log.error(
|
||||||
|
'Export cancelled by component #%s (%s): %s',
|
||||||
compNo,
|
compNo,
|
||||||
comp.name,
|
comp.name,
|
||||||
'No message.' if comp.error() is None else (
|
'No message.' if comp.error() is None else (
|
||||||
comp.error() if type(comp.error()) is str
|
comp.error() if type(comp.error()) is str
|
||||||
else comp.error()[0])
|
else comp.error()[0]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.cancelExport()
|
self.cancelExport()
|
||||||
|
|
Reference in New Issue