src/eric7/MicroPython/Devices/PyBoardDevices.py

branch
eric7
changeset 9927
fa258d559f01
parent 9909
439f312e9c14
child 9989
286c2a21f36f
equal deleted inserted replaced
9926:6222ddc7e1bd 9927:fa258d559f01
246 self.tr("Flash MicroPython Firmware"), self.__flashMicroPython 246 self.tr("Flash MicroPython Firmware"), self.__flashMicroPython
247 ) 247 )
248 self.__pyboardMenu.addAction( 248 self.__pyboardMenu.addAction(
249 self.tr("MicroPython Flash Instructions"), self.__showFlashInstructions 249 self.tr("MicroPython Flash Instructions"), self.__showFlashInstructions
250 ) 250 )
251 self.__pyboardMenu.addSeparator()
252 self.__resetAct = self.__pyboardMenu.addAction(
253 self.tr("Reset Device"), self.__resetDevice
254 )
251 255
252 def addDeviceMenuEntries(self, menu): 256 def addDeviceMenuEntries(self, menu):
253 """ 257 """
254 Public method to add device specific entries to the given menu. 258 Public method to add device specific entries to the given menu.
255 259
261 265
262 self.__bootloaderAct.setEnabled(connected) 266 self.__bootloaderAct.setEnabled(connected)
263 self.__dfuAct.setEnabled(not linkConnected) 267 self.__dfuAct.setEnabled(not linkConnected)
264 self.__showMpyAct.setEnabled(connected) 268 self.__showMpyAct.setEnabled(connected)
265 self.__flashMpyAct.setEnabled(not linkConnected) 269 self.__flashMpyAct.setEnabled(not linkConnected)
270 self.__resetAct.setEnabled(connected)
266 271
267 menu.addMenu(self.__pyboardMenu) 272 menu.addMenu(self.__pyboardMenu)
268 273
269 def hasFlashMenuEntry(self): 274 def hasFlashMenuEntry(self):
270 """ 275 """
503 mode=self._submitMode, 508 mode=self._submitMode,
504 ) 509 )
505 # simulate pressing the disconnect button 510 # simulate pressing the disconnect button
506 self.microPython.on_connectButton_clicked() 511 self.microPython.on_connectButton_clicked()
507 512
513 @pyqtSlot()
514 def __resetDevice(self):
515 """
516 Private slot to reset the connected device.
517 """
518 self.microPython.deviceInterface().execute(
519 "import machine\nmachine.reset()\n", mode=self._submitMode
520 )
521
508 ################################################################## 522 ##################################################################
509 ## time related methods below 523 ## time related methods below
510 ################################################################## 524 ##################################################################
511 525
512 def _getSetTimeCode(self): 526 def _getSetTimeCode(self):

eric ide

mercurial