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