diff options
| -rw-r--r-- | command.py | 15 | ||||
| -rw-r--r-- | components/__base__.py | 3 | ||||
| -rw-r--r-- | core.py | 5 |
3 files changed, 15 insertions, 8 deletions
@@ -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) @@ -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']): |
