aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortassaron2017-06-22 20:31:04 -0400
committertassaron2017-06-22 20:31:04 -0400
commit49cda1bf3aa1800459d1085496291bec90ae6a5a (patch)
tree9c7bd4ffb01470f4c92877e22c6d039b7ddb42f1
parentb21a953dda4ec54d494c813af8f687d53d3675d9 (diff)
can send multiple arguments to a component
-rw-r--r--command.py15
-rw-r--r--components/__base__.py3
-rw-r--r--core.py5
3 files changed, 15 insertions, 8 deletions
diff --git a/command.py b/command.py
index 65fe782..9012ca4 100644
--- a/command.py
+++ b/command.py
@@ -36,10 +36,10 @@ class Command(QtCore.QObject):
'projpath', metavar='path-to-project',
help='open a project file (.avp)', nargs='?')
self.parser.add_argument(
- '-c', '--comp', metavar=('LAYER', 'NAME', 'ARG'),
- help='create component NAME at LAYER.'
- '"help" for information about possible args', nargs=3,
- action='append')
+ '-c', '--comp', metavar=('LAYER', 'ARG'),
+ help='first arg must be component NAME to insert at LAYER.'
+ '"help" for information about possible args for a component.',
+ nargs='*', action='append')
self.args = self.parser.parse_args()
self.settings = QSettings(
@@ -54,7 +54,9 @@ class Command(QtCore.QObject):
if self.args.comp:
for comp in self.args.comp:
- pos, name, arg = comp
+ pos = comp[0]
+ name = comp[1]
+ args = comp[2:]
try:
pos = int(pos)
except ValueError:
@@ -66,7 +68,8 @@ class Command(QtCore.QObject):
quit(1)
modI = self.core.moduleIndexFor(realName)
i = self.core.insertComponent(pos, modI, self)
- self.core.selectedComponents[i].command(arg)
+ for arg in args:
+ self.core.selectedComponents[i].command(arg)
self.createAudioVisualisation()
diff --git a/components/__base__.py b/components/__base__.py
index bdf6fdd..5c8865d 100644
--- a/components/__base__.py
+++ b/components/__base__.py
@@ -71,7 +71,8 @@ class Component(QtCore.QObject):
self.core.openPreset(path, self.compPos, preset)
else:
print(
- 'To open a preset for this component:\n'
+ self.__doc__, 'Usage:\n'
+ 'Open a preset for this component:\n'
' "preset=Preset Name"\n')
self.commandHelp()
quit(0)
diff --git a/core.py b/core.py
index 2177071..ba71b82 100644
--- a/core.py
+++ b/core.py
@@ -160,8 +160,11 @@ class Core():
''' loader is the object calling this method which must have
its own showMessage(**kwargs) method for displaying errors.
'''
+ if not os.path.exists(filepath):
+ loader.showMessage(msg='Project file not found')
+ return
+
errcode, data = self.parseAvFile(filepath)
- #print(data)
if errcode == 0:
try:
for i, tup in enumerate(data['Components']):