aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortassaron2017-06-22 19:59:31 -0400
committertassaron2017-06-22 19:59:31 -0400
commitb21a953dda4ec54d494c813af8f687d53d3675d9 (patch)
tree035751e6895bec781c5707ae7be4e6e44ab7e157
parent5c74d496a960042ed4a4279328dc81e23dfdc1d9 (diff)
bugfixes
-rw-r--r--command.py36
-rw-r--r--components/__base__.py4
-rw-r--r--components/text.py4
-rw-r--r--components/video.py1
-rw-r--r--core.py2
-rw-r--r--main.py4
6 files changed, 17 insertions, 34 deletions
diff --git a/command.py b/command.py
index 97eddd2..65fe782 100644
--- a/command.py
+++ b/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'])
diff --git a/components/__base__.py b/components/__base__.py
index e43a517..bdf6fdd 100644
--- a/components/__base__.py
+++ b/components/__base__.py
@@ -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'))
diff --git a/components/text.py b/components/text.py
index 6c465b1..536a9ba 100644
--- a/components/text.py
+++ b/components/text.py
@@ -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(
diff --git a/components/video.py b/components/video.py
index dd385b4..66c98ce 100644
--- a/components/video.py
+++ b/components/video.py
@@ -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")
diff --git a/core.py b/core.py
index 42eb44e..2177071 100644
--- a/core.py
+++ b/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
diff --git a/main.py b/main.py
index e04d002..3fd4234 100644
--- a/main.py
+++ b/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_())