Fri, 23 Aug 2019 14:49:59 +0200
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the device interface class for CircuitPython boards. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | from __future__ import unicode_literals |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | |
7116
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
12 | import shutil |
7138
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
13 | import os |
7116
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
14 | |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
15 | from PyQt5.QtCore import pyqtSlot |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
16 | from PyQt5.QtWidgets import QDialog |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
17 | |
7138
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
18 | from E5Gui import E5MessageBox, E5FileDialog |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | from .MicroPythonDevices import MicroPythonDevice |
7134
21d23ca51680
Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7132
diff
changeset
|
21 | from .MicroPythonWidget import HAS_QTCHART |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
7100
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
23 | import Utilities |
7161
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
24 | import Preferences |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | class CircuitPythonDevice(MicroPythonDevice): |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | Class implementing the device for CircuitPython boards. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | """ |
7132
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
31 | DeviceVolumeName = "CIRCUITPY" |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
32 | |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | def __init__(self, microPythonWidget, parent=None): |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | Constructor |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | @param microPythonWidget reference to the main MicroPython widget |
7134
21d23ca51680
Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7132
diff
changeset
|
38 | @type MicroPythonWidget |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | @param parent reference to the parent object |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | @type QObject |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | super(CircuitPythonDevice, self).__init__(microPythonWidget, parent) |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | def setButtons(self): |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | Public method to enable the supported action buttons. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | super(CircuitPythonDevice, self).setButtons() |
7100
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
49 | self.microPython.setActionButtons( |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
50 | run=True, repl=True, files=True, chart=HAS_QTCHART) |
7092
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
51 | |
7132
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
52 | if self.__deviceVolumeMounted(): |
7092
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
53 | self.microPython.setActionButtons(open=True, save=True) |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | def forceInterrupt(self): |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | Public method to determine the need for an interrupt when opening the |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | serial connection. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | @return flag indicating an interrupt is needed |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | @rtype bool |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | return False |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | |
7125
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
65 | def deviceName(self): |
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
66 | """ |
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
67 | Public method to get the name of the device. |
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
68 | |
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
69 | @return name of the device |
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
70 | @rtype str |
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
71 | """ |
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
72 | return self.tr("CircuitPython") |
2028553ee58c
CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7122
diff
changeset
|
73 | |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | def canStartRepl(self): |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | Public method to determine, if a REPL can be started. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | @return tuple containing a flag indicating it is safe to start a REPL |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | and a reason why it cannot. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | @rtype tuple of (bool, str) |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | return True, "" |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | def canStartPlotter(self): |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | Public method to determine, if a Plotter can be started. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | @return tuple containing a flag indicating it is safe to start a |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | Plotter and a reason why it cannot. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | @rtype tuple of (bool, str) |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | return True, "" |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | |
7092
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
94 | def canRunScript(self): |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
95 | """ |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
96 | Public method to determine, if a script can be executed. |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
97 | |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
98 | @return tuple containing a flag indicating it is safe to start a |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
99 | Plotter and a reason why it cannot. |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
100 | @rtype tuple of (bool, str) |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
101 | """ |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
102 | return True, "" |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
103 | |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
104 | def runScript(self, script): |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
105 | """ |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
106 | Public method to run the given Python script. |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
107 | |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
108 | @param script script to be executed |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
109 | @type str |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
110 | """ |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
111 | pythonScript = script.split("\n") |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
112 | self.sendCommands(pythonScript) |
7414b3b012b1
CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7084
diff
changeset
|
113 | |
7100
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
114 | def canStartFileManager(self): |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
115 | """ |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
116 | Public method to determine, if a File Manager can be started. |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
117 | |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
118 | @return tuple containing a flag indicating it is safe to start a |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
119 | File Manager and a reason why it cannot. |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
120 | @rtype tuple of (bool, str) |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
121 | """ |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
122 | return True, "" |
c4d9c28ebcd8
Devices.py files: removed some methods no longer needed after the recent improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7092
diff
changeset
|
123 | |
7129
3cc19aec959a
MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7125
diff
changeset
|
124 | def supportsLocalFileAccess(self): |
3cc19aec959a
MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7125
diff
changeset
|
125 | """ |
3cc19aec959a
MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7125
diff
changeset
|
126 | Public method to indicate file access via a local directory. |
3cc19aec959a
MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7125
diff
changeset
|
127 | |
3cc19aec959a
MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7125
diff
changeset
|
128 | @return flag indicating file access via local directory |
7145
ceb3e8b242c1
Regenerated source docu after merge with 'micropython' branch.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7138
diff
changeset
|
129 | @rtype bool |
7129
3cc19aec959a
MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7125
diff
changeset
|
130 | """ |
7132
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
131 | return self.__deviceVolumeMounted() |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
132 | |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
133 | def __deviceVolumeMounted(self): |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
134 | """ |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
135 | Private method to check, if the device volume is mounted. |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
136 | |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
137 | @return flag indicated a mounted device |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
138 | @rtype bool |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
139 | """ |
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
140 | return self.getWorkspace().endswith(self.DeviceVolumeName) |
7129
3cc19aec959a
MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7125
diff
changeset
|
141 | |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | def getWorkspace(self): |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | Public method to get the workspace directory. |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | @return workspace directory used for saving files |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | @rtype str |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | """ |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | # Attempts to find the path on the filesystem that represents the |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | # plugged in CIRCUITPY board. |
7132
c4682cfcd160
CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7129
diff
changeset
|
151 | deviceDirectory = Utilities.findVolume(self.DeviceVolumeName) |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | if deviceDirectory: |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | return deviceDirectory |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | else: |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | # return the default workspace and give the user a warning |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | E5MessageBox.warning( |
7116
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
158 | self.microPython, |
7059
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | self.tr("Workspace Directory"), |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | self.tr("Python files for CircuitPython devices are stored on" |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | " the device. Therefore, to edit these files you need" |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | " to have the device plugged in. Until you plug in a" |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | " device, the standard directory will be used.")) |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | |
a8fad276cbd5
Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | return super(CircuitPythonDevice, self).getWorkspace() |
7116
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
166 | |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
167 | def addDeviceMenuEntries(self, menu): |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
168 | """ |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
169 | Public method to add device specific entries to the given menu. |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
170 | |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
171 | @param menu reference to the context menu |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
172 | @type QMenu |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
173 | """ |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
174 | connected = self.microPython.isConnected() |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
175 | |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
176 | act = menu.addAction(self.tr("Flash CircuitPython Firmware"), |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
177 | self.__flashCircuitPython) |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
178 | act.setEnabled(not connected) |
7138
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
179 | menu.addSeparator() |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
180 | act = menu.addAction(self.tr("Install Library Files"), |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
181 | self.__installLibraryFiles) |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
182 | act.setEnabled(self.__deviceVolumeMounted()) |
7116
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
183 | |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
184 | @pyqtSlot() |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
185 | def __flashCircuitPython(self): |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
186 | """ |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
187 | Private slot to flash a CircuitPython firmware to the device. |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
188 | """ |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
189 | ok = E5MessageBox.information( |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
190 | self.microPython, |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
191 | self.tr("Flash CircuitPython Firmware"), |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
192 | self.tr("Please reset the device to bootloader mode and confirm" |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
193 | " when ready."), |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
194 | E5MessageBox.StandardButtons( |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
195 | E5MessageBox.Abort | |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
196 | E5MessageBox.Ok)) |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
197 | if ok: |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
198 | from .CircuitPythonFirmwareSelectionDialog import ( |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
199 | CircuitPythonFirmwareSelectionDialog) |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
200 | dlg = CircuitPythonFirmwareSelectionDialog() |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
201 | if dlg.exec_() == QDialog.Accepted: |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
202 | cpyPath, devicePath = dlg.getData() |
233b6e62ca2b
CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7100
diff
changeset
|
203 | shutil.copy2(cpyPath, devicePath) |
7138
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
204 | |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
205 | @pyqtSlot() |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
206 | def __installLibraryFiles(self): |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
207 | """ |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
208 | Private slot to install Python files into the onboard library. |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
209 | """ |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
210 | if not self.__deviceVolumeMounted(): |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
211 | E5MessageBox.critical( |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
212 | self.microPython, |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
213 | self.tr("Install Library Files"), |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
214 | self.tr("""The device volume "<b>{0}</b>" is not available.""" |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
215 | """ Ensure it is mounted properly and try again.""")) |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
216 | return |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
217 | |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
218 | target = os.path.join(self.getWorkspace(), "lib") |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
219 | # ensure that the library directory exists on the device |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
220 | if not os.path.isdir(target): |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
221 | os.makedirs(target) |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
222 | |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
223 | libraryFiles = E5FileDialog.getOpenFileNames( |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
224 | self.microPython, |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
225 | self.tr("Install Library Files"), |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
226 | os.path.expanduser("~"), |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
227 | self.tr("Compiled Python Files (*.mpy);;" |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
228 | "Python Files (*.py);;" |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
229 | "All Files (*)")) |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
230 | |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
231 | for libraryFile in libraryFiles: |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
232 | if os.path.exists(libraryFile): |
a2a53535d855
CircuitPythonDevices: added capability to install library files onto the device to the device menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7134
diff
changeset
|
233 | shutil.copy2(libraryFile, target) |
7161
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
234 | |
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
235 | def getDocumentationUrl(self): |
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
236 | """ |
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
237 | Public method to get the device documentation URL. |
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
238 | |
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
239 | @return documentation URL of the device |
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
240 | @rtype str |
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
241 | """ |
728018c32b09
MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7145
diff
changeset
|
242 | return Preferences.getMicroPython("CircuitPythonDocuUrl") |