src/eric7/MicroPython/MicroPythonWidget.py

branch
mpy_network
changeset 9878
a82014a9e57b
parent 9855
c9244db5566a
child 9887
52a659bdc65a
equal deleted inserted replaced
9877:dad1f6d37366 9878:a82014a9e57b
41 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities 41 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities
42 from eric7.UI.Info import BugAddress 42 from eric7.UI.Info import BugAddress
43 43
44 from . import Devices, UF2FlashDialog 44 from . import Devices, UF2FlashDialog
45 from .BluetoothDialogs.BluetoothController import BluetoothController 45 from .BluetoothDialogs.BluetoothController import BluetoothController
46 from .EthernetDialogs.EthernetController import EthernetController
46 from .MicroPythonFileManager import MicroPythonFileManager 47 from .MicroPythonFileManager import MicroPythonFileManager
47 from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget 48 from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget
48 from .Ui_MicroPythonWidget import Ui_MicroPythonWidget 49 from .Ui_MicroPythonWidget import Ui_MicroPythonWidget
49 from .WifiDialogs.WifiController import WifiController 50 from .WifiDialogs.WifiController import WifiController
50 51
233 self.__wifiMenu = None 234 self.__wifiMenu = None
234 235
235 self.__bluetoothController = BluetoothController(self, self) 236 self.__bluetoothController = BluetoothController(self, self)
236 self.__btMenu = None 237 self.__btMenu = None
237 238
239 self.__ethernetController = EthernetController(self, self)
240 self.__ethernetMenu = None
241
238 self.__superMenu = QMenu(self) 242 self.__superMenu = QMenu(self)
239 self.__superMenu.aboutToShow.connect(self.__aboutToShowSuperMenu) 243 self.__superMenu.aboutToShow.connect(self.__aboutToShowSuperMenu)
240 244
241 self.menuButton.setObjectName("micropython_supermenu_button") 245 self.menuButton.setObjectName("micropython_supermenu_button")
242 self.menuButton.setIcon(EricPixmapCache.getIcon("superMenu")) 246 self.menuButton.setIcon(EricPixmapCache.getIcon("superMenu"))
1508 self.__btMenu.deleteLater() 1512 self.__btMenu.deleteLater()
1509 self.__btMenu = self.__bluetoothController.createMenu(self.__superMenu) 1513 self.__btMenu = self.__bluetoothController.createMenu(self.__superMenu)
1510 else: 1514 else:
1511 self.__btMenu = None 1515 self.__btMenu = None
1512 1516
1517 # prepare the Ethernet menu
1518 if (
1519 self.__device
1520 and self.__connected
1521 and self.__device.getDeviceData("ethernet")
1522 ):
1523 if self.__ethernetMenu is not None:
1524 self.__ethernetMenu.deleteLater()
1525 self.__ethernetMenu = self.__ethernetController.createMenu(self.__superMenu)
1526 else:
1527 self.__ethernetMenu = None
1528
1513 # populate the super menu 1529 # populate the super menu
1514 hasTime = self.__device.hasTimeCommands() if self.__device else False 1530 hasTime = self.__device.hasTimeCommands() if self.__device else False
1515 1531
1516 self.__superMenu.addAction( 1532 self.__superMenu.addAction(
1517 self.tr("Show Version"), self.__showDeviceVersion 1533 self.tr("Show Version"), self.__showDeviceVersion
1563 self.__superMenu.addSeparator() 1579 self.__superMenu.addSeparator()
1564 if self.__wifiMenu is not None: 1580 if self.__wifiMenu is not None:
1565 self.__superMenu.addMenu(self.__wifiMenu) 1581 self.__superMenu.addMenu(self.__wifiMenu)
1566 if self.__btMenu is not None: 1582 if self.__btMenu is not None:
1567 self.__superMenu.addMenu(self.__btMenu) 1583 self.__superMenu.addMenu(self.__btMenu)
1568 if self.__wifiMenu is not None or self.__btMenu is not None: 1584 if self.__ethernetMenu is not None:
1585 self.__superMenu.addMenu(self.__ethernetMenu)
1586 if (
1587 self.__wifiMenu is not None
1588 or self.__btMenu is not None
1589 or self.__ethernetMenu is not None
1590 ):
1569 self.__superMenu.addSeparator() 1591 self.__superMenu.addSeparator()
1570 if downloadMenu is None: 1592 if downloadMenu is None:
1571 # generic download action 1593 # generic download action
1572 self.__superMenu.addAction( 1594 self.__superMenu.addAction(
1573 self.tr("Download Firmware"), self.__downloadFirmware 1595 self.tr("Download Firmware"), self.__downloadFirmware

eric ide

mercurial