|
| 1 | +import platform |
| 2 | + |
| 3 | +from thonny import get_workbench |
| 4 | +from thonny.languages import tr |
| 5 | +from thonny.plugins.quecpython.backend.mp_front import ( |
| 6 | + BareMetalMicroPythonConfigPage, |
| 7 | + BareMetalMicroPythonProxy, |
| 8 | + GenericBareMetalMicroPythonConfigPage, |
| 9 | + GenericBareMetalMicroPythonProxy, |
| 10 | + LocalMicroPythonConfigPage, |
| 11 | + LocalMicroPythonProxy, |
| 12 | + MicroPythonProxy, |
| 13 | + SshMicroPythonConfigPage, |
| 14 | + SshMicroPythonProxy, |
| 15 | + add_micropython_backend, |
| 16 | + list_serial_ports, |
| 17 | +) |
| 18 | + |
| 19 | + |
| 20 | +def load_plugin(): |
| 21 | + add_micropython_backend( |
| 22 | + "GenericMicroPython", |
| 23 | + GenericBareMetalMicroPythonProxy, |
| 24 | + tr("MicroPython (generic)"), |
| 25 | + GenericBareMetalMicroPythonConfigPage, |
| 26 | + sort_key="49", |
| 27 | + ) |
| 28 | + |
| 29 | + get_workbench().set_default("serial.last_backend_per_vid_pid", {}) |
| 30 | + |
| 31 | + if platform.system() in ("Linux", "Darwin"): |
| 32 | + add_micropython_backend( |
| 33 | + "LocalMicroPython", |
| 34 | + LocalMicroPythonProxy, |
| 35 | + tr("MicroPython (local)"), |
| 36 | + LocalMicroPythonConfigPage, |
| 37 | + bare_metal=False, |
| 38 | + local_rtc=False, |
| 39 | + sort_key="21", |
| 40 | + ) |
| 41 | + get_workbench().set_default("LocalMicroPython.executable", "micropython") |
| 42 | + |
| 43 | + add_micropython_backend( |
| 44 | + "SshMicroPython", |
| 45 | + SshMicroPythonProxy, |
| 46 | + tr("MicroPython (SSH)"), |
| 47 | + SshMicroPythonConfigPage, |
| 48 | + bare_metal=False, |
| 49 | + local_rtc=False, |
| 50 | + sort_key="22", |
| 51 | + ) |
| 52 | + get_workbench().set_default("SshMicroPython.executable", "micropython") |
| 53 | + get_workbench().set_default("SshMicroPython.cwd", None) |
| 54 | + get_workbench().set_default("SshMicroPython.host", "") |
| 55 | + get_workbench().set_default("SshMicroPython.user", "") |
| 56 | + get_workbench().set_default("SshMicroPython.auth_method", "password") |
| 57 | + get_workbench().set_default("SshMicroPython.make_uploaded_shebang_scripts_executable", True) |
| 58 | + |
| 59 | + get_workbench().set_default("esptool.show_advanced_options", False) |
0 commit comments