135 Private method to check, if the device volume is mounted. |
135 Private method to check, if the device volume is mounted. |
136 |
136 |
137 @return flag indicated a mounted device |
137 @return flag indicated a mounted device |
138 @rtype bool |
138 @rtype bool |
139 """ |
139 """ |
|
140 self.__workspace = "" # reset before checking |
140 return self.DeviceVolumeName in self.getWorkspace(silent=True) |
141 return self.DeviceVolumeName in self.getWorkspace(silent=True) |
141 |
142 |
142 def getWorkspace(self, silent=False): |
143 def getWorkspace(self, silent=False): |
143 """ |
144 """ |
144 Public method to get the workspace directory. |
145 Public method to get the workspace directory. |
155 self.__workspace = self.__findWorkspace(silent=silent) |
156 self.__workspace = self.__findWorkspace(silent=silent) |
156 return self.__workspace |
157 return self.__workspace |
157 |
158 |
158 def __findWorkspace(self, silent=False): |
159 def __findWorkspace(self, silent=False): |
159 """ |
160 """ |
160 Public method to find the workspace directory. |
161 Private method to find the workspace directory. |
161 |
162 |
162 @param silent flag indicating silent operations |
163 @param silent flag indicating silent operations |
163 @type bool |
164 @type bool |
164 @return workspace directory used for saving files |
165 @return workspace directory used for saving files |
165 @rtype str |
166 @rtype str |
166 """ |
167 """ |
167 # Attempts to find the paths on the filesystem that represents the |
168 # Attempts to find the paths on the filesystem that represents the |
168 # plugged in CIRCUITPY boards. |
169 # plugged in CIRCUITPY boards. |
169 deviceDirectories = Utilities.findVolume(self.DeviceVolumeName, |
170 deviceDirectories = Utilities.findVolume(self.DeviceVolumeName, |
170 all=True) |
171 findAll=True) |
171 |
172 |
172 if deviceDirectories: |
173 if deviceDirectories: |
173 if len(deviceDirectories) == 1: |
174 if len(deviceDirectories) == 1: |
174 return deviceDirectories[0] |
175 return deviceDirectories[0] |
175 else: |
176 else: |
179 # silent mode is selected) |
180 # silent mode is selected) |
180 if not silent: |
181 if not silent: |
181 E5MessageBox.warning( |
182 E5MessageBox.warning( |
182 self.microPython, |
183 self.microPython, |
183 self.tr("Workspace Directory"), |
184 self.tr("Workspace Directory"), |
184 self.tr("Python files for CircuitPython devices are stored" |
185 self.tr("Python files for CircuitPython can be edited in" |
185 " on the device. Therefore, to edit these files" |
186 " place, if the device volume is locally" |
186 " you need to have the device plugged in. Until" |
187 " available. Such a volume was not found. In" |
187 " you plug in a device, the standard directory" |
188 " place editing will not be available." |
188 " will be used.")) |
189 ) |
|
190 ) |
189 |
191 |
190 return super(CircuitPythonDevice, self).getWorkspace() |
192 return super(CircuitPythonDevice, self).getWorkspace() |
191 |
193 |
192 def addDeviceMenuEntries(self, menu): |
194 def addDeviceMenuEntries(self, menu): |
193 """ |
195 """ |
263 |
265 |
264 @return documentation URL of the device |
266 @return documentation URL of the device |
265 @rtype str |
267 @rtype str |
266 """ |
268 """ |
267 return Preferences.getMicroPython("CircuitPythonDocuUrl") |
269 return Preferences.getMicroPython("CircuitPythonDocuUrl") |
268 ## |
|
269 ## def getFirmwareUrl(self): |
|
270 ## """ |
|
271 ## Public method to get the device firmware download URL. |
|
272 ## |
|
273 ## @return firmware download URL of the device |
|
274 ## @rtype str |
|
275 ## """ |
|
276 ## return Preferences.getMicroPython("CircuitPythonFirmwareUrl") |
|
277 |
270 |
278 def getDownloadMenuEntries(self): |
271 def getDownloadMenuEntries(self): |
279 """ |
272 """ |
280 Public method to retrieve the entries for the downloads menu. |
273 Public method to retrieve the entries for the downloads menu. |
281 |
274 |