Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Add Icon and After support to upload_options #200

Merged
merged 1 commit into from
Feb 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions pros/cli/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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')
Expand Down