tabreturn / thonny-py5mode

A py5 plug-in for Thonny
Do What The F*ck You Want To Public License
23 stars 8 forks source link

Adding experimental translation/conversion tools #11

Closed villares closed 2 years ago

villares commented 2 years ago

See if this makes sense... The message after command completion warns the user this is "experimental".

Something I'm a bit worried about is that this will fail if the Python interpreter Thonny is running on doesn't have py5. It happened to me, I'm not sure if will be a common occurrence but I could try to check with something like:

try: 
    import py5_tools
    get_workbench().add_command(
      'convert_processingpy_to_imported',
      'py5',
      tr('Convert Py.Processing code to py5 imported mode'),
      convert_processingpy_to_imported,
      group=30,
    )
    get_workbench().add_command(
      'convert_module_to_imported',
      'py5',
      tr('Convert py5 module mode code to imported mode'),
      convert_module_to_imported,
      group=30,
    )
    get_workbench().add_command(
      'convert_imported_to_module',
      'py5',
      tr('Convert py5 imported mode code to module mode'),
      convert_imported_to_module,
      group=30,
    )
except ModuleNotFoundError:
    pass