|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.MicroPython.MicroPythonWidget</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.MicroPython.MicroPythonWidget</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the MicroPython REPL widget. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>AnsiColorSchemes</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#MicroPythonWidget">MicroPythonWidget</a></td> |
|
25 <td>Class implementing the MicroPython REPL widget.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="MicroPythonWidget" ID="MicroPythonWidget"></a> |
|
36 <h2>MicroPythonWidget</h2> |
|
37 |
|
38 <p> |
|
39 Class implementing the MicroPython REPL widget. |
|
40 </p> |
|
41 <h3>Signals</h3> |
|
42 <dl> |
|
43 |
|
44 <dt>dataReceived(data)</dt> |
|
45 <dd> |
|
46 emitted to send data received via the serial |
|
47 connection for further processing |
|
48 </dd> |
|
49 </dl> |
|
50 <h3>Derived from</h3> |
|
51 QWidget, Ui_MicroPythonWidget |
|
52 <h3>Class Attributes</h3> |
|
53 |
|
54 <table> |
|
55 <tr><td>DeviceBoardRole</td></tr><tr><td>DevicePidRole</td></tr><tr><td>DevicePortRole</td></tr><tr><td>DeviceTypeRole</td></tr><tr><td>DeviceVidRole</td></tr><tr><td>ManualMarker</td></tr><tr><td>ZoomMax</td></tr><tr><td>ZoomMin</td></tr> |
|
56 </table> |
|
57 <h3>Class Methods</h3> |
|
58 |
|
59 <table> |
|
60 <tr><td>None</td></tr> |
|
61 </table> |
|
62 <h3>Methods</h3> |
|
63 |
|
64 <table> |
|
65 |
|
66 <tr> |
|
67 <td><a href="#MicroPythonWidget.__init__">MicroPythonWidget</a></td> |
|
68 <td>Constructor</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#MicroPythonWidget.__aboutToShowSuperMenu">__aboutToShowSuperMenu</a></td> |
|
72 <td>Private slot to populate the Super Menu before showing it.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#MicroPythonWidget.__addUnknownDevices">__addUnknownDevices</a></td> |
|
76 <td>Private method to add devices to the list of manually added boards.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#MicroPythonWidget.__clear">__clear</a></td> |
|
80 <td>Private slot to clear the REPL pane.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#MicroPythonWidget.__compileEditor2Mpy">__compileEditor2Mpy</a></td> |
|
84 <td>Private slot to cross compile the current editor to a .mpy file.</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#MicroPythonWidget.__compileFile2Mpy">__compileFile2Mpy</a></td> |
|
88 <td>Private slot to cross compile a Python file (*.py) to a .mpy file.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#MicroPythonWidget.__configure">__configure</a></td> |
|
92 <td>Private slot to open the MicroPython configuration page.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#MicroPythonWidget.__connectToDevice">__connectToDevice</a></td> |
|
96 <td>Private method to connect to the selected device.</td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td><a href="#MicroPythonWidget.__crossCompile">__crossCompile</a></td> |
|
100 <td>Private method to cross compile a Python file to a .mpy file.</td> |
|
101 </tr> |
|
102 <tr> |
|
103 <td><a href="#MicroPythonWidget.__disconnectFromDevice">__disconnectFromDevice</a></td> |
|
104 <td>Private method to disconnect from the device.</td> |
|
105 </tr> |
|
106 <tr> |
|
107 <td><a href="#MicroPythonWidget.__doZoom">__doZoom</a></td> |
|
108 <td>Private slot to zoom the REPL pane.</td> |
|
109 </tr> |
|
110 <tr> |
|
111 <td><a href="#MicroPythonWidget.__downloadFirmware">__downloadFirmware</a></td> |
|
112 <td>Private slot to open the firmware download page.</td> |
|
113 </tr> |
|
114 <tr> |
|
115 <td><a href="#MicroPythonWidget.__downloadFromUrl">__downloadFromUrl</a></td> |
|
116 <td>Private method to open a web browser for the given URL.</td> |
|
117 </tr> |
|
118 <tr> |
|
119 <td><a href="#MicroPythonWidget.__flashUF2">__flashUF2</a></td> |
|
120 <td>Private slot to flash MicroPython/CircuitPython to a device support the UF2 bootloader.</td> |
|
121 </tr> |
|
122 <tr> |
|
123 <td><a href="#MicroPythonWidget.__getDeviceTime">__getDeviceTime</a></td> |
|
124 <td>Private method to get a string containing the date and time of the connected device.</td> |
|
125 </tr> |
|
126 <tr> |
|
127 <td><a href="#MicroPythonWidget.__handlePreferencesChanged">__handlePreferencesChanged</a></td> |
|
128 <td>Private slot to handle a change in preferences.</td> |
|
129 </tr> |
|
130 <tr> |
|
131 <td><a href="#MicroPythonWidget.__manageIgnored">__manageIgnored</a></td> |
|
132 <td>Private slot to manage the list of ignored serial devices.</td> |
|
133 </tr> |
|
134 <tr> |
|
135 <td><a href="#MicroPythonWidget.__manageUnknownDevices">__manageUnknownDevices</a></td> |
|
136 <td>Private slot to manage manually added boards (i.e.</td> |
|
137 </tr> |
|
138 <tr> |
|
139 <td><a href="#MicroPythonWidget.__mpyCrossAvailable">__mpyCrossAvailable</a></td> |
|
140 <td>Private method to check the availability of mpy-cross.</td> |
|
141 </tr> |
|
142 <tr> |
|
143 <td><a href="#MicroPythonWidget.__paste">__paste</a></td> |
|
144 <td>Private slot to perform a paste operation.</td> |
|
145 </tr> |
|
146 <tr> |
|
147 <td><a href="#MicroPythonWidget.__populateDeviceTypeComboBox">__populateDeviceTypeComboBox</a></td> |
|
148 <td>Private method to populate the device type selector.</td> |
|
149 </tr> |
|
150 <tr> |
|
151 <td><a href="#MicroPythonWidget.__processData">__processData</a></td> |
|
152 <td>Private slot to process bytes received from the device.</td> |
|
153 </tr> |
|
154 <tr> |
|
155 <td><a href="#MicroPythonWidget.__replEditMouseReleaseEvent">__replEditMouseReleaseEvent</a></td> |
|
156 <td>Private method handling mouse release events for the replEdit widget.</td> |
|
157 </tr> |
|
158 <tr> |
|
159 <td><a href="#MicroPythonWidget.__setCharFormat">__setCharFormat</a></td> |
|
160 <td>Private method setting the current text format of the REPL pane based on the passed ANSI codes.</td> |
|
161 </tr> |
|
162 <tr> |
|
163 <td><a href="#MicroPythonWidget.__setConnected">__setConnected</a></td> |
|
164 <td>Private method to set the connection status LED.</td> |
|
165 </tr> |
|
166 <tr> |
|
167 <td><a href="#MicroPythonWidget.__showBoardInformation">__showBoardInformation</a></td> |
|
168 <td>Private slot to show all available information about a board.</td> |
|
169 </tr> |
|
170 <tr> |
|
171 <td><a href="#MicroPythonWidget.__showContextMenu">__showContextMenu</a></td> |
|
172 <td>Private slot to show the REPL context menu.</td> |
|
173 </tr> |
|
174 <tr> |
|
175 <td><a href="#MicroPythonWidget.__showDeviceTime">__showDeviceTime</a></td> |
|
176 <td>Private slot to show the date and time of the connected device.</td> |
|
177 </tr> |
|
178 <tr> |
|
179 <td><a href="#MicroPythonWidget.__showDeviceVersion">__showDeviceVersion</a></td> |
|
180 <td>Private slot to show some version info about MicroPython of the device.</td> |
|
181 </tr> |
|
182 <tr> |
|
183 <td><a href="#MicroPythonWidget.__showDocumentation">__showDocumentation</a></td> |
|
184 <td>Private slot to open the documentation URL for the selected device.</td> |
|
185 </tr> |
|
186 <tr> |
|
187 <td><a href="#MicroPythonWidget.__showError">__showError</a></td> |
|
188 <td>Private method to show some error message.</td> |
|
189 </tr> |
|
190 <tr> |
|
191 <td><a href="#MicroPythonWidget.__showImplementation">__showImplementation</a></td> |
|
192 <td>Private slot to show some implementation related information.</td> |
|
193 </tr> |
|
194 <tr> |
|
195 <td><a href="#MicroPythonWidget.__showLocalAndDeviceTime">__showLocalAndDeviceTime</a></td> |
|
196 <td>Private slot to show the local and device time side-by-side.</td> |
|
197 </tr> |
|
198 <tr> |
|
199 <td><a href="#MicroPythonWidget.__showLocalTime">__showLocalTime</a></td> |
|
200 <td>Private slot to show the local date and time.</td> |
|
201 </tr> |
|
202 <tr> |
|
203 <td><a href="#MicroPythonWidget.__showNoDeviceMessage">__showNoDeviceMessage</a></td> |
|
204 <td>Private method to show a message dialog indicating a missing device.</td> |
|
205 </tr> |
|
206 <tr> |
|
207 <td><a href="#MicroPythonWidget.__synchronizeTime">__synchronizeTime</a></td> |
|
208 <td>Private slot to set the time of the connected device to the local computer's time.</td> |
|
209 </tr> |
|
210 <tr> |
|
211 <td><a href="#MicroPythonWidget.commandsInterface">commandsInterface</a></td> |
|
212 <td>Public method to get a reference to the commands interface object.</td> |
|
213 </tr> |
|
214 <tr> |
|
215 <td><a href="#MicroPythonWidget.eventFilter">eventFilter</a></td> |
|
216 <td>Public method to process events for the REPL pane.</td> |
|
217 </tr> |
|
218 <tr> |
|
219 <td><a href="#MicroPythonWidget.getCurrentBoard">getCurrentBoard</a></td> |
|
220 <td>Public method to get the board name of the selected device.</td> |
|
221 </tr> |
|
222 <tr> |
|
223 <td><a href="#MicroPythonWidget.getCurrentPort">getCurrentPort</a></td> |
|
224 <td>Public method to determine the port path of the selected device.</td> |
|
225 </tr> |
|
226 <tr> |
|
227 <td><a href="#MicroPythonWidget.getDeviceWorkspace">getDeviceWorkspace</a></td> |
|
228 <td>Public method to get the workspace directory of the device.</td> |
|
229 </tr> |
|
230 <tr> |
|
231 <td><a href="#MicroPythonWidget.handleDataFlood">handleDataFlood</a></td> |
|
232 <td>Public slot handling a data flood from the device.</td> |
|
233 </tr> |
|
234 <tr> |
|
235 <td><a href="#MicroPythonWidget.isConnected">isConnected</a></td> |
|
236 <td>Public method to get the connection state.</td> |
|
237 </tr> |
|
238 <tr> |
|
239 <td><a href="#MicroPythonWidget.isMicrobit">isMicrobit</a></td> |
|
240 <td>Public method to check, if the connected/selected device is a BBC micro:bit or Calliope mini.</td> |
|
241 </tr> |
|
242 <tr> |
|
243 <td><a href="#MicroPythonWidget.on_chartButton_clicked">on_chartButton_clicked</a></td> |
|
244 <td>Private slot to open a chart view to plot data received from the connected device.</td> |
|
245 </tr> |
|
246 <tr> |
|
247 <td><a href="#MicroPythonWidget.on_checkButton_clicked">on_checkButton_clicked</a></td> |
|
248 <td>Private slot to check for connected devices.</td> |
|
249 </tr> |
|
250 <tr> |
|
251 <td><a href="#MicroPythonWidget.on_connectButton_clicked">on_connectButton_clicked</a></td> |
|
252 <td>Private slot to connect to the selected device or disconnect from the currently connected device.</td> |
|
253 </tr> |
|
254 <tr> |
|
255 <td><a href="#MicroPythonWidget.on_deviceTypeComboBox_activated">on_deviceTypeComboBox_activated</a></td> |
|
256 <td>Private slot handling the selection of a device type.</td> |
|
257 </tr> |
|
258 <tr> |
|
259 <td><a href="#MicroPythonWidget.on_filesButton_clicked">on_filesButton_clicked</a></td> |
|
260 <td>Private slot to open a file manager window to the connected device.</td> |
|
261 </tr> |
|
262 <tr> |
|
263 <td><a href="#MicroPythonWidget.on_openButton_clicked">on_openButton_clicked</a></td> |
|
264 <td>Private slot to open a file of the connected device.</td> |
|
265 </tr> |
|
266 <tr> |
|
267 <td><a href="#MicroPythonWidget.on_replButton_clicked">on_replButton_clicked</a></td> |
|
268 <td>Private slot to connect to enable or disable the REPL widget.</td> |
|
269 </tr> |
|
270 <tr> |
|
271 <td><a href="#MicroPythonWidget.on_runButton_clicked">on_runButton_clicked</a></td> |
|
272 <td>Private slot to execute the script of the active editor on the selected device.</td> |
|
273 </tr> |
|
274 <tr> |
|
275 <td><a href="#MicroPythonWidget.on_saveButton_clicked">on_saveButton_clicked</a></td> |
|
276 <td>Private slot to save the current editor to the connected device.</td> |
|
277 </tr> |
|
278 <tr> |
|
279 <td><a href="#MicroPythonWidget.setActionButtons">setActionButtons</a></td> |
|
280 <td>Public method to set the enabled state of the various action buttons.</td> |
|
281 </tr> |
|
282 </table> |
|
283 <h3>Static Methods</h3> |
|
284 |
|
285 <table> |
|
286 <tr><td>None</td></tr> |
|
287 </table> |
|
288 |
|
289 <a NAME="MicroPythonWidget.__init__" ID="MicroPythonWidget.__init__"></a> |
|
290 <h4>MicroPythonWidget (Constructor)</h4> |
|
291 <b>MicroPythonWidget</b>(<i>parent=None</i>) |
|
292 |
|
293 <p> |
|
294 Constructor |
|
295 </p> |
|
296 <dl> |
|
297 |
|
298 <dt><i>parent</i> (QWidget)</dt> |
|
299 <dd> |
|
300 reference to the parent widget |
|
301 </dd> |
|
302 </dl> |
|
303 <a NAME="MicroPythonWidget.__aboutToShowSuperMenu" ID="MicroPythonWidget.__aboutToShowSuperMenu"></a> |
|
304 <h4>MicroPythonWidget.__aboutToShowSuperMenu</h4> |
|
305 <b>__aboutToShowSuperMenu</b>(<i></i>) |
|
306 |
|
307 <p> |
|
308 Private slot to populate the Super Menu before showing it. |
|
309 </p> |
|
310 <a NAME="MicroPythonWidget.__addUnknownDevices" ID="MicroPythonWidget.__addUnknownDevices"></a> |
|
311 <h4>MicroPythonWidget.__addUnknownDevices</h4> |
|
312 <b>__addUnknownDevices</b>(<i>devices</i>) |
|
313 |
|
314 <p> |
|
315 Private method to add devices to the list of manually added boards. |
|
316 </p> |
|
317 <dl> |
|
318 |
|
319 <dt><i>devices</i> (list of tuple of (int, int, str))</dt> |
|
320 <dd> |
|
321 list of not ignored but unknown devices |
|
322 </dd> |
|
323 </dl> |
|
324 <a NAME="MicroPythonWidget.__clear" ID="MicroPythonWidget.__clear"></a> |
|
325 <h4>MicroPythonWidget.__clear</h4> |
|
326 <b>__clear</b>(<i></i>) |
|
327 |
|
328 <p> |
|
329 Private slot to clear the REPL pane. |
|
330 </p> |
|
331 <a NAME="MicroPythonWidget.__compileEditor2Mpy" ID="MicroPythonWidget.__compileEditor2Mpy"></a> |
|
332 <h4>MicroPythonWidget.__compileEditor2Mpy</h4> |
|
333 <b>__compileEditor2Mpy</b>(<i></i>) |
|
334 |
|
335 <p> |
|
336 Private slot to cross compile the current editor to a .mpy file. |
|
337 </p> |
|
338 <a NAME="MicroPythonWidget.__compileFile2Mpy" ID="MicroPythonWidget.__compileFile2Mpy"></a> |
|
339 <h4>MicroPythonWidget.__compileFile2Mpy</h4> |
|
340 <b>__compileFile2Mpy</b>(<i></i>) |
|
341 |
|
342 <p> |
|
343 Private slot to cross compile a Python file (*.py) to a .mpy file. |
|
344 </p> |
|
345 <a NAME="MicroPythonWidget.__configure" ID="MicroPythonWidget.__configure"></a> |
|
346 <h4>MicroPythonWidget.__configure</h4> |
|
347 <b>__configure</b>(<i></i>) |
|
348 |
|
349 <p> |
|
350 Private slot to open the MicroPython configuration page. |
|
351 </p> |
|
352 <a NAME="MicroPythonWidget.__connectToDevice" ID="MicroPythonWidget.__connectToDevice"></a> |
|
353 <h4>MicroPythonWidget.__connectToDevice</h4> |
|
354 <b>__connectToDevice</b>(<i></i>) |
|
355 |
|
356 <p> |
|
357 Private method to connect to the selected device. |
|
358 </p> |
|
359 <a NAME="MicroPythonWidget.__crossCompile" ID="MicroPythonWidget.__crossCompile"></a> |
|
360 <h4>MicroPythonWidget.__crossCompile</h4> |
|
361 <b>__crossCompile</b>(<i>pythonFile="", title=""</i>) |
|
362 |
|
363 <p> |
|
364 Private method to cross compile a Python file to a .mpy file. |
|
365 </p> |
|
366 <dl> |
|
367 |
|
368 <dt><i>pythonFile</i> (str)</dt> |
|
369 <dd> |
|
370 name of the Python file to be compiled |
|
371 </dd> |
|
372 <dt><i>title</i> (str)</dt> |
|
373 <dd> |
|
374 title for the various dialogs |
|
375 </dd> |
|
376 </dl> |
|
377 <a NAME="MicroPythonWidget.__disconnectFromDevice" ID="MicroPythonWidget.__disconnectFromDevice"></a> |
|
378 <h4>MicroPythonWidget.__disconnectFromDevice</h4> |
|
379 <b>__disconnectFromDevice</b>(<i></i>) |
|
380 |
|
381 <p> |
|
382 Private method to disconnect from the device. |
|
383 </p> |
|
384 <a NAME="MicroPythonWidget.__doZoom" ID="MicroPythonWidget.__doZoom"></a> |
|
385 <h4>MicroPythonWidget.__doZoom</h4> |
|
386 <b>__doZoom</b>(<i>value</i>) |
|
387 |
|
388 <p> |
|
389 Private slot to zoom the REPL pane. |
|
390 </p> |
|
391 <dl> |
|
392 |
|
393 <dt><i>value</i> (int)</dt> |
|
394 <dd> |
|
395 zoom value |
|
396 </dd> |
|
397 </dl> |
|
398 <a NAME="MicroPythonWidget.__downloadFirmware" ID="MicroPythonWidget.__downloadFirmware"></a> |
|
399 <h4>MicroPythonWidget.__downloadFirmware</h4> |
|
400 <b>__downloadFirmware</b>(<i></i>) |
|
401 |
|
402 <p> |
|
403 Private slot to open the firmware download page. |
|
404 </p> |
|
405 <a NAME="MicroPythonWidget.__downloadFromUrl" ID="MicroPythonWidget.__downloadFromUrl"></a> |
|
406 <h4>MicroPythonWidget.__downloadFromUrl</h4> |
|
407 <b>__downloadFromUrl</b>(<i>url</i>) |
|
408 |
|
409 <p> |
|
410 Private method to open a web browser for the given URL. |
|
411 </p> |
|
412 <dl> |
|
413 |
|
414 <dt><i>url</i> (str)</dt> |
|
415 <dd> |
|
416 URL to be opened |
|
417 </dd> |
|
418 </dl> |
|
419 <a NAME="MicroPythonWidget.__flashUF2" ID="MicroPythonWidget.__flashUF2"></a> |
|
420 <h4>MicroPythonWidget.__flashUF2</h4> |
|
421 <b>__flashUF2</b>(<i></i>) |
|
422 |
|
423 <p> |
|
424 Private slot to flash MicroPython/CircuitPython to a device |
|
425 support the UF2 bootloader. |
|
426 </p> |
|
427 <a NAME="MicroPythonWidget.__getDeviceTime" ID="MicroPythonWidget.__getDeviceTime"></a> |
|
428 <h4>MicroPythonWidget.__getDeviceTime</h4> |
|
429 <b>__getDeviceTime</b>(<i></i>) |
|
430 |
|
431 <p> |
|
432 Private method to get a string containing the date and time of the |
|
433 connected device. |
|
434 </p> |
|
435 <dl> |
|
436 <dt>Return:</dt> |
|
437 <dd> |
|
438 date and time of the connected device |
|
439 </dd> |
|
440 </dl> |
|
441 <dl> |
|
442 <dt>Return Type:</dt> |
|
443 <dd> |
|
444 str |
|
445 </dd> |
|
446 </dl> |
|
447 <a NAME="MicroPythonWidget.__handlePreferencesChanged" ID="MicroPythonWidget.__handlePreferencesChanged"></a> |
|
448 <h4>MicroPythonWidget.__handlePreferencesChanged</h4> |
|
449 <b>__handlePreferencesChanged</b>(<i></i>) |
|
450 |
|
451 <p> |
|
452 Private slot to handle a change in preferences. |
|
453 </p> |
|
454 <a NAME="MicroPythonWidget.__manageIgnored" ID="MicroPythonWidget.__manageIgnored"></a> |
|
455 <h4>MicroPythonWidget.__manageIgnored</h4> |
|
456 <b>__manageIgnored</b>(<i></i>) |
|
457 |
|
458 <p> |
|
459 Private slot to manage the list of ignored serial devices. |
|
460 </p> |
|
461 <a NAME="MicroPythonWidget.__manageUnknownDevices" ID="MicroPythonWidget.__manageUnknownDevices"></a> |
|
462 <h4>MicroPythonWidget.__manageUnknownDevices</h4> |
|
463 <b>__manageUnknownDevices</b>(<i></i>) |
|
464 |
|
465 <p> |
|
466 Private slot to manage manually added boards (i.e. those not in the |
|
467 list of supported boards). |
|
468 </p> |
|
469 <a NAME="MicroPythonWidget.__mpyCrossAvailable" ID="MicroPythonWidget.__mpyCrossAvailable"></a> |
|
470 <h4>MicroPythonWidget.__mpyCrossAvailable</h4> |
|
471 <b>__mpyCrossAvailable</b>(<i></i>) |
|
472 |
|
473 <p> |
|
474 Private method to check the availability of mpy-cross. |
|
475 </p> |
|
476 <dl> |
|
477 <dt>Return:</dt> |
|
478 <dd> |
|
479 flag indicating the availability of mpy-cross |
|
480 </dd> |
|
481 </dl> |
|
482 <dl> |
|
483 <dt>Return Type:</dt> |
|
484 <dd> |
|
485 bool |
|
486 </dd> |
|
487 </dl> |
|
488 <a NAME="MicroPythonWidget.__paste" ID="MicroPythonWidget.__paste"></a> |
|
489 <h4>MicroPythonWidget.__paste</h4> |
|
490 <b>__paste</b>(<i>mode=QClipboard.Mode.Clipboard</i>) |
|
491 |
|
492 <p> |
|
493 Private slot to perform a paste operation. |
|
494 </p> |
|
495 <dl> |
|
496 |
|
497 <dt><i>mode</i> (QClipboard.Mode (optional))</dt> |
|
498 <dd> |
|
499 paste mode (defaults to QClipboard.Mode.Clipboard) |
|
500 </dd> |
|
501 </dl> |
|
502 <a NAME="MicroPythonWidget.__populateDeviceTypeComboBox" ID="MicroPythonWidget.__populateDeviceTypeComboBox"></a> |
|
503 <h4>MicroPythonWidget.__populateDeviceTypeComboBox</h4> |
|
504 <b>__populateDeviceTypeComboBox</b>(<i></i>) |
|
505 |
|
506 <p> |
|
507 Private method to populate the device type selector. |
|
508 </p> |
|
509 <a NAME="MicroPythonWidget.__processData" ID="MicroPythonWidget.__processData"></a> |
|
510 <h4>MicroPythonWidget.__processData</h4> |
|
511 <b>__processData</b>(<i>data</i>) |
|
512 |
|
513 <p> |
|
514 Private slot to process bytes received from the device. |
|
515 </p> |
|
516 <dl> |
|
517 |
|
518 <dt><i>data</i> (bytes)</dt> |
|
519 <dd> |
|
520 bytes received from the device |
|
521 </dd> |
|
522 </dl> |
|
523 <a NAME="MicroPythonWidget.__replEditMouseReleaseEvent" ID="MicroPythonWidget.__replEditMouseReleaseEvent"></a> |
|
524 <h4>MicroPythonWidget.__replEditMouseReleaseEvent</h4> |
|
525 <b>__replEditMouseReleaseEvent</b>(<i>evt</i>) |
|
526 |
|
527 <p> |
|
528 Private method handling mouse release events for the replEdit widget. |
|
529 </p> |
|
530 <p> |
|
531 Note: this is a hack because QTextEdit does not allow filtering of |
|
532 QEvent.Type.MouseButtonRelease. To make middle button paste work, we |
|
533 had to intercept the protected event method (some kind of |
|
534 reimplementing it). |
|
535 </p> |
|
536 <dl> |
|
537 |
|
538 <dt><i>evt</i> (QMouseEvent)</dt> |
|
539 <dd> |
|
540 reference to the event object |
|
541 </dd> |
|
542 </dl> |
|
543 <a NAME="MicroPythonWidget.__setCharFormat" ID="MicroPythonWidget.__setCharFormat"></a> |
|
544 <h4>MicroPythonWidget.__setCharFormat</h4> |
|
545 <b>__setCharFormat</b>(<i>formatCodes, textCursor</i>) |
|
546 |
|
547 <p> |
|
548 Private method setting the current text format of the REPL pane based |
|
549 on the passed ANSI codes. |
|
550 </p> |
|
551 <p> |
|
552 Following codes are used: |
|
553 <ul> |
|
554 <li>0: Reset</li> |
|
555 <li>1: Bold font (weight 75)</li> |
|
556 <li>2: Light font (weight 25)</li> |
|
557 <li>3: Italic font</li> |
|
558 <li>4: Underlined font</li> |
|
559 <li>9: Strikeout font</li> |
|
560 <li>21: Bold off (weight 50)</li> |
|
561 <li>22: Light off (weight 50)</li> |
|
562 <li>23: Italic off</li> |
|
563 <li>24: Underline off</li> |
|
564 <li>29: Strikeout off</li> |
|
565 <li>30: foreground Black</li> |
|
566 <li>31: foreground Dark Red</li> |
|
567 <li>32: foreground Dark Green</li> |
|
568 <li>33: foreground Dark Yellow</li> |
|
569 <li>34: foreground Dark Blue</li> |
|
570 <li>35: foreground Dark Magenta</li> |
|
571 <li>36: foreground Dark Cyan</li> |
|
572 <li>37: foreground Light Gray</li> |
|
573 <li>39: reset foreground to default</li> |
|
574 <li>40: background Black</li> |
|
575 <li>41: background Dark Red</li> |
|
576 <li>42: background Dark Green</li> |
|
577 <li>43: background Dark Yellow</li> |
|
578 <li>44: background Dark Blue</li> |
|
579 <li>45: background Dark Magenta</li> |
|
580 <li>46: background Dark Cyan</li> |
|
581 <li>47: background Light Gray</li> |
|
582 <li>49: reset background to default</li> |
|
583 <li>53: Overlined font</li> |
|
584 <li>55: Overline off</li> |
|
585 <li>90: bright foreground Dark Gray</li> |
|
586 <li>91: bright foreground Red</li> |
|
587 <li>92: bright foreground Green</li> |
|
588 <li>93: bright foreground Yellow</li> |
|
589 <li>94: bright foreground Blue</li> |
|
590 <li>95: bright foreground Magenta</li> |
|
591 <li>96: bright foreground Cyan</li> |
|
592 <li>97: bright foreground White</li> |
|
593 <li>100: bright background Dark Gray</li> |
|
594 <li>101: bright background Red</li> |
|
595 <li>102: bright background Green</li> |
|
596 <li>103: bright background Yellow</li> |
|
597 <li>104: bright background Blue</li> |
|
598 <li>105: bright background Magenta</li> |
|
599 <li>106: bright background Cyan</li> |
|
600 <li>107: bright background White</li> |
|
601 </ul> |
|
602 </p> |
|
603 <dl> |
|
604 |
|
605 <dt><i>formatCodes</i> (list of str)</dt> |
|
606 <dd> |
|
607 list of format codes |
|
608 </dd> |
|
609 <dt><i>textCursor</i> (QTextCursor)</dt> |
|
610 <dd> |
|
611 reference to the text cursor |
|
612 </dd> |
|
613 </dl> |
|
614 <a NAME="MicroPythonWidget.__setConnected" ID="MicroPythonWidget.__setConnected"></a> |
|
615 <h4>MicroPythonWidget.__setConnected</h4> |
|
616 <b>__setConnected</b>(<i>connected</i>) |
|
617 |
|
618 <p> |
|
619 Private method to set the connection status LED. |
|
620 </p> |
|
621 <dl> |
|
622 |
|
623 <dt><i>connected</i> (bool)</dt> |
|
624 <dd> |
|
625 connection state |
|
626 </dd> |
|
627 </dl> |
|
628 <a NAME="MicroPythonWidget.__showBoardInformation" ID="MicroPythonWidget.__showBoardInformation"></a> |
|
629 <h4>MicroPythonWidget.__showBoardInformation</h4> |
|
630 <b>__showBoardInformation</b>(<i></i>) |
|
631 |
|
632 <p> |
|
633 Private slot to show all available information about a board. |
|
634 </p> |
|
635 <a NAME="MicroPythonWidget.__showContextMenu" ID="MicroPythonWidget.__showContextMenu"></a> |
|
636 <h4>MicroPythonWidget.__showContextMenu</h4> |
|
637 <b>__showContextMenu</b>(<i>pos</i>) |
|
638 |
|
639 <p> |
|
640 Private slot to show the REPL context menu. |
|
641 </p> |
|
642 <dl> |
|
643 |
|
644 <dt><i>pos</i> (QPoint)</dt> |
|
645 <dd> |
|
646 position to show the menu at |
|
647 </dd> |
|
648 </dl> |
|
649 <a NAME="MicroPythonWidget.__showDeviceTime" ID="MicroPythonWidget.__showDeviceTime"></a> |
|
650 <h4>MicroPythonWidget.__showDeviceTime</h4> |
|
651 <b>__showDeviceTime</b>(<i></i>) |
|
652 |
|
653 <p> |
|
654 Private slot to show the date and time of the connected device. |
|
655 </p> |
|
656 <a NAME="MicroPythonWidget.__showDeviceVersion" ID="MicroPythonWidget.__showDeviceVersion"></a> |
|
657 <h4>MicroPythonWidget.__showDeviceVersion</h4> |
|
658 <b>__showDeviceVersion</b>(<i></i>) |
|
659 |
|
660 <p> |
|
661 Private slot to show some version info about MicroPython of the device. |
|
662 </p> |
|
663 <a NAME="MicroPythonWidget.__showDocumentation" ID="MicroPythonWidget.__showDocumentation"></a> |
|
664 <h4>MicroPythonWidget.__showDocumentation</h4> |
|
665 <b>__showDocumentation</b>(<i></i>) |
|
666 |
|
667 <p> |
|
668 Private slot to open the documentation URL for the selected device. |
|
669 </p> |
|
670 <a NAME="MicroPythonWidget.__showError" ID="MicroPythonWidget.__showError"></a> |
|
671 <h4>MicroPythonWidget.__showError</h4> |
|
672 <b>__showError</b>(<i>method, error</i>) |
|
673 |
|
674 <p> |
|
675 Private method to show some error message. |
|
676 </p> |
|
677 <dl> |
|
678 |
|
679 <dt><i>method</i> (str)</dt> |
|
680 <dd> |
|
681 name of the method the error occured in |
|
682 </dd> |
|
683 <dt><i>error</i> (str)</dt> |
|
684 <dd> |
|
685 error message |
|
686 </dd> |
|
687 </dl> |
|
688 <a NAME="MicroPythonWidget.__showImplementation" ID="MicroPythonWidget.__showImplementation"></a> |
|
689 <h4>MicroPythonWidget.__showImplementation</h4> |
|
690 <b>__showImplementation</b>(<i></i>) |
|
691 |
|
692 <p> |
|
693 Private slot to show some implementation related information. |
|
694 </p> |
|
695 <a NAME="MicroPythonWidget.__showLocalAndDeviceTime" ID="MicroPythonWidget.__showLocalAndDeviceTime"></a> |
|
696 <h4>MicroPythonWidget.__showLocalAndDeviceTime</h4> |
|
697 <b>__showLocalAndDeviceTime</b>(<i></i>) |
|
698 |
|
699 <p> |
|
700 Private slot to show the local and device time side-by-side. |
|
701 </p> |
|
702 <a NAME="MicroPythonWidget.__showLocalTime" ID="MicroPythonWidget.__showLocalTime"></a> |
|
703 <h4>MicroPythonWidget.__showLocalTime</h4> |
|
704 <b>__showLocalTime</b>(<i></i>) |
|
705 |
|
706 <p> |
|
707 Private slot to show the local date and time. |
|
708 </p> |
|
709 <a NAME="MicroPythonWidget.__showNoDeviceMessage" ID="MicroPythonWidget.__showNoDeviceMessage"></a> |
|
710 <h4>MicroPythonWidget.__showNoDeviceMessage</h4> |
|
711 <b>__showNoDeviceMessage</b>(<i></i>) |
|
712 |
|
713 <p> |
|
714 Private method to show a message dialog indicating a missing device. |
|
715 </p> |
|
716 <a NAME="MicroPythonWidget.__synchronizeTime" ID="MicroPythonWidget.__synchronizeTime"></a> |
|
717 <h4>MicroPythonWidget.__synchronizeTime</h4> |
|
718 <b>__synchronizeTime</b>(<i>quiet=False</i>) |
|
719 |
|
720 <p> |
|
721 Private slot to set the time of the connected device to the local |
|
722 computer's time. |
|
723 </p> |
|
724 <dl> |
|
725 |
|
726 <dt><i>quiet</i> (bool)</dt> |
|
727 <dd> |
|
728 flag indicating to not show a message |
|
729 </dd> |
|
730 </dl> |
|
731 <a NAME="MicroPythonWidget.commandsInterface" ID="MicroPythonWidget.commandsInterface"></a> |
|
732 <h4>MicroPythonWidget.commandsInterface</h4> |
|
733 <b>commandsInterface</b>(<i></i>) |
|
734 |
|
735 <p> |
|
736 Public method to get a reference to the commands interface object. |
|
737 </p> |
|
738 <dl> |
|
739 <dt>Return:</dt> |
|
740 <dd> |
|
741 reference to the commands interface object |
|
742 </dd> |
|
743 </dl> |
|
744 <dl> |
|
745 <dt>Return Type:</dt> |
|
746 <dd> |
|
747 MicroPythonCommandsInterface |
|
748 </dd> |
|
749 </dl> |
|
750 <a NAME="MicroPythonWidget.eventFilter" ID="MicroPythonWidget.eventFilter"></a> |
|
751 <h4>MicroPythonWidget.eventFilter</h4> |
|
752 <b>eventFilter</b>(<i>obj, evt</i>) |
|
753 |
|
754 <p> |
|
755 Public method to process events for the REPL pane. |
|
756 </p> |
|
757 <dl> |
|
758 |
|
759 <dt><i>obj</i> (QObject)</dt> |
|
760 <dd> |
|
761 reference to the object the event was meant for |
|
762 </dd> |
|
763 <dt><i>evt</i> (QEvent)</dt> |
|
764 <dd> |
|
765 reference to the event object |
|
766 </dd> |
|
767 </dl> |
|
768 <dl> |
|
769 <dt>Return:</dt> |
|
770 <dd> |
|
771 flag to indicate that the event was handled |
|
772 </dd> |
|
773 </dl> |
|
774 <dl> |
|
775 <dt>Return Type:</dt> |
|
776 <dd> |
|
777 bool |
|
778 </dd> |
|
779 </dl> |
|
780 <a NAME="MicroPythonWidget.getCurrentBoard" ID="MicroPythonWidget.getCurrentBoard"></a> |
|
781 <h4>MicroPythonWidget.getCurrentBoard</h4> |
|
782 <b>getCurrentBoard</b>(<i></i>) |
|
783 |
|
784 <p> |
|
785 Public method to get the board name of the selected device. |
|
786 </p> |
|
787 <dl> |
|
788 <dt>Return:</dt> |
|
789 <dd> |
|
790 board name of the selected device |
|
791 </dd> |
|
792 </dl> |
|
793 <dl> |
|
794 <dt>Return Type:</dt> |
|
795 <dd> |
|
796 str |
|
797 </dd> |
|
798 </dl> |
|
799 <a NAME="MicroPythonWidget.getCurrentPort" ID="MicroPythonWidget.getCurrentPort"></a> |
|
800 <h4>MicroPythonWidget.getCurrentPort</h4> |
|
801 <b>getCurrentPort</b>(<i></i>) |
|
802 |
|
803 <p> |
|
804 Public method to determine the port path of the selected device. |
|
805 </p> |
|
806 <dl> |
|
807 <dt>Return:</dt> |
|
808 <dd> |
|
809 path of the port of the selected device |
|
810 </dd> |
|
811 </dl> |
|
812 <dl> |
|
813 <dt>Return Type:</dt> |
|
814 <dd> |
|
815 str |
|
816 </dd> |
|
817 </dl> |
|
818 <a NAME="MicroPythonWidget.getDeviceWorkspace" ID="MicroPythonWidget.getDeviceWorkspace"></a> |
|
819 <h4>MicroPythonWidget.getDeviceWorkspace</h4> |
|
820 <b>getDeviceWorkspace</b>(<i></i>) |
|
821 |
|
822 <p> |
|
823 Public method to get the workspace directory of the device. |
|
824 </p> |
|
825 <dl> |
|
826 <dt>Return:</dt> |
|
827 <dd> |
|
828 workspace directory of the device |
|
829 </dd> |
|
830 </dl> |
|
831 <dl> |
|
832 <dt>Return Type:</dt> |
|
833 <dd> |
|
834 str |
|
835 </dd> |
|
836 </dl> |
|
837 <a NAME="MicroPythonWidget.handleDataFlood" ID="MicroPythonWidget.handleDataFlood"></a> |
|
838 <h4>MicroPythonWidget.handleDataFlood</h4> |
|
839 <b>handleDataFlood</b>(<i></i>) |
|
840 |
|
841 <p> |
|
842 Public slot handling a data flood from the device. |
|
843 </p> |
|
844 <a NAME="MicroPythonWidget.isConnected" ID="MicroPythonWidget.isConnected"></a> |
|
845 <h4>MicroPythonWidget.isConnected</h4> |
|
846 <b>isConnected</b>(<i></i>) |
|
847 |
|
848 <p> |
|
849 Public method to get the connection state. |
|
850 </p> |
|
851 <dl> |
|
852 <dt>Return:</dt> |
|
853 <dd> |
|
854 connection state |
|
855 </dd> |
|
856 </dl> |
|
857 <dl> |
|
858 <dt>Return Type:</dt> |
|
859 <dd> |
|
860 bool |
|
861 </dd> |
|
862 </dl> |
|
863 <a NAME="MicroPythonWidget.isMicrobit" ID="MicroPythonWidget.isMicrobit"></a> |
|
864 <h4>MicroPythonWidget.isMicrobit</h4> |
|
865 <b>isMicrobit</b>(<i></i>) |
|
866 |
|
867 <p> |
|
868 Public method to check, if the connected/selected device is a |
|
869 BBC micro:bit or Calliope mini. |
|
870 </p> |
|
871 <dl> |
|
872 <dt>Return:</dt> |
|
873 <dd> |
|
874 flag indicating a micro:bit device |
|
875 rtype bool |
|
876 </dd> |
|
877 </dl> |
|
878 <a NAME="MicroPythonWidget.on_chartButton_clicked" ID="MicroPythonWidget.on_chartButton_clicked"></a> |
|
879 <h4>MicroPythonWidget.on_chartButton_clicked</h4> |
|
880 <b>on_chartButton_clicked</b>(<i>checked</i>) |
|
881 |
|
882 <p> |
|
883 Private slot to open a chart view to plot data received from the |
|
884 connected device. |
|
885 </p> |
|
886 <p> |
|
887 If the selected device is not connected yet, this will be done now. |
|
888 </p> |
|
889 <dl> |
|
890 |
|
891 <dt><i>checked</i> (bool)</dt> |
|
892 <dd> |
|
893 state of the button |
|
894 </dd> |
|
895 </dl> |
|
896 <a NAME="MicroPythonWidget.on_checkButton_clicked" ID="MicroPythonWidget.on_checkButton_clicked"></a> |
|
897 <h4>MicroPythonWidget.on_checkButton_clicked</h4> |
|
898 <b>on_checkButton_clicked</b>(<i></i>) |
|
899 |
|
900 <p> |
|
901 Private slot to check for connected devices. |
|
902 </p> |
|
903 <a NAME="MicroPythonWidget.on_connectButton_clicked" ID="MicroPythonWidget.on_connectButton_clicked"></a> |
|
904 <h4>MicroPythonWidget.on_connectButton_clicked</h4> |
|
905 <b>on_connectButton_clicked</b>(<i></i>) |
|
906 |
|
907 <p> |
|
908 Private slot to connect to the selected device or disconnect from the |
|
909 currently connected device. |
|
910 </p> |
|
911 <a NAME="MicroPythonWidget.on_deviceTypeComboBox_activated" ID="MicroPythonWidget.on_deviceTypeComboBox_activated"></a> |
|
912 <h4>MicroPythonWidget.on_deviceTypeComboBox_activated</h4> |
|
913 <b>on_deviceTypeComboBox_activated</b>(<i>index</i>) |
|
914 |
|
915 <p> |
|
916 Private slot handling the selection of a device type. |
|
917 </p> |
|
918 <dl> |
|
919 |
|
920 <dt><i>index</i> (int)</dt> |
|
921 <dd> |
|
922 index of the selected device |
|
923 </dd> |
|
924 </dl> |
|
925 <a NAME="MicroPythonWidget.on_filesButton_clicked" ID="MicroPythonWidget.on_filesButton_clicked"></a> |
|
926 <h4>MicroPythonWidget.on_filesButton_clicked</h4> |
|
927 <b>on_filesButton_clicked</b>(<i>checked</i>) |
|
928 |
|
929 <p> |
|
930 Private slot to open a file manager window to the connected device. |
|
931 </p> |
|
932 <p> |
|
933 If the selected device is not connected yet, this will be done now. |
|
934 </p> |
|
935 <dl> |
|
936 |
|
937 <dt><i>checked</i> (bool)</dt> |
|
938 <dd> |
|
939 state of the button |
|
940 </dd> |
|
941 </dl> |
|
942 <a NAME="MicroPythonWidget.on_openButton_clicked" ID="MicroPythonWidget.on_openButton_clicked"></a> |
|
943 <h4>MicroPythonWidget.on_openButton_clicked</h4> |
|
944 <b>on_openButton_clicked</b>(<i></i>) |
|
945 |
|
946 <p> |
|
947 Private slot to open a file of the connected device. |
|
948 </p> |
|
949 <a NAME="MicroPythonWidget.on_replButton_clicked" ID="MicroPythonWidget.on_replButton_clicked"></a> |
|
950 <h4>MicroPythonWidget.on_replButton_clicked</h4> |
|
951 <b>on_replButton_clicked</b>(<i>checked</i>) |
|
952 |
|
953 <p> |
|
954 Private slot to connect to enable or disable the REPL widget. |
|
955 </p> |
|
956 <p> |
|
957 If the selected device is not connected yet, this will be done now. |
|
958 </p> |
|
959 <dl> |
|
960 |
|
961 <dt><i>checked</i> (bool)</dt> |
|
962 <dd> |
|
963 state of the button |
|
964 </dd> |
|
965 </dl> |
|
966 <a NAME="MicroPythonWidget.on_runButton_clicked" ID="MicroPythonWidget.on_runButton_clicked"></a> |
|
967 <h4>MicroPythonWidget.on_runButton_clicked</h4> |
|
968 <b>on_runButton_clicked</b>(<i></i>) |
|
969 |
|
970 <p> |
|
971 Private slot to execute the script of the active editor on the |
|
972 selected device. |
|
973 </p> |
|
974 <p> |
|
975 If the REPL is not active yet, it will be activated, which might cause |
|
976 an unconnected device to be connected. |
|
977 </p> |
|
978 <a NAME="MicroPythonWidget.on_saveButton_clicked" ID="MicroPythonWidget.on_saveButton_clicked"></a> |
|
979 <h4>MicroPythonWidget.on_saveButton_clicked</h4> |
|
980 <b>on_saveButton_clicked</b>(<i></i>) |
|
981 |
|
982 <p> |
|
983 Private slot to save the current editor to the connected device. |
|
984 </p> |
|
985 <a NAME="MicroPythonWidget.setActionButtons" ID="MicroPythonWidget.setActionButtons"></a> |
|
986 <h4>MicroPythonWidget.setActionButtons</h4> |
|
987 <b>setActionButtons</b>(<i>**kwargs</i>) |
|
988 |
|
989 <p> |
|
990 Public method to set the enabled state of the various action buttons. |
|
991 </p> |
|
992 <dl> |
|
993 |
|
994 <dt><i>kwargs=</i> (dict)</dt> |
|
995 <dd> |
|
996 keyword arguments containg the enabled states (keys |
|
997 are 'run', 'repl', 'files', 'chart', 'open', 'save' |
|
998 </dd> |
|
999 </dl> |
|
1000 <div align="right"><a href="#top">Up</a></div> |
|
1001 <hr /> |
|
1002 </body></html> |