245 Public method to add device specific entries to the given menu. |
245 Public method to add device specific entries to the given menu. |
246 |
246 |
247 @param menu reference to the context menu |
247 @param menu reference to the context menu |
248 @type QMenu |
248 @type QMenu |
249 """ |
249 """ |
250 connected = self.microPython.isConnected() |
250 linkConnected = self.microPython.isLinkConnected() |
251 |
251 |
252 self.__libraryMenu = QMenu(self.tr("Library Management")) |
252 self.__libraryMenu = QMenu(self.tr("Library Management")) |
253 self.__libraryMenu.aboutToShow.connect(self.__aboutToShowLibraryMenu) |
253 self.__libraryMenu.aboutToShow.connect(self.__aboutToShowLibraryMenu) |
254 self.__libraryMenu.setTearOffEnabled(True) |
254 self.__libraryMenu.setTearOffEnabled(True) |
255 |
255 |
257 self.tr("Show CircuitPython Versions"), self.__showCircuitPythonVersions |
257 self.tr("Show CircuitPython Versions"), self.__showCircuitPythonVersions |
258 ) |
258 ) |
259 act = menu.addAction( |
259 act = menu.addAction( |
260 self.tr("Flash CircuitPython Firmware"), self.__flashCircuitPython |
260 self.tr("Flash CircuitPython Firmware"), self.__flashCircuitPython |
261 ) |
261 ) |
262 act.setEnabled(not connected) |
262 act.setEnabled(not linkConnected) |
263 menu.addSeparator() |
263 menu.addSeparator() |
264 menu.addMenu(self.__libraryMenu) |
264 menu.addMenu(self.__libraryMenu) |
265 |
265 |
266 @pyqtSlot() |
266 @pyqtSlot() |
267 def __aboutToShowLibraryMenu(self): |
267 def __aboutToShowLibraryMenu(self): |