bugfixes
This commit is contained in:
parent
5c74d496a9
commit
b21a953dda
36
command.py
36
command.py
|
@ -16,13 +16,14 @@ class Command(QtCore.QObject):
|
|||
QtCore.QObject.__init__(self)
|
||||
self.core = core.Core()
|
||||
self.dataDir = self.core.dataDir
|
||||
self.canceled = False
|
||||
|
||||
self.parser = argparse.ArgumentParser(
|
||||
description='Create a visualization for an audio file',
|
||||
epilog='EXAMPLE COMMAND: main.py myvideotemplate.avp '
|
||||
'-i ~/Music/song.mp3 -o ~/video.mp4 '
|
||||
'-c 0 image ~/Pictures/thisWeeksPicture.jpg '
|
||||
'-c 1 vis classic')
|
||||
'-c 1 video "preset=My Logo" -c 2 vis classic')
|
||||
self.parser.add_argument(
|
||||
'-i', '--input', metavar='SOUND',
|
||||
help='input audio file', required=True)
|
||||
|
@ -40,35 +41,6 @@ class Command(QtCore.QObject):
|
|||
'"help" for information about possible args', nargs=3,
|
||||
action='append')
|
||||
|
||||
'''
|
||||
self.parser.add_argument(
|
||||
'-b', '--background', dest='bgimage',
|
||||
help='background image file', required=True)
|
||||
self.parser.add_argument(
|
||||
'-t', '--text', dest='text', help='title text', required=True)
|
||||
self.parser.add_argument(
|
||||
'-f', '--font', dest='font', help='title font', required=False)
|
||||
self.parser.add_argument(
|
||||
'-s', '--fontsize', dest='fontsize',
|
||||
help='title font size', required=False)
|
||||
self.parser.add_argument(
|
||||
'-c', '--textcolor', dest='textcolor',
|
||||
help='title text color in r,g,b format', required=False)
|
||||
self.parser.add_argument(
|
||||
'-C', '--viscolor', dest='viscolor',
|
||||
help='visualization color in r,g,b format', required=False)
|
||||
self.parser.add_argument(
|
||||
'-x', '--xposition', dest='xposition',
|
||||
help='x position', required=False)
|
||||
self.parser.add_argument(
|
||||
'-y', '--yposition', dest='yposition',
|
||||
help='y position', required=False)
|
||||
self.parser.add_argument(
|
||||
'-a', '--alignment', dest='alignment',
|
||||
help='title alignment', required=False,
|
||||
type=int, choices=[0, 1, 2])
|
||||
'''
|
||||
|
||||
self.args = self.parser.parse_args()
|
||||
self.settings = QSettings(
|
||||
os.path.join(self.dataDir, 'settings.ini'), QSettings.IniFormat)
|
||||
|
@ -76,6 +48,9 @@ class Command(QtCore.QObject):
|
|||
|
||||
if self.args.projpath:
|
||||
self.core.openProject(self, self.args.projpath)
|
||||
self.core.selectedComponents = list(
|
||||
reversed(self.core.selectedComponents))
|
||||
self.core.componentListChanged()
|
||||
|
||||
if self.args.comp:
|
||||
for comp in self.args.comp:
|
||||
|
@ -111,6 +86,7 @@ class Command(QtCore.QObject):
|
|||
def videoCreated(self):
|
||||
self.videoThread.quit()
|
||||
self.videoThread.wait()
|
||||
quit(0)
|
||||
|
||||
def showMessage(self, **kwargs):
|
||||
print(kwargs['msg'])
|
||||
|
|
|
@ -124,6 +124,10 @@ class Component(QtCore.QObject):
|
|||
self.page = page
|
||||
return page
|
||||
|
||||
def update(self):
|
||||
super().update()
|
||||
self.parent.drawPreview()
|
||||
|
||||
def previewRender(self, previewWorker):
|
||||
width = int(previewWorker.core.settings.value('outputWidth'))
|
||||
height = int(previewWorker.core.settings.value('outputHeight'))
|
||||
|
|
|
@ -19,12 +19,14 @@ class Component(__base__.Component):
|
|||
def widget(self, parent):
|
||||
height = int(parent.settings.value('outputHeight'))
|
||||
width = int(parent.settings.value('outputWidth'))
|
||||
|
||||
self.parent = parent
|
||||
self.textColor = (255, 255, 255)
|
||||
self.title = 'Text'
|
||||
self.alignment = 1
|
||||
self.fontSize = height / 13.5
|
||||
self.xPosition = width / 2
|
||||
fm = QtGui.QFontMetrics(self.titleFont)
|
||||
self.xPosition = width / 2 - fm.width(self.title)/2
|
||||
self.yPosition = height / 2 * 1.036
|
||||
|
||||
page = uic.loadUi(os.path.join(
|
||||
|
|
|
@ -227,6 +227,7 @@ class Component(__base__.Component):
|
|||
if os.path.splitext(arg)[1] in self.core.videoFormats:
|
||||
self.videoPath = arg
|
||||
self.scale = 100
|
||||
self.loopVideo = True
|
||||
return True
|
||||
else:
|
||||
print("Not a supported video format")
|
||||
|
|
2
core.py
2
core.py
|
@ -80,7 +80,7 @@ class Core():
|
|||
|
||||
def insertComponent(self, compPos, moduleIndex, loader):
|
||||
'''Creates a new component'''
|
||||
if compPos < 0:
|
||||
if compPos < 0 or compPos > len(self.selectedComponents):
|
||||
compPos = len(self.selectedComponents)
|
||||
if len(self.selectedComponents) > 50:
|
||||
return None
|
||||
|
|
4
main.py
4
main.py
|
@ -73,10 +73,10 @@ if __name__ == "__main__":
|
|||
window.resize(window.width() * (dpi / 96), window.height() * (dpi / 96))
|
||||
# window.verticalLayout_2.setContentsMargins(0, topMargin, 0, 0)
|
||||
|
||||
main = MainWindow(window, proj)
|
||||
|
||||
signal.signal(signal.SIGINT, main.cleanUp)
|
||||
atexit.register(main.cleanUp)
|
||||
|
||||
main = MainWindow(window, proj)
|
||||
|
||||
# applicable to both modes
|
||||
sys.exit(app.exec_())
|
||||
|
|
Reference in New Issue