Fixed wording and icons
This commit is contained in:
@@ -584,9 +584,25 @@ class Files(object):
|
||||
chunk = "b" + chunk
|
||||
self._pyboard.exec_(f"f.write({chunk})")
|
||||
self._pyboard.exec_("f.close()")
|
||||
except Exception as ex:
|
||||
except Exception as e:
|
||||
print(' [x]')
|
||||
raise ex
|
||||
message = str(e)
|
||||
|
||||
if message.find('OSError: [Errno 2] ENOENT') != -1:
|
||||
reason = f'"{filename}" does not exists!'
|
||||
elif message.find('OSError: [Errno 13] EACCES') != -1:
|
||||
reason = f'"{filename}" access denied!'
|
||||
elif message.find('OSError: [Errno 21] EISDIR') != -1:
|
||||
reason = f'"{filename}" is a directory!'
|
||||
else:
|
||||
reason = 'Traceback (most recent call last):'
|
||||
traceback = message.split(reason)
|
||||
|
||||
if len(traceback) == 2:
|
||||
for call in traceback[1][:-2].split('\\r\\n'):
|
||||
reason += f'{call}\n'
|
||||
|
||||
raise Exception(reason.strip())
|
||||
finally:
|
||||
self._pyboard.exit_raw_repl()
|
||||
self.__raw_repl_on = False
|
||||
@@ -645,7 +661,7 @@ class Files(object):
|
||||
import uos as os
|
||||
os.remove('{filename}')
|
||||
"""
|
||||
print(f'↶ {filename}', end='')
|
||||
print(f'– {filename}', end='')
|
||||
|
||||
try:
|
||||
self.__raw_repl_on = True
|
||||
@@ -698,7 +714,7 @@ class Files(object):
|
||||
os.rmdir(directory)
|
||||
rmdir('{directory}')
|
||||
"""
|
||||
print(f'↶ {directory}', end='')
|
||||
print(f'– {directory}', end='')
|
||||
|
||||
try:
|
||||
self.__raw_repl_on = True
|
||||
@@ -864,7 +880,7 @@ def upload(source: str = '', destination: str = ''):
|
||||
|
||||
time.sleep(.5)
|
||||
except Exception as e:
|
||||
print(f'Exeception: upload({source}, {destination}): {str(e)}')
|
||||
print(f'Exception: {str(e)}')
|
||||
|
||||
|
||||
def download(source: str = '/'):
|
||||
@@ -889,7 +905,7 @@ def download(source: str = '/'):
|
||||
|
||||
time.sleep(.5)
|
||||
except Exception as e:
|
||||
print(f'Exeception: download({source}): {str(e)}')
|
||||
print(f'Exception: {str(e)}')
|
||||
|
||||
|
||||
def contents(filename: str):
|
||||
@@ -897,7 +913,7 @@ def contents(filename: str):
|
||||
for ln in pico.get(filename).decode('utf-8').split('\n'):
|
||||
print(ln)
|
||||
except Exception as e:
|
||||
print(f'Exeception: contents({filename}): {str(e)}')
|
||||
print(f'Exception: {str(e)}')
|
||||
|
||||
|
||||
def delete(source: str):
|
||||
@@ -907,7 +923,7 @@ def delete(source: str):
|
||||
else:
|
||||
pico.rm(source)
|
||||
except Exception as e:
|
||||
print(f'Exeception: delete({source}): {str(e)}')
|
||||
print(f'Exception: {str(e)}')
|
||||
|
||||
|
||||
def ls(source: str = '/'):
|
||||
@@ -922,14 +938,14 @@ def ls(source: str = '/'):
|
||||
if len(filename) > 5:
|
||||
print('→', filename)
|
||||
except Exception as e:
|
||||
print(f'Exeception: ls({source}): {str(e)}')
|
||||
print(f'Exception: {str(e)}')
|
||||
|
||||
|
||||
def launch(filename: str = 'main.py'):
|
||||
try:
|
||||
pico.run_on_board(filename)
|
||||
except Exception as e:
|
||||
print(f'Exeception: launch({filename}): {str(e)}')
|
||||
print(f'Exception: {str(e)}')
|
||||
|
||||
|
||||
sessions = {'deleted': set(), 'modified': set()}
|
||||
@@ -1006,10 +1022,10 @@ try:
|
||||
watchdog_callback()
|
||||
case ['status' | 'staged']:
|
||||
for filename in sessions['deleted']:
|
||||
print('del:', filename)
|
||||
print('–', filename)
|
||||
|
||||
for filename in sessions['modified']:
|
||||
print('mod:', filename)
|
||||
print('+', filename)
|
||||
case ['cancel' | 'unstaged']:
|
||||
sessions['deleted'] = set()
|
||||
sessions['modified'] = set()
|
||||
|
||||
Reference in New Issue
Block a user