1434 text, functools.partial(self.__downloadFromUrl, url) |
1434 text, functools.partial(self.__downloadFromUrl, url) |
1435 ) |
1435 ) |
1436 else: |
1436 else: |
1437 downloadMenu = None |
1437 downloadMenu = None |
1438 |
1438 |
|
1439 # prepare the WiFi menu |
|
1440 if self.__device and self.__connected and self.__device.getDeviceData("wifi"): |
|
1441 wifiMenu = QMenu(self.tr("WiFi Functions"), self.__superMenu) |
|
1442 wifiMenu.addAction(self.tr("Show WiFi Status"), self.__showWifiStatus) |
|
1443 else: |
|
1444 wifiMenu = None |
|
1445 |
1439 # populate the super menu |
1446 # populate the super menu |
1440 hasTime = self.__device.hasTimeCommands() if self.__device else False |
1447 hasTime = self.__device.hasTimeCommands() if self.__device else False |
1441 |
1448 |
1442 self.__superMenu.addAction( |
1449 self.__superMenu.addAction( |
1443 self.tr("Show Version"), self.__showDeviceVersion |
1450 self.tr("Show Version"), self.__showDeviceVersion |
1477 ).setEnabled(available and bool(aw)) |
1484 ).setEnabled(available and bool(aw)) |
1478 self.__superMenu.addSeparator() |
1485 self.__superMenu.addSeparator() |
1479 if self.__device: |
1486 if self.__device: |
1480 self.__device.addDeviceMenuEntries(self.__superMenu) |
1487 self.__device.addDeviceMenuEntries(self.__superMenu) |
1481 self.__superMenu.addSeparator() |
1488 self.__superMenu.addSeparator() |
|
1489 if wifiMenu is not None: |
|
1490 self.__superMenu.addMenu(wifiMenu) |
|
1491 self.__superMenu.addSeparator() |
1482 if downloadMenu is None: |
1492 if downloadMenu is None: |
1483 # generic download action |
1493 # generic download action |
1484 self.__superMenu.addAction( |
1494 self.__superMenu.addAction( |
1485 self.tr("Download Firmware"), self.__downloadFirmware |
1495 self.tr("Download Firmware"), self.__downloadFirmware |
1486 ).setEnabled(self.__device.hasFirmwareUrl()) |
1496 ).setEnabled(self.__device.hasFirmwareUrl()) |
1986 parent=self, |
1996 parent=self, |
1987 ) |
1997 ) |
1988 dlg.show() |
1998 dlg.show() |
1989 except Exception as exc: |
1999 except Exception as exc: |
1990 self.__showError("getModules()", str(exc)) |
2000 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 |