From 42853c2582bd6c80e83849753ddb597f94195167 Mon Sep 17 00:00:00 2001 From: BennyBot <48661356+BennyBot@users.noreply.github.com> Date: Mon, 21 Feb 2022 17:58:53 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8Add=20Icon=20and=20After=20support=20t?= =?UTF-8?q?o=20upload=5Foptions=20(#200)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pros/cli/upload.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/pros/cli/upload.py b/pros/cli/upload.py index 215e3d69..63f132a4 100644 --- a/pros/cli/upload.py +++ b/pros/cli/upload.py @@ -58,19 +58,6 @@ def upload(path: Optional[str], project: Optional[c.Project], port: str, **kwarg from pros.serial.ports import DirectPort kwargs['ide_version'] = project.kernel if not project==None else "None" kwargs['ide'] = 'PROS' - name_to_file = { - 'pros' : 'USER902x.bmp', - 'pizza' : 'USER003x.bmp', - 'planet' : 'USER013x.bmp', - 'alien' : 'USER027x.bmp', - 'ufo' : 'USER029x.bmp', - 'clawbot' : 'USER010x.bmp', - 'robot' : 'USER011x.bmp', - 'question' : 'USER002x.bmp', - 'power' : 'USER012x.bmp', - 'X' : 'USER001x.bmp' - } - kwargs['icon'] = name_to_file[kwargs['icon']] if path is None or os.path.isdir(path): if project is None: project_path = c.Project.find_project(path or os.getcwd()) @@ -87,15 +74,31 @@ def upload(path: Optional[str], project: Optional[c.Project], port: str, **kwarg kwargs.pop('slot') elif kwargs.get('slot', None) is None: kwargs['slot'] = 1 + if 'icon' in options and kwargs.get('icon','pros') == 'pros': + kwargs.pop('icon') + if 'after' in options and kwargs.get('after','screen') is None: + kwargs.pop('after') + options.update(kwargs) kwargs = options - kwargs['target'] = project.target # enforce target because uploading to the wrong uC is VERY bad if 'program-version' in kwargs: kwargs['version'] = kwargs['program-version'] if 'remote_name' not in kwargs: kwargs['remote_name'] = project.name - + name_to_file = { + 'pros' : 'USER902x.bmp', + 'pizza' : 'USER003x.bmp', + 'planet' : 'USER013x.bmp', + 'alien' : 'USER027x.bmp', + 'ufo' : 'USER029x.bmp', + 'clawbot' : 'USER010x.bmp', + 'robot' : 'USER011x.bmp', + 'question' : 'USER002x.bmp', + 'power' : 'USER012x.bmp', + 'X' : 'USER001x.bmp' + } + kwargs['icon'] = name_to_file[kwargs['icon']] if 'target' not in kwargs or kwargs['target'] is None: logger(__name__).debug(f'Target not specified. Arguments provided: {kwargs}') raise click.UsageError('Target not specified. specify a project (using the file argument) or target manually')