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