aboutsummaryrefslogtreecommitdiff
path: root/command.py
diff options
context:
space:
mode:
authortassaron2017-06-22 18:40:34 -0400
committertassaron2017-06-22 18:40:34 -0400
commit5c74d496a960042ed4a4279328dc81e23dfdc1d9 (patch)
treef11c4f6fe69ab202688b55100ec841bb24f8804f /command.py
parent82011de966f95afa88ec9e11e0ce86cbd04d5fc0 (diff)
preset-loading and basic args from commandline
also made some docstrings more informative
Diffstat (limited to 'command.py')
-rw-r--r--command.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/command.py b/command.py
index d56c64b..97eddd2 100644
--- a/command.py
+++ b/command.py
@@ -36,7 +36,7 @@ class Command(QtCore.QObject):
help='open a project file (.avp)', nargs='?')
self.parser.add_argument(
'-c', '--comp', metavar=('LAYER', 'NAME', 'ARG'),
- help='create/edit component NAME at LAYER.'
+ help='create component NAME at LAYER.'
'"help" for information about possible args', nargs=3,
action='append')
@@ -80,12 +80,18 @@ class Command(QtCore.QObject):
if self.args.comp:
for comp in self.args.comp:
pos, name, arg = comp
+ try:
+ pos = int(pos)
+ except ValueError:
+ print(pos, 'is not a layer number.')
+ quit(1)
realName = self.parseCompName(name)
if not realName:
print(name, 'is not a valid component name.')
- quit()
+ quit(1)
modI = self.core.moduleIndexFor(realName)
- self.core.insertComponent(int(pos), modI, self)
+ i = self.core.insertComponent(pos, modI, self)
+ self.core.selectedComponents[i].command(arg)
self.createAudioVisualisation()
@@ -99,12 +105,12 @@ class Command(QtCore.QObject):
self.videoTask.emit(
self.args.input,
self.args.output,
- self.core.selectedComponents)
+ list(reversed(self.core.selectedComponents))
+ )
def videoCreated(self):
self.videoThread.quit()
self.videoThread.wait()
- self.cleanUp()
def showMessage(self, **kwargs):
print(kwargs['msg'])
@@ -114,22 +120,20 @@ class Command(QtCore.QObject):
def drawPreview(self, *args):
pass
- def cleanUp(self, *args):
- pass
-
def parseCompName(self, name):
'''Deduces a proper component name out of a commandline arg'''
- compFileNames = [ \
- os.path.splitext(os.path.basename(
- mod.__file__))[0] \
- for mod in self.core.modules \
- ]
if name.title() in self.core.compNames:
return name.title()
for compName in self.core.compNames:
if name.capitalize() in compName:
return compName
+
+ compFileNames = [ \
+ os.path.splitext(os.path.basename(
+ mod.__file__))[0] \
+ for mod in self.core.modules \
+ ]
for i, compFileName in enumerate(compFileNames):
if name.lower() in compFileName:
return self.core.compNames[i]