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 return self.getWorkspace().endswith(self.DeviceVolumeName) |
140 return self.getWorkspace(silent=True).endswith(self.DeviceVolumeName) |
141 |
141 |
142 def getWorkspace(self): |
142 def getWorkspace(self, silent=False): |
143 """ |
143 """ |
144 Public method to get the workspace directory. |
144 Public method to get the workspace directory. |
145 |
145 |
|
146 @param silent flag indicating silent operations |
|
147 @type bool |
146 @return workspace directory used for saving files |
148 @return workspace directory used for saving files |
147 @rtype str |
149 @rtype str |
148 """ |
150 """ |
149 # Attempts to find the path on the filesystem that represents the |
151 # Attempts to find the path on the filesystem that represents the |
150 # plugged in CIRCUITPY board. |
152 # plugged in CIRCUITPY board. |
151 deviceDirectory = Utilities.findVolume(self.DeviceVolumeName) |
153 deviceDirectory = Utilities.findVolume(self.DeviceVolumeName) |
152 |
154 |
153 if deviceDirectory: |
155 if deviceDirectory: |
154 return deviceDirectory |
156 return deviceDirectory |
155 else: |
157 else: |
156 # return the default workspace and give the user a warning |
158 # return the default workspace and give the user a warning (unless |
157 E5MessageBox.warning( |
159 # silent mode is selected) |
158 self.microPython, |
160 if not silent: |
159 self.tr("Workspace Directory"), |
161 E5MessageBox.warning( |
160 self.tr("Python files for CircuitPython devices are stored on" |
162 self.microPython, |
161 " the device. Therefore, to edit these files you need" |
163 self.tr("Workspace Directory"), |
162 " to have the device plugged in. Until you plug in a" |
164 self.tr("Python files for CircuitPython devices are stored" |
163 " device, the standard directory will be used.")) |
165 " on the device. Therefore, to edit these files" |
|
166 " you need to have the device plugged in. Until" |
|
167 " you plug in a device, the standard directory" |
|
168 " will be used.")) |
164 |
169 |
165 return super(CircuitPythonDevice, self).getWorkspace() |
170 return super(CircuitPythonDevice, self).getWorkspace() |
166 |
171 |
167 def addDeviceMenuEntries(self, menu): |
172 def addDeviceMenuEntries(self, menu): |
168 """ |
173 """ |