eric6/MicroPython/RP2040Devices.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 8122
eb85ced7844c
child 8218
7c09585bd960
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

8122
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de>
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the device interface class for RP2040 based boards
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 (e.g. Raspberry Pi Pico).
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtCore import pyqtSlot
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .MicroPythonDevices import MicroPythonDevice
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .MicroPythonWidget import HAS_QTCHART
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import Preferences
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 class RP2040Device(MicroPythonDevice):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Class implementing the device for RP2040 based boards.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 def __init__(self, microPythonWidget, deviceType, parent=None):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Constructor
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param microPythonWidget reference to the main MicroPython widget
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @type MicroPythonWidget
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param deviceType device type assigned to this device interface
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type str
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @param parent reference to the parent object
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @type QObject
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 super(RP2040Device, self).__init__(
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 microPythonWidget, deviceType, parent)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 def setButtons(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 Public method to enable the supported action buttons.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 super(RP2040Device, self).setButtons()
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.microPython.setActionButtons(
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 run=True, repl=True, files=True, chart=HAS_QTCHART)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 def forceInterrupt(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Public method to determine the need for an interrupt when opening the
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 serial connection.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 @return flag indicating an interrupt is needed
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 @rtype bool
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 return False
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 def deviceName(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 Public method to get the name of the device.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 @return name of the device
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 @rtype str
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 return self.tr("RP2040")
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 def canStartRepl(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 Public method to determine, if a REPL can be started.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 @return tuple containing a flag indicating it is safe to start a REPL
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 and a reason why it cannot.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 @rtype tuple of (bool, str)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 return True, ""
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 def canStartPlotter(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 Public method to determine, if a Plotter can be started.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 @return tuple containing a flag indicating it is safe to start a
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 Plotter and a reason why it cannot.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 @rtype tuple of (bool, str)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 return True, ""
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 def canRunScript(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 Public method to determine, if a script can be executed.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 @return tuple containing a flag indicating it is safe to start a
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 Plotter and a reason why it cannot.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 @rtype tuple of (bool, str)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 return True, ""
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 def runScript(self, script):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 Public method to run the given Python script.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 @param script script to be executed
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 @type str
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 pythonScript = script.split("\n")
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 self.sendCommands(pythonScript)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 def canStartFileManager(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 Public method to determine, if a File Manager can be started.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 @return tuple containing a flag indicating it is safe to start a
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 File Manager and a reason why it cannot.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 @rtype tuple of (bool, str)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 return True, ""
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 def addDeviceMenuEntries(self, menu):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 Public method to add device specific entries to the given menu.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 @param menu reference to the context menu
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 @type QMenu
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 connected = self.microPython.isConnected()
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 act = menu.addAction(self.tr("Activate Bootloader"),
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 self.__activateBootloader)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 act.setEnabled(connected)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 act = menu.addAction(self.tr("Flash Firmware"), self.__flashPython)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 act.setEnabled(not connected)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 def hasFlashMenuEntry(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 Public method to check, if the device has its own flash menu entry.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 @return flag indicating a specific flash menu entry
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 @rtype bool
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 return True
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 @pyqtSlot()
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 def __flashPython(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 Private slot to flash a MicroPython firmware to the device.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 from .UF2FlashDialog import UF2FlashDialog
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 dlg = UF2FlashDialog(boardType="rp2040")
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 dlg.exec()
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 def __activateBootloader(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 Private method to switch the board into 'bootloader' mode.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 if self.microPython.isConnected():
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 self.microPython.commandsInterface().execute([
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 "import machine",
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 "machine.bootloader()",
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 ])
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 # simulate pressing the disconnect button
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.microPython.on_connectButton_clicked()
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 def getDocumentationUrl(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 Public method to get the device documentation URL.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 @return documentation URL of the device
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 @rtype str
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 return Preferences.getMicroPython("MicroPythonDocuUrl")
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 def getDownloadMenuEntries(self):
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 Public method to retrieve the entries for the downloads menu.
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 @return list of tuples with menu text and URL to be opened for each
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 entry
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 @rtype list of tuple of (str, str)
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 """
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 return [
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 (self.tr("MicroPython Firmware"),
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 Preferences.getMicroPython("MicroPythonFirmwareUrl")),
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 ("<separator>", ""),
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 (self.tr("CircuitPython Firmware"),
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 Preferences.getMicroPython("CircuitPythonFirmwareUrl")),
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 (self.tr("CircuitPython Libraries"),
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 Preferences.getMicroPython("CircuitPythonLibrariesUrl"))
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 ]

eric ide

mercurial