eric6/MicroPython/CircuitPythonDevices.py

Mon, 12 Oct 2020 18:23:44 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 12 Oct 2020 18:23:44 +0200
changeset 7780
41420f82c0ac
parent 7759
51aa6c6b66f7
child 7923
91e843545d9a
permissions
-rw-r--r--

Performed some code cleanup.

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
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7328
diff changeset
3 # Copyright (c) 2019 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
7059
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
7116
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
10 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
11 import os
7116
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
12
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
13 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
14 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
15
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
16 from E5Gui import E5MessageBox, E5FileDialog
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .MicroPythonDevices import MicroPythonDevice
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7132
diff changeset
19 from .MicroPythonWidget import HAS_QTCHART
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
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
21 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
22 import Preferences
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 class CircuitPythonDevice(MicroPythonDevice):
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 implementing the device for CircuitPython boards.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
7132
c4682cfcd160 CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
29 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
30
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 def __init__(self, microPythonWidget, parent=None):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 Constructor
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 @param microPythonWidget reference to the main MicroPython widget
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7132
diff changeset
36 @type MicroPythonWidget
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @param parent reference to the parent object
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @type QObject
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 super(CircuitPythonDevice, self).__init__(microPythonWidget, parent)
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 def setButtons(self):
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 Public method to enable the supported action buttons.
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 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
47 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
48 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
49
7132
c4682cfcd160 CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
50 if self.__deviceVolumeMounted():
7092
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
51 self.microPython.setActionButtons(open=True, save=True)
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 def forceInterrupt(self):
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 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
56 serial connection.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 @return flag indicating an interrupt is needed
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 @rtype bool
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 return False
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
7125
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7122
diff changeset
63 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
64 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7122
diff changeset
65 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
66
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7122
diff changeset
67 @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
68 @rtype str
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7122
diff changeset
69 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7122
diff changeset
70 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
71
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 def canStartRepl(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 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
75
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 @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
77 and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 return True, ""
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 def canStartPlotter(self):
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 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
85
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 @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
87 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 return True, ""
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
7092
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
92 def canRunScript(self):
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
93 """
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
94 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
95
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
96 @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
97 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
98 @rtype tuple of (bool, str)
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
99 """
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
100 return True, ""
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 def runScript(self, script):
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 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
105
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
106 @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
107 @type str
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
108 """
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
109 pythonScript = script.split("\n")
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
110 self.sendCommands(pythonScript)
7414b3b012b1 CircuitPythonDevices: started the adaption for 'CircuitPython' based devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7084
diff changeset
111
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
112 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
113 """
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 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
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 @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
117 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
118 @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
119 """
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 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
121
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
122 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
123 """
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 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
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 @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
127 @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
128 """
7132
c4682cfcd160 CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
129 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
130
c4682cfcd160 CircuitPythonDevice: only report local access if the well known volume is mounted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
131 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
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 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
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 @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
136 @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
137 """
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
138 return self.getWorkspace(silent=True).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
139
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
140 def getWorkspace(self, silent=False):
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 Public method to get the workspace directory.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
144 @param silent flag indicating silent operations
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
145 @type bool
7059
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:
7174
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
156 # return the default workspace and give the user a warning (unless
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
157 # silent mode is selected)
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
158 if not silent:
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
159 E5MessageBox.warning(
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
160 self.microPython,
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
161 self.tr("Workspace Directory"),
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
162 self.tr("Python files for CircuitPython devices are stored"
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
163 " on the device. Therefore, to edit these files"
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
164 " you need to have the device plugged in. Until"
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
165 " you plug in a device, the standard directory"
de8175253dfc MicroPython: did some fine tuning of the MicroPython interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7161
diff changeset
166 " will be used."))
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 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
169
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
170 def addDeviceMenuEntries(self, menu):
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
171 """
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
172 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
173
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
174 @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
175 @type QMenu
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
176 """
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
177 connected = self.microPython.isConnected()
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
178
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
179 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
180 self.__flashCircuitPython)
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
181 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
182 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
183 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
184 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
185 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
186
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
187 @pyqtSlot()
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
188 def __flashCircuitPython(self):
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
189 """
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
190 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
191 """
7597
9dac5ef0126d MicroPython: added more boards to the board selection to flash CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
192 button = E5MessageBox.information(
7116
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
193 self.microPython,
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
194 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
195 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
196 " when ready."),
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
197 E5MessageBox.StandardButtons(
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
198 E5MessageBox.Abort |
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
199 E5MessageBox.Ok))
7597
9dac5ef0126d MicroPython: added more boards to the board selection to flash CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
200 if button == E5MessageBox.Ok:
7116
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
201 from .CircuitPythonFirmwareSelectionDialog import (
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
202 CircuitPythonFirmwareSelectionDialog)
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
203 dlg = CircuitPythonFirmwareSelectionDialog()
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7597
diff changeset
204 if dlg.exec() == QDialog.Accepted:
7116
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
205 cpyPath, devicePath = dlg.getData()
233b6e62ca2b CircuitPython: added code to flash a new CircuitPython firmware.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7100
diff changeset
206 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
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 @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
209 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
210 """
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 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
212 """
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 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
214 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
215 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
216 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
217 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
218 """ 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
219 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
220
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 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
222 # 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
223 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
224 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
225
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 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
227 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
228 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
229 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
230 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
231 "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
232 "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
233
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
234 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
235 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
236 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
237
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 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
239 """
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 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
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 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
243 @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
244 """
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
245 return Preferences.getMicroPython("CircuitPythonDocuUrl")
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
246
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
247 def getFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
248 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
249 Public method to get the device firmware download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
250
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
251 @return firmware download URL of the device
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
252 @rtype str
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
253 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
254 return Preferences.getMicroPython("CircuitPythonFirmwareUrl")

eric ide

mercurial