55 self.__updater = CircuitPythonUpdaterInterface(self) |
55 self.__updater = CircuitPythonUpdaterInterface(self) |
56 |
56 |
57 self.__nonUF2devices = { |
57 self.__nonUF2devices = { |
58 "teensy": self.__flashTeensy, |
58 "teensy": self.__flashTeensy, |
59 } |
59 } |
|
60 |
|
61 self.__createCPyMenu() |
60 |
62 |
61 def setButtons(self): |
63 def setButtons(self): |
62 """ |
64 """ |
63 Public method to enable the supported action buttons. |
65 Public method to enable the supported action buttons. |
64 """ |
66 """ |
238 return self.__workspace |
240 return self.__workspace |
239 else: |
241 else: |
240 self.__workspace = self.__findWorkspace(silent=silent) |
242 self.__workspace = self.__findWorkspace(silent=silent) |
241 return self.__workspace |
243 return self.__workspace |
242 |
244 |
243 def addDeviceMenuEntries(self, menu): |
245 def __createCPyMenu(self): |
244 """ |
246 """ |
245 Public method to add device specific entries to the given menu. |
247 Private method to create the CircuitPython submenu. |
246 |
248 """ |
247 @param menu reference to the context menu |
|
248 @type QMenu |
|
249 """ |
|
250 linkConnected = self.microPython.isLinkConnected() |
|
251 |
|
252 self.__libraryMenu = QMenu(self.tr("Library Management")) |
249 self.__libraryMenu = QMenu(self.tr("Library Management")) |
253 self.__libraryMenu.aboutToShow.connect(self.__aboutToShowLibraryMenu) |
250 self.__libraryMenu.aboutToShow.connect(self.__aboutToShowLibraryMenu) |
254 self.__libraryMenu.setTearOffEnabled(True) |
251 self.__libraryMenu.setTearOffEnabled(True) |
255 |
252 |
256 menu.addAction( |
253 self.__cpyMenu = QMenu(self.tr("CircuitPython Functions")) |
|
254 |
|
255 self.__cpyMenu.addAction( |
257 self.tr("Show CircuitPython Versions"), self.__showCircuitPythonVersions |
256 self.tr("Show CircuitPython Versions"), self.__showCircuitPythonVersions |
258 ) |
257 ) |
259 act = menu.addAction( |
258 self.__cpyMenu.addSeparator() |
|
259 self.__flashCpyAct = self.__cpyMenu.addAction( |
260 self.tr("Flash CircuitPython Firmware"), self.__flashCircuitPython |
260 self.tr("Flash CircuitPython Firmware"), self.__flashCircuitPython |
261 ) |
261 ) |
262 act.setEnabled(not linkConnected) |
262 self.__cpyMenu.addSeparator() |
263 menu.addSeparator() |
263 self.__cpyMenu.addMenu(self.__libraryMenu) |
264 menu.addMenu(self.__libraryMenu) |
264 |
|
265 |
|
266 def addDeviceMenuEntries(self, menu): |
|
267 """ |
|
268 Public method to add device specific entries to the given menu. |
|
269 |
|
270 @param menu reference to the context menu |
|
271 @type QMenu |
|
272 """ |
|
273 linkConnected = self.microPython.isLinkConnected() |
|
274 |
|
275 self.__flashCpyAct.setEnabled(not linkConnected) |
|
276 |
|
277 menu.addMenu(self.__cpyMenu) |
265 |
278 |
266 @pyqtSlot() |
279 @pyqtSlot() |
267 def __aboutToShowLibraryMenu(self): |
280 def __aboutToShowLibraryMenu(self): |
268 """ |
281 """ |
269 Private slot to populate the 'Library Management' menu. |
282 Private slot to populate the 'Library Management' menu. |