src/eric7/MicroPython/MicroPythonWidget.py

branch
mpy_network
changeset 9855
c9244db5566a
parent 9853
080e060a0383
child 9878
a82014a9e57b
--- a/src/eric7/MicroPython/MicroPythonWidget.py	Mon Mar 06 17:03:40 2023 +0100
+++ b/src/eric7/MicroPython/MicroPythonWidget.py	Tue Mar 07 16:22:07 2023 +0100
@@ -42,6 +42,7 @@
 from eric7.UI.Info import BugAddress
 
 from . import Devices, UF2FlashDialog
+from .BluetoothDialogs.BluetoothController import BluetoothController
 from .MicroPythonFileManager import MicroPythonFileManager
 from .MicroPythonFileManagerWidget import MicroPythonFileManagerWidget
 from .Ui_MicroPythonWidget import Ui_MicroPythonWidget
@@ -231,6 +232,9 @@
         self.__wifiController = WifiController(self, self)
         self.__wifiMenu = None
 
+        self.__bluetoothController = BluetoothController(self, self)
+        self.__btMenu = None
+
         self.__superMenu = QMenu(self)
         self.__superMenu.aboutToShow.connect(self.__aboutToShowSuperMenu)
 
@@ -1494,6 +1498,18 @@
         else:
             self.__wifiMenu = None
 
+        # prepare the Bluetooth menu
+        if (
+            self.__device
+            and self.__connected
+            and self.__device.getDeviceData("bluetooth")
+        ):
+            if self.__btMenu is not None:
+                self.__btMenu.deleteLater()
+            self.__btMenu = self.__bluetoothController.createMenu(self.__superMenu)
+        else:
+            self.__btMenu = None
+
         # populate the super menu
         hasTime = self.__device.hasTimeCommands() if self.__device else False
 
@@ -1547,6 +1563,9 @@
             self.__superMenu.addSeparator()
             if self.__wifiMenu is not None:
                 self.__superMenu.addMenu(self.__wifiMenu)
+            if self.__btMenu is not None:
+                self.__superMenu.addMenu(self.__btMenu)
+            if self.__wifiMenu is not None or self.__btMenu is not None:
                 self.__superMenu.addSeparator()
             if downloadMenu is None:
                 # generic download action

eric ide

mercurial