eric6/Documentation/Source/eric6.MicroPython.MicroPythonDevices.html

changeset 7145
ceb3e8b242c1
child 7161
728018c32b09
equal deleted inserted replaced
7143:9eb66bad154d 7145:ceb3e8b242c1
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.MicroPython.MicroPythonDevices</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><a NAME="top" ID="top"></a>
22 <h1>eric6.MicroPython.MicroPythonDevices</h1>
23 <p>
24 Module implementing some utility functions and the MicroPythonDevice base
25 class.
26 </p>
27 <h3>Global Attributes</h3>
28 <table>
29 <tr><td>SupportedBoards</td></tr>
30 </table>
31 <h3>Classes</h3>
32 <table>
33 <tr>
34 <td><a href="#MicroPythonDevice">MicroPythonDevice</a></td>
35 <td>Base class for the more specific MicroPython devices.</td>
36 </tr>
37 </table>
38 <h3>Functions</h3>
39 <table>
40 <tr>
41 <td><a href="#getDevice">getDevice</a></td>
42 <td>Public method to instantiate a specific MicroPython device interface.</td>
43 </tr><tr>
44 <td><a href="#getDeviceIcon">getDeviceIcon</a></td>
45 <td>Function to get the icon for the given board.</td>
46 </tr><tr>
47 <td><a href="#getFoundDevices">getFoundDevices</a></td>
48 <td>Function to check the serial ports for supported MicroPython devices.</td>
49 </tr><tr>
50 <td><a href="#getSupportedDevices">getSupportedDevices</a></td>
51 <td>Function to get a list of supported MicroPython devices.</td>
52 </tr>
53 </table>
54 <hr /><hr />
55 <a NAME="MicroPythonDevice" ID="MicroPythonDevice"></a>
56 <h2>MicroPythonDevice</h2>
57 <p>
58 Base class for the more specific MicroPython devices.
59 </p>
60 <h3>Derived from</h3>
61 QObject
62 <h3>Class Attributes</h3>
63 <table>
64 <tr><td>None</td></tr>
65 </table>
66 <h3>Class Methods</h3>
67 <table>
68 <tr><td>None</td></tr>
69 </table>
70 <h3>Methods</h3>
71 <table>
72 <tr>
73 <td><a href="#MicroPythonDevice.__init__">MicroPythonDevice</a></td>
74 <td>Constructor</td>
75 </tr><tr>
76 <td><a href="#MicroPythonDevice.addDeviceMenuEntries">addDeviceMenuEntries</a></td>
77 <td>Public method to add device specific entries to the given menu.</td>
78 </tr><tr>
79 <td><a href="#MicroPythonDevice.canRunScript">canRunScript</a></td>
80 <td>Public method to determine, if a script can be executed.</td>
81 </tr><tr>
82 <td><a href="#MicroPythonDevice.canStartFileManager">canStartFileManager</a></td>
83 <td>Public method to determine, if a File Manager can be started.</td>
84 </tr><tr>
85 <td><a href="#MicroPythonDevice.canStartPlotter">canStartPlotter</a></td>
86 <td>Public method to determine, if a Plotter can be started.</td>
87 </tr><tr>
88 <td><a href="#MicroPythonDevice.canStartRepl">canStartRepl</a></td>
89 <td>Public method to determine, if a REPL can be started.</td>
90 </tr><tr>
91 <td><a href="#MicroPythonDevice.deviceName">deviceName</a></td>
92 <td>Public method to get the name of the device.</td>
93 </tr><tr>
94 <td><a href="#MicroPythonDevice.forceInterrupt">forceInterrupt</a></td>
95 <td>Public method to determine the need for an interrupt when opening the serial connection.</td>
96 </tr><tr>
97 <td><a href="#MicroPythonDevice.getWorkspace">getWorkspace</a></td>
98 <td>Public method to get the workspace directory.</td>
99 </tr><tr>
100 <td><a href="#MicroPythonDevice.handleDataFlood">handleDataFlood</a></td>
101 <td>Public slot handling a data floof from the device.</td>
102 </tr><tr>
103 <td><a href="#MicroPythonDevice.hasTimeCommands">hasTimeCommands</a></td>
104 <td>Public method to check, if the device supports time commands.</td>
105 </tr><tr>
106 <td><a href="#MicroPythonDevice.runScript">runScript</a></td>
107 <td>Public method to run the given Python script.</td>
108 </tr><tr>
109 <td><a href="#MicroPythonDevice.sendCommands">sendCommands</a></td>
110 <td>Public method to send a list of commands to the device.</td>
111 </tr><tr>
112 <td><a href="#MicroPythonDevice.setButtons">setButtons</a></td>
113 <td>Public method to enable the supported action buttons.</td>
114 </tr><tr>
115 <td><a href="#MicroPythonDevice.setFileManager">setFileManager</a></td>
116 <td>Public method to set the File Manager status and dependent status.</td>
117 </tr><tr>
118 <td><a href="#MicroPythonDevice.setPlotter">setPlotter</a></td>
119 <td>Public method to set the Plotter status and dependent status.</td>
120 </tr><tr>
121 <td><a href="#MicroPythonDevice.setRepl">setRepl</a></td>
122 <td>Public method to set the REPL status and dependent status.</td>
123 </tr><tr>
124 <td><a href="#MicroPythonDevice.supportsLocalFileAccess">supportsLocalFileAccess</a></td>
125 <td>Public method to indicate file access via a local directory.</td>
126 </tr>
127 </table>
128 <h3>Static Methods</h3>
129 <table>
130 <tr><td>None</td></tr>
131 </table>
132 <a NAME="MicroPythonDevice.__init__" ID="MicroPythonDevice.__init__"></a>
133 <h4>MicroPythonDevice (Constructor)</h4>
134 <b>MicroPythonDevice</b>(<i>microPythonWidget, parent=None</i>)
135 <p>
136 Constructor
137 </p><dl>
138 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt>
139 <dd>
140 reference to the main MicroPython widget
141 </dd><dt><i>parent</i> (QObject)</dt>
142 <dd>
143 reference to the parent object
144 </dd>
145 </dl><a NAME="MicroPythonDevice.addDeviceMenuEntries" ID="MicroPythonDevice.addDeviceMenuEntries"></a>
146 <h4>MicroPythonDevice.addDeviceMenuEntries</h4>
147 <b>addDeviceMenuEntries</b>(<i>menu</i>)
148 <p>
149 Public method to add device specific entries to the given menu.
150 </p><dl>
151 <dt><i>menu</i> (QMenu)</dt>
152 <dd>
153 reference to the context menu
154 </dd>
155 </dl><a NAME="MicroPythonDevice.canRunScript" ID="MicroPythonDevice.canRunScript"></a>
156 <h4>MicroPythonDevice.canRunScript</h4>
157 <b>canRunScript</b>(<i></i>)
158 <p>
159 Public method to determine, if a script can be executed.
160 </p><dl>
161 <dt>Returns:</dt>
162 <dd>
163 tuple containing a flag indicating it is safe to start a
164 Plotter and a reason why it cannot.
165 </dd>
166 </dl><dl>
167 <dt>Return Type:</dt>
168 <dd>
169 tuple of (bool, str)
170 </dd>
171 </dl><a NAME="MicroPythonDevice.canStartFileManager" ID="MicroPythonDevice.canStartFileManager"></a>
172 <h4>MicroPythonDevice.canStartFileManager</h4>
173 <b>canStartFileManager</b>(<i></i>)
174 <p>
175 Public method to determine, if a File Manager can be started.
176 </p><dl>
177 <dt>Returns:</dt>
178 <dd>
179 tuple containing a flag indicating it is safe to start a
180 File Manager and a reason why it cannot.
181 </dd>
182 </dl><dl>
183 <dt>Return Type:</dt>
184 <dd>
185 tuple of (bool, str)
186 </dd>
187 </dl><a NAME="MicroPythonDevice.canStartPlotter" ID="MicroPythonDevice.canStartPlotter"></a>
188 <h4>MicroPythonDevice.canStartPlotter</h4>
189 <b>canStartPlotter</b>(<i></i>)
190 <p>
191 Public method to determine, if a Plotter can be started.
192 </p><dl>
193 <dt>Returns:</dt>
194 <dd>
195 tuple containing a flag indicating it is safe to start a
196 Plotter and a reason why it cannot.
197 </dd>
198 </dl><dl>
199 <dt>Return Type:</dt>
200 <dd>
201 tuple of (bool, str)
202 </dd>
203 </dl><a NAME="MicroPythonDevice.canStartRepl" ID="MicroPythonDevice.canStartRepl"></a>
204 <h4>MicroPythonDevice.canStartRepl</h4>
205 <b>canStartRepl</b>(<i></i>)
206 <p>
207 Public method to determine, if a REPL can be started.
208 </p><dl>
209 <dt>Returns:</dt>
210 <dd>
211 tuple containing a flag indicating it is safe to start a REPL
212 and a reason why it cannot.
213 </dd>
214 </dl><dl>
215 <dt>Return Type:</dt>
216 <dd>
217 tuple of (bool, str)
218 </dd>
219 </dl><a NAME="MicroPythonDevice.deviceName" ID="MicroPythonDevice.deviceName"></a>
220 <h4>MicroPythonDevice.deviceName</h4>
221 <b>deviceName</b>(<i></i>)
222 <p>
223 Public method to get the name of the device.
224 </p><dl>
225 <dt>Returns:</dt>
226 <dd>
227 name of the device
228 </dd>
229 </dl><dl>
230 <dt>Return Type:</dt>
231 <dd>
232 str
233 </dd>
234 </dl><a NAME="MicroPythonDevice.forceInterrupt" ID="MicroPythonDevice.forceInterrupt"></a>
235 <h4>MicroPythonDevice.forceInterrupt</h4>
236 <b>forceInterrupt</b>(<i></i>)
237 <p>
238 Public method to determine the need for an interrupt when opening the
239 serial connection.
240 </p><dl>
241 <dt>Returns:</dt>
242 <dd>
243 flag indicating an interrupt is needed
244 </dd>
245 </dl><dl>
246 <dt>Return Type:</dt>
247 <dd>
248 bool
249 </dd>
250 </dl><a NAME="MicroPythonDevice.getWorkspace" ID="MicroPythonDevice.getWorkspace"></a>
251 <h4>MicroPythonDevice.getWorkspace</h4>
252 <b>getWorkspace</b>(<i></i>)
253 <p>
254 Public method to get the workspace directory.
255 </p><dl>
256 <dt>Returns:</dt>
257 <dd>
258 workspace directory used for saving files
259 </dd>
260 </dl><dl>
261 <dt>Return Type:</dt>
262 <dd>
263 str
264 </dd>
265 </dl><a NAME="MicroPythonDevice.handleDataFlood" ID="MicroPythonDevice.handleDataFlood"></a>
266 <h4>MicroPythonDevice.handleDataFlood</h4>
267 <b>handleDataFlood</b>(<i></i>)
268 <p>
269 Public slot handling a data floof from the device.
270 </p><a NAME="MicroPythonDevice.hasTimeCommands" ID="MicroPythonDevice.hasTimeCommands"></a>
271 <h4>MicroPythonDevice.hasTimeCommands</h4>
272 <b>hasTimeCommands</b>(<i></i>)
273 <p>
274 Public method to check, if the device supports time commands.
275 </p><p>
276 The default returns True.
277 </p><dl>
278 <dt>Returns:</dt>
279 <dd>
280 flag indicating support for time commands
281 </dd>
282 </dl><dl>
283 <dt>Return Type:</dt>
284 <dd>
285 bool
286 </dd>
287 </dl><a NAME="MicroPythonDevice.runScript" ID="MicroPythonDevice.runScript"></a>
288 <h4>MicroPythonDevice.runScript</h4>
289 <b>runScript</b>(<i>script</i>)
290 <p>
291 Public method to run the given Python script.
292 </p><dl>
293 <dt><i>script</i> (str)</dt>
294 <dd>
295 script to be executed
296 </dd>
297 </dl><a NAME="MicroPythonDevice.sendCommands" ID="MicroPythonDevice.sendCommands"></a>
298 <h4>MicroPythonDevice.sendCommands</h4>
299 <b>sendCommands</b>(<i>commandsList</i>)
300 <p>
301 Public method to send a list of commands to the device.
302 </p><dl>
303 <dt><i>commandsList</i> (list of str)</dt>
304 <dd>
305 list of commands to be sent to the device
306 </dd>
307 </dl><a NAME="MicroPythonDevice.setButtons" ID="MicroPythonDevice.setButtons"></a>
308 <h4>MicroPythonDevice.setButtons</h4>
309 <b>setButtons</b>(<i></i>)
310 <p>
311 Public method to enable the supported action buttons.
312 </p><a NAME="MicroPythonDevice.setFileManager" ID="MicroPythonDevice.setFileManager"></a>
313 <h4>MicroPythonDevice.setFileManager</h4>
314 <b>setFileManager</b>(<i>on</i>)
315 <p>
316 Public method to set the File Manager status and dependent status.
317 </p><dl>
318 <dt><i>on</i> (bool)</dt>
319 <dd>
320 flag indicating the active status
321 </dd>
322 </dl><a NAME="MicroPythonDevice.setPlotter" ID="MicroPythonDevice.setPlotter"></a>
323 <h4>MicroPythonDevice.setPlotter</h4>
324 <b>setPlotter</b>(<i>on</i>)
325 <p>
326 Public method to set the Plotter status and dependent status.
327 </p><dl>
328 <dt><i>on</i> (bool)</dt>
329 <dd>
330 flag indicating the active status
331 </dd>
332 </dl><a NAME="MicroPythonDevice.setRepl" ID="MicroPythonDevice.setRepl"></a>
333 <h4>MicroPythonDevice.setRepl</h4>
334 <b>setRepl</b>(<i>on</i>)
335 <p>
336 Public method to set the REPL status and dependent status.
337 </p><dl>
338 <dt><i>on</i> (bool)</dt>
339 <dd>
340 flag indicating the active status
341 </dd>
342 </dl><a NAME="MicroPythonDevice.supportsLocalFileAccess" ID="MicroPythonDevice.supportsLocalFileAccess"></a>
343 <h4>MicroPythonDevice.supportsLocalFileAccess</h4>
344 <b>supportsLocalFileAccess</b>(<i></i>)
345 <p>
346 Public method to indicate file access via a local directory.
347 </p><dl>
348 <dt>Returns:</dt>
349 <dd>
350 flag indicating file access via local directory
351 </dd>
352 </dl><dl>
353 <dt>Return Type:</dt>
354 <dd>
355 bool
356 </dd>
357 </dl>
358 <div align="right"><a href="#top">Up</a></div>
359 <hr /><hr />
360 <a NAME="getDevice" ID="getDevice"></a>
361 <h2>getDevice</h2>
362 <b>getDevice</b>(<i>deviceType, microPythonWidget</i>)
363 <p>
364 Public method to instantiate a specific MicroPython device interface.
365 </p><dl>
366 <dt><i>deviceType</i> (str)</dt>
367 <dd>
368 type of the device interface
369 </dd><dt><i>microPythonWidget</i> (MicroPythonWidget)</dt>
370 <dd>
371 reference to the main MicroPython widget
372 </dd>
373 </dl><dl>
374 <dt>Returns:</dt>
375 <dd>
376 instantiated device interface
377 </dd>
378 </dl><dl>
379 <dt>Return Type:</dt>
380 <dd>
381 MicroPythonDevice
382 </dd>
383 </dl>
384 <div align="right"><a href="#top">Up</a></div>
385 <hr /><hr />
386 <a NAME="getDeviceIcon" ID="getDeviceIcon"></a>
387 <h2>getDeviceIcon</h2>
388 <b>getDeviceIcon</b>(<i>boardName, iconFormat=True</i>)
389 <p>
390 Function to get the icon for the given board.
391 </p><dl>
392 <dt><i>boardName</i> (str)</dt>
393 <dd>
394 name of the board
395 </dd><dt><i>iconFormat</i> (bool)</dt>
396 <dd>
397 flag indicating to get an icon or a pixmap
398 </dd>
399 </dl><dl>
400 <dt>Returns:</dt>
401 <dd>
402 icon for the board (iconFormat == True) or
403 a pixmap (iconFormat == False)
404 </dd>
405 </dl><dl>
406 <dt>Return Type:</dt>
407 <dd>
408 QIcon or QPixmap
409 </dd>
410 </dl>
411 <div align="right"><a href="#top">Up</a></div>
412 <hr /><hr />
413 <a NAME="getFoundDevices" ID="getFoundDevices"></a>
414 <h2>getFoundDevices</h2>
415 <b>getFoundDevices</b>(<i></i>)
416 <p>
417 Function to check the serial ports for supported MicroPython devices.
418 </p><dl>
419 <dt>Returns:</dt>
420 <dd>
421 set of tuples with the board type, a description and the serial
422 port it is connected at
423 </dd>
424 </dl><dl>
425 <dt>Return Type:</dt>
426 <dd>
427 set of tuples of (str, str, str)
428 </dd>
429 </dl>
430 <div align="right"><a href="#top">Up</a></div>
431 <hr /><hr />
432 <a NAME="getSupportedDevices" ID="getSupportedDevices"></a>
433 <h2>getSupportedDevices</h2>
434 <b>getSupportedDevices</b>(<i></i>)
435 <p>
436 Function to get a list of supported MicroPython devices.
437 </p><dl>
438 <dt>Returns:</dt>
439 <dd>
440 set of tuples with the board type and description
441 </dd>
442 </dl><dl>
443 <dt>Return Type:</dt>
444 <dd>
445 set of tuples of (str, str)
446 </dd>
447 </dl>
448 <div align="right"><a href="#top">Up</a></div>
449 <hr />
450 </body></html>

eric ide

mercurial