src/eric7/MicroPython/BluetoothDialogs/BluetoothController.py

branch
eric7
changeset 11166
fd914f897dcf
parent 11090
f5f5f5803935
child 11167
a3f5af773bc7
--- a/src/eric7/MicroPython/BluetoothDialogs/BluetoothController.py	Thu Mar 06 17:44:49 2025 +0100
+++ b/src/eric7/MicroPython/BluetoothDialogs/BluetoothController.py	Sun Mar 09 14:16:35 2025 +0100
@@ -31,6 +31,8 @@
 
         self.__mpy = microPython
 
+        self.__btStatusDialog = None
+
     def createMenu(self, menu):
         """
         Public method to create the Bluetooth submenu.
@@ -67,14 +69,14 @@
         """
         from .BluetoothStatusDialog import BluetoothStatusDialog
 
-        try:
-            status = self.__mpy.getDevice().getBluetoothStatus()
-            # status is a list of user labels and associated values
+        if self.__btStatusDialog is not None:
+            self.__btStatusDialog.deleteLater()
+            self.__btStatusDialog = None
 
-            dlg = BluetoothStatusDialog(status, parent=self.__mpy)
-            dlg.exec()
-        except Exception as exc:
-            self.__mpy.showError("getBluetoothStatus()", str(exc))
+        self.__btStatusDialog = BluetoothStatusDialog(
+            microPython=self.__mpy, parent=self.__mpy
+        )
+        self.__btStatusDialog.show()
 
     @pyqtSlot()
     def __activateInterface(self):

eric ide

mercurial