eric6/MicroPython/MicroPythonDevices.py

Sun, 07 Feb 2021 17:34:51 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 07 Feb 2021 17:34:51 +0100
changeset 8084
7742e0b96629
parent 8082
2242a6a1d786
child 8092
c0d72dbba8bb
permissions
-rw-r--r--

MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.

7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7787
diff changeset
3 # Copyright (c) 2019 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing some utility functions and the MicroPythonDevice base
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 class.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import logging
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
12 import os
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
14 from PyQt5.QtCore import pyqtSlot, QObject, QCoreApplication
8062
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
15 from PyQt5.QtWidgets import QInputDialog
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
17 from E5Gui.E5Application import e5App
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
18
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import UI.PixmapCache
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
20 import Preferences
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 SupportedBoards = {
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 "esp": {
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 "ids": [
8024
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
26 (0x0403, 0x6001), # M5Stack ESP32 device"),
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
27 (0x0403, 0x6001), # FT232/FT245 (XinaBox CW01, CW02)
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
28 (0x0403, 0x6010), # FT2232C/D/L/HL/Q (ESP-WROVER-KIT)
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
29 (0x0403, 0x6011), # FT4232
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
30 (0x0403, 0x6014), # FT232H
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
31 (0x0403, 0x6015), # Sparkfun ESP32
8024
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
32 (0x0403, 0x601C), # FT4222H
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
33 (0x10C4, 0xEA60), # CP210x
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
34 (0x1A86, 0x7523), # HL-340
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 ],
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
36 "description": "ESP32, ESP8266",
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 "icon": "esp32Device",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
38 "port_description": "",
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 },
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
41 "circuitpython": {
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 "ids": [
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
43 (0x04D8, 0xEAD1), # BH Dynamics DynOSSAT-EDU-EPS-v1.0
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
44 (0x04D8, 0xEAD2), # BH Dynamics DynOSSAT-EDU-OBC-v1.0
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
45 (0x04D8, 0xEC44), # maholli PyCubed
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
46 (0x04D8, 0xEC63), # Kevin Neubauer CircuitBrains Basic
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
47 (0x04D8, 0xEC64), # Kevin Neubauer CircuitBrains Deluxe
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
48 (0x04D8, 0xEC72), # XinaBox CC03
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
49 (0x04D8, 0xEC75), # XinaBox CS11
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
50 (0x04D8, 0xED5F), # Itaca Innovation uChip CircuitPython
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
51 (0x04D8, 0xED94), # maholli kicksat-sprite
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
52 (0x04D8, 0xEDB3), # Capable Robot Programmable USB Hub
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
53 (0x04D8, 0xEDBE), # maholli SAM32
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
54 (0x04D8, 0xEE8C), # J&J Studios LLC datum-Distance
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
55 (0x04D8, 0xEE8D), # J&J Studios LLC datum-IMU
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
56 (0x04D8, 0xEE8E), # J&J Studios LLC datum-Light
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
57 (0x04D8, 0xEE8F), # J&J Studios LLC datum-Weather
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
58 (0x054C, 0x0BC2), # Sony Spresense
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
59 (0x1209, 0x2017), # Benjamin Shockley Mini SAM M4
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
60 (0x1209, 0x3252), # Targett Module Clip w/Wroom
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
61 (0x1209, 0x3253), # Targett Module Clip w/Wrover
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
62 (0x1209, 0x4D43), # Robotics Masters Robo HAT MM1 M4
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
63 (0x1209, 0x4DDD), # ODT CP Sapling
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
64 (0x1209, 0x4DDE), # ODT CP Sapling M0 w/ SPI Flash
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
65 (0x1209, 0x5BF0), # Foosn Fomu
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
66 (0x1209, 0x805A), # Electronic Cats BastBLE
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
67 (0x1209, 0xBAB0), # Electronic Cats Bast WiFi
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
68 (0x1209, 0xBAB1), # Electronic Cats Meow Meow
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
69 (0x1209, 0xBAB2), # Electronic Cats CatWAN USBStick
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
70 (0x1209, 0xBAB3), # Electronic Cats Bast Pro Mini M0
8024
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
71 (0x1209, 0xBAB6), # Electronic Cats Escornabot Makech
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
72 (0x1209, 0xBAB8), # Electronic Cats NFC Copy Cat
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
73 (0x1209, 0xC051), # Betrusted Simmel
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
74 (0x1209, 0xE3E3), # StackRduino M0 PRO
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
75 (0x1209, 0xF500), # Silicognition LLC M4-Shim
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
76 (0x1915, 0xB001), # Makerdiary Pitaya Go
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
77 (0x1B4F, 0x0015), # SparkFun RedBoard Turbo Board
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
78 (0x1B4F, 0x0016), # SparkFun SAMD51 Thing+
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
79 (0x1B4F, 0x0017), # SparkFun LUMIDrive Board
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
80 (0x1B4F, 0x5289), # SparkFun SFE_nRF52840_Mini
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
81 (0x1B4F, 0x8D22), # SparkFun SAMD21 Mini Breakout
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
82 (0x1B4F, 0x8D23), # SparkFun SAMD21 Dev Breakout
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
83 (0x1B4F, 0x8D24), # SparkFun Qwiic Micro
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
84 (0x1D50, 0x60E8), # Radomir Dopieralski PewPew M4
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
85 (0x2341, 0x8053), # Arduino MKR1300
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
86 (0x2341, 0x8057), # Arduino Nano 33 IoT
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
87 (0x2341, 0x805A), # Arduino Arduino_Nano_33_BLE
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
88 (0x2341, 0x824D), # Arduino Zero
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
89 (0x2786, 0x9207), # Switch Sc. BLE-SS dev board Multi Sensor
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
90 (0x2886, 0x002F), # Seeed Seeeduino XIAO
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
91 (0x2886, 0x802D), # Seeed Seeeduino Wio Terminal
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
92 (0x2886, 0xF001), # Makerdiary nRF52840 M.2 Developer Kit
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
93 (0x2886, 0xF002), # Makerdiary M60 Keyboard
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
94 (0x2B04, 0xC00C), # Particle Argon
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
95 (0x2B04, 0xC00D), # Particle Boron
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
96 (0x2B04, 0xC00E), # Particle Xenon
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
97 (0x303A, 0x8007), # LILYGO TTGO T8 ESP32-S2
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
98 (0x3171, 0x0101), # 8086 Consultancy Commander
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
99 (0x31E2, 0x2001), # BDMICRO LLC VINA-D21
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
100 (0x31E2, 0x2011), # BDMICRO LLC VINA-D51
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
101 (0x32BD, 0x3001), # Alorium Tech. AloriumTech Evo M51
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
102 (0x4097, 0x0001), # TG-Boards Datalore IP M4
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
103
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
104 (0x239A, None), # Any Adafruit Boards
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 ],
8055
52fdd41517f3 MicroPython: made the value shown in the deveice selection list more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8051
diff changeset
106 "description": "CircuitPython",
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
107 "icon": "circuitPythonDevice",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
108 "port_description": "",
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 },
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 "bbc_microbit": {
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 "ids": [
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
113 (0x0D28, 0x0204), # micro:bit
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 ],
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 "description": "BBC micro:bit",
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 "icon": "microbitDevice",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
117 "port_description": "BBC micro:bit CMSIS-DAP",
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 },
7295
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
119
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
120 "calliope": {
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
121 "ids": [
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
122 (0x0D28, 0x0204), # Calliope mini
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
123 ],
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
124 "description": "Calliope mini",
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
125 "icon": "calliope_mini",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
126 "port_description": "DAPLink CMSIS-DAP",
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
127 },
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
128
7295
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
129 "pyboard": {
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
130 "ids": [
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
131 (0xF055, 0x9800), # Pyboard in CDC mode
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
132 (0xF055, 0x9801), # Pyboard in CDC+HID mode
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
133 (0xF055, 0x9802), # Pyboard in CDC+MSC mode
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
134 ],
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
135 "description": "PyBoard",
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
136 "icon": "micropython48",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
137 "port_description": "",
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
138 },
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
139
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
140 "generic": {
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
141 # only manually configured devices use this
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
142 "ids": [],
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
143 "description": QCoreApplication.translate(
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
144 "MicroPythonDevice", "Generic Board"),
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
145 "icon": "micropython48",
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
146 "port_description": "",
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
147 },
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 }
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149
7787
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
150 IgnoredBoards = (
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
151 (0x8086, 0x9c3d),
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
152 )
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
153
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 def getSupportedDevices():
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 Function to get a list of supported MicroPython devices.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 @return set of tuples with the board type and description
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 @rtype set of tuples of (str, str)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 boards = []
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 for board in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 boards.append(
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 (board, SupportedBoards[board]["description"]))
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 return boards
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 def getFoundDevices():
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 Function to check the serial ports for supported MicroPython devices.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
173 @return tuple containing a list of tuples with the board type, a
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
174 description and the serial port it is connected at for known device
7592
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
175 types and a list of tuples with VID, PID and description for unknown
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
176 devices
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
177 @rtype tuple of (list of tuples of (str, str, str), list of tuples of
7592
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
178 (int, int, str)
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 from PyQt5.QtSerialPort import QSerialPortInfo
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 foundDevices = []
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
183 unknownDevices = []
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
185 manualDevices = {}
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
186 for deviceDict in Preferences.getMicroPython("ManualDevices"):
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
187 manualDevices[(deviceDict["vid"], deviceDict["pid"])] = deviceDict
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
188
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 availablePorts = QSerialPortInfo.availablePorts()
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 for port in availablePorts:
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
191 supported = False
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 vid = port.vendorIdentifier()
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 pid = port.productIdentifier()
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 for board in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 if ((vid, pid) in SupportedBoards[board]["ids"] or
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 (vid, None) in SupportedBoards[board]["ids"]):
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
197 if board in ("bbc_microbit", "calliope"):
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
198 # both boards have the same VID and PID
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
199 # try to differentiate based on port description
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
200 if (
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
201 port.description().strip() !=
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
202 SupportedBoards[board]["port_description"]
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
203 ):
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
204 continue
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
205 foundDevices.append((
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
206 board,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
207 port.description(),
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
208 SupportedBoards[board]["description"],
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
209 port.portName(),
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
210 vid,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
211 pid,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
212 ))
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
213 supported = True
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
214 if not supported:
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
215 # check the locally added ones next
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
216 if (vid, pid) in manualDevices:
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
217 board = manualDevices[(vid, pid)]["type"]
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
218 foundDevices.append((
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
219 board,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
220 port.description(),
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
221 SupportedBoards[board]["description"],
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
222 port.portName(),
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
223 vid,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
224 pid,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
225 ))
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
226 supported = True
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
227 if not supported:
7787
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
228 if vid and pid and (vid, pid) not in IgnoredBoards:
7592
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
229 unknownDevices.append((vid, pid, port.description()))
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
230 logging.debug("Unknown device: (0x%04x:0x%04x %s)",
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
231 vid, pid, port.description())
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
233 return foundDevices, unknownDevices
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 def getDeviceIcon(boardName, iconFormat=True):
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 Function to get the icon for the given board.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 @param boardName name of the board
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 @type str
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 @param iconFormat flag indicating to get an icon or a pixmap
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 @type bool
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 @return icon for the board (iconFormat == True) or
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 a pixmap (iconFormat == False)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 @rtype QIcon or QPixmap
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 if boardName in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 iconName = SupportedBoards[boardName]["icon"]
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 else:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 # return a generic MicroPython icon
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 iconName = "micropython48"
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 if iconFormat:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 return UI.PixmapCache.getIcon(iconName)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 else:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 return UI.PixmapCache.getPixmap(iconName)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
260 def getDevice(deviceType, microPythonWidget, vid, pid):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 Public method to instantiate a specific MicroPython device interface.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 @param deviceType type of the device interface
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 @type str
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
266 @param microPythonWidget reference to the main MicroPython widget
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
267 @type MicroPythonWidget
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
268 @param vid vendor ID (only used for deviceType 'generic')
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
269 @type int
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
270 @param pid product ID (only used for deviceType 'generic')
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
271 @type int
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 @return instantiated device interface
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 @rtype MicroPythonDevice
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
275 if deviceType == "esp":
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
276 from .EspDevices import EspDevice
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
277 return EspDevice(microPythonWidget)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
278 elif deviceType == "circuitpython":
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
279 from .CircuitPythonDevices import CircuitPythonDevice
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
280 return CircuitPythonDevice(microPythonWidget)
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
281 elif deviceType in ("bbc_microbit", "calliope"):
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
282 from .MicrobitDevices import MicrobitDevice
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
283 return MicrobitDevice(microPythonWidget, deviceType)
7295
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
284 elif deviceType == "pyboard":
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
285 from .PyBoardDevices import PyBoardDevice
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
286 return PyBoardDevice(microPythonWidget)
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
287 elif deviceType == "generic":
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
288 from .GenericMicroPythonDevices import GenericMicroPythonDevice
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
289 return GenericMicroPythonDevice(microPythonWidget, vid, pid)
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
290 else:
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
291 # nothing specific requested
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
292 return MicroPythonDevice(microPythonWidget)
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 class MicroPythonDevice(QObject):
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 Base class for the more specific MicroPython devices.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
299 def __init__(self, microPythonWidget, parent=None):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 Constructor
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
303 @param microPythonWidget reference to the main MicroPython widget
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
304 @type MicroPythonWidget
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 @param parent reference to the parent object
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 @type QObject
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 super(MicroPythonDevice, self).__init__(parent)
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
309
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
310 self.microPython = microPythonWidget
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
312 def setButtons(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
314 Public method to enable the supported action buttons.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
316 self.microPython.setActionButtons(
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
317 open=False, save=False,
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
318 run=False, repl=False, files=False, chart=False)
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
320 def forceInterrupt(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
322 Public method to determine the need for an interrupt when opening the
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
323 serial connection.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
325 @return flag indicating an interrupt is needed
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
326 @rtype bool
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
327 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
328 return True
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
329
7125
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
330 def deviceName(self):
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
331 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
332 Public method to get the name of the device.
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
333
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
334 @return name of the device
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
335 @rtype str
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
336 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
337 return self.tr("Unsupported Device")
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
338
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
339 def canStartRepl(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
341 Public method to determine, if a REPL can be started.
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
342
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
343 @return tuple containing a flag indicating it is safe to start a REPL
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
344 and a reason why it cannot.
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
345 @rtype tuple of (bool, str)
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
346 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
347 return False, self.tr("REPL is not supported by this device.")
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
348
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
349 def setRepl(self, on):
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
350 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
351 Public method to set the REPL status and dependent status.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
353 @param on flag indicating the active status
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
354 @type bool
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
355 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
356 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
357
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
358 def canStartPlotter(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
359 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
360 Public method to determine, if a Plotter can be started.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
361
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
362 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
363 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
364 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
365 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
366 return False, self.tr("Plotter is not supported by this device.")
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
367
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
368 def setPlotter(self, on):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
369 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
370 Public method to set the Plotter status and dependent status.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
371
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
372 @param on flag indicating the active status
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
373 @type bool
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
374 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
375 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
376
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
377 def canRunScript(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
378 """
7091
84d2a73b448a EspDevices, MicroPythonDevices: fixed a wrong source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7082
diff changeset
379 Public method to determine, if a script can be executed.
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
380
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
381 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
382 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
383 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
384 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
385 return False, self.tr("Running scripts is not supported by this"
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
386 " device.")
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
387
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
388 def runScript(self, script):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
389 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
390 Public method to run the given Python script.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
391
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
392 @param script script to be executed
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
393 @type str
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
394 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
395 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
396
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
397 def canStartFileManager(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
398 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
399 Public method to determine, if a File Manager can be started.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
400
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
401 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
402 File Manager and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
403 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
404 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
405 return False, self.tr("File Manager is not supported by this device.")
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
406
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
407 def setFileManager(self, on):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
408 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
409 Public method to set the File Manager status and dependent status.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
410
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
411 @param on flag indicating the active status
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
412 @type bool
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
413 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
414 pass
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
415
7129
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
416 def supportsLocalFileAccess(self):
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
417 """
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
418 Public method to indicate file access via a local directory.
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
419
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
420 @return flag indicating file access via local directory
7145
ceb3e8b242c1 Regenerated source docu after merge with 'micropython' branch.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
421 @rtype bool
7129
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
422 """
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
423 return False # default
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
424
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
425 def getWorkspace(self):
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
426 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
427 Public method to get the workspace directory.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
429 @return workspace directory used for saving files
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 @rtype str
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 """
8067
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
432 return (
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
433 Preferences.getMicroPython("MpyWorkspace") or
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
434 Preferences.getMultiProject("Workspace") or
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
435 os.path.expanduser("~")
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
436 )
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
437
8062
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
438 def selectDeviceDirectory(self, deviceDirectories):
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
439 """
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
440 Public method to select the device directory from a list of detected
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
441 ones.
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
442
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
443 @param deviceDirectories list of directories to select from
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
444 @type list of str
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
445 @return selected directory or an empty string
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
446 @rtype str
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
447 """
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
448 deviceDirectory, ok = QInputDialog.getItem(
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
449 None,
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
450 self.tr("Select Device Directory"),
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
451 self.tr("Select the directory for the connected device:"),
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
452 [""] + deviceDirectories,
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
453 0, False)
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
454 if ok:
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
455 return deviceDirectory
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
456 else:
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
457 # user cancelled
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
458 return ""
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
459
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
460 def sendCommands(self, commandsList):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
461 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
462 Public method to send a list of commands to the device.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
463
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
464 @param commandsList list of commands to be sent to the device
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
465 @type list of str
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
466 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
467 rawOn = [ # sequence of commands to enter raw mode
7068
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
468 b'\x02', # Ctrl-B: exit raw repl (just in case)
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
469 b'\r\x03\x03\x03', # Ctrl-C three times: interrupt any running
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
470 # program
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
471 b'\r\x01', # Ctrl-A: enter raw REPL
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
472 ]
7065
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
473 newLine = [b'print("\\n")\r', ]
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
474 commands = [c.encode("utf-8)") + b'\r' for c in commandsList]
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
475 commands.append(b'\r')
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
476 commands.append(b'\x04')
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
477 rawOff = [b'\x02']
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
478 commandSequence = rawOn + newLine + commands + rawOff
7095
8e10acb1cd85 Refactored and improved the MicroPython code to be able to show the file manager and the REPL simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7091
diff changeset
479 self.microPython.commandsInterface().executeAsync(commandSequence)
7065
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
480
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
481 @pyqtSlot()
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
482 def handleDataFlood(self):
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
483 """
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
484 Public slot handling a data floof from the device.
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
485 """
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
486 pass
7082
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
487
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7095
diff changeset
488 def addDeviceMenuEntries(self, menu):
7082
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
489 """
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
490 Public method to add device specific entries to the given menu.
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
491
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
492 @param menu reference to the context menu
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
493 @type QMenu
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
494 """
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
495 pass
7123
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
496
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
497 def hasTimeCommands(self):
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
498 """
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
499 Public method to check, if the device supports time commands.
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
500
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
501 The default returns True.
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
502
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
503 @return flag indicating support for time commands
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
504 @rtype bool
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
505 """
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
506 return True
7161
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
507
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
508 def hasDocumentationUrl(self):
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
509 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
510 Public method to check, if the device has a configured documentation
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
511 URL.
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
512
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
513 @return flag indicating a configured documentation URL
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
514 @rtype bool
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
515 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
516 return bool(self.getDocumentationUrl())
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
517
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
518 def getDocumentationUrl(self):
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
519 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
520 Public method to get the device documentation URL.
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
521
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
522 @return documentation URL of the device
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
523 @rtype str
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
524 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
525 return ""
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
526
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
527 def hasFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
528 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
529 Public method to check, if the device has a configured firmware
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
530 download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
531
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
532 @return flag indicating a configured firmware download URL
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
533 @rtype bool
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
534 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
535 return bool(self.getFirmwareUrl())
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
536
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
537 def getFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
538 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
539 Public method to get the device firmware download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
540
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
541 @return firmware download URL of the device
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
542 @rtype str
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
543 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
544 return ""
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
545
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
546 def downloadFirmware(self):
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
547 """
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
548 Public method to download the device firmware.
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
549 """
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
550 url = self.getFirmwareUrl()
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
551 if url:
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
552 e5App().getObject("UserInterface").launchHelpViewer(url)
8051
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
553
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
554 def getDownloadMenuEntries(self):
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
555 """
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
556 Public method to retrieve the entries for the downloads menu.
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
557
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
558 @return list of tuples with menu text and URL to be opened for each
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
559 entry
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
560 @rtype list of tuple of (str, str)
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
561 """
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
562 return []

eric ide

mercurial