39 from eric7.UI.Info import BugAddress |
39 from eric7.UI.Info import BugAddress |
40 |
40 |
41 from . import Devices, UF2FlashDialog |
41 from . import Devices, UF2FlashDialog |
42 from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget |
42 from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget |
43 from .Ui_MicroPythonWidget import Ui_MicroPythonWidget |
43 from .Ui_MicroPythonWidget import Ui_MicroPythonWidget |
|
44 from .WifiDialogs.WifiController import WifiController |
44 |
45 |
45 try: |
46 try: |
46 from .MicroPythonGraphWidget import MicroPythonGraphWidget |
47 from .MicroPythonGraphWidget import MicroPythonGraphWidget |
47 |
48 |
48 HAS_QTCHART = True |
49 HAS_QTCHART = True |
220 self.setupUi(self) |
221 self.setupUi(self) |
221 |
222 |
222 self.layout().setContentsMargins(0, 3, 0, 0) |
223 self.layout().setContentsMargins(0, 3, 0, 0) |
223 |
224 |
224 self.__ui = parent |
225 self.__ui = parent |
|
226 self.__wifiController = WifiController(self, self) |
225 |
227 |
226 self.__superMenu = QMenu(self) |
228 self.__superMenu = QMenu(self) |
227 self.__superMenu.aboutToShow.connect(self.__aboutToShowSuperMenu) |
229 self.__superMenu.aboutToShow.connect(self.__aboutToShowSuperMenu) |
228 |
230 |
229 self.menuButton.setObjectName("micropython_supermenu_button") |
231 self.menuButton.setObjectName("micropython_supermenu_button") |
1113 @rtype str |
1115 @rtype str |
1114 """ |
1116 """ |
1115 boardName = self.deviceTypeComboBox.currentData(self.DeviceBoardRole) |
1117 boardName = self.deviceTypeComboBox.currentData(self.DeviceBoardRole) |
1116 return boardName |
1118 return boardName |
1117 |
1119 |
|
1120 def getDevice(self): |
|
1121 """ |
|
1122 Public method to get a reference to the current device. |
|
1123 |
|
1124 @return reference to the current device |
|
1125 @rtype BaseDevice |
|
1126 """ |
|
1127 return self.__device |
|
1128 |
1118 def getDeviceWorkspace(self): |
1129 def getDeviceWorkspace(self): |
1119 """ |
1130 """ |
1120 Public method to get the workspace directory of the device. |
1131 Public method to get the workspace directory of the device. |
1121 |
1132 |
1122 @return workspace directory of the device |
1133 @return workspace directory of the device |
1436 else: |
1447 else: |
1437 downloadMenu = None |
1448 downloadMenu = None |
1438 |
1449 |
1439 # prepare the WiFi menu |
1450 # prepare the WiFi menu |
1440 if self.__device and self.__connected and self.__device.getDeviceData("wifi"): |
1451 if self.__device and self.__connected and self.__device.getDeviceData("wifi"): |
1441 wifiMenu = QMenu(self.tr("WiFi Functions"), self.__superMenu) |
1452 wifiMenu = self.__wifiController.createMenu(self.__superMenu) |
1442 wifiMenu.addAction(self.tr("Show WiFi Status"), self.__showWifiStatus) |
|
1443 else: |
1453 else: |
1444 wifiMenu = None |
1454 wifiMenu = None |
1445 |
1455 |
1446 # populate the super menu |
1456 # populate the super menu |
1447 hasTime = self.__device.hasTimeCommands() if self.__device else False |
1457 hasTime = self.__device.hasTimeCommands() if self.__device else False |
1996 parent=self, |
2006 parent=self, |
1997 ) |
2007 ) |
1998 dlg.show() |
2008 dlg.show() |
1999 except Exception as exc: |
2009 except Exception as exc: |
2000 self.__showError("getModules()", str(exc)) |
2010 self.__showError("getModules()", str(exc)) |
2001 |
|
2002 ############################################################################ |
|
2003 ## WiFi related methods below |
|
2004 ############################################################################ |
|
2005 |
|
2006 def __showWifiStatus(self): |
|
2007 """ |
|
2008 Private method to show a dialog with the WiFi status of the current device. |
|
2009 """ |
|
2010 from .WifiStatusDialog import WifiStatusDialog |
|
2011 |
|
2012 try: |
|
2013 clientStatus, apStatus = self.__device.getWifiData() |
|
2014 |
|
2015 dlg = WifiStatusDialog(clientStatus, apStatus) |
|
2016 dlg.exec() |
|
2017 except Exception as exc: |
|
2018 self.__showError("getWifiData()", str(exc)) |
|
2019 |
|