src/eric7/MicroPython/BluetoothDialogs/BluetoothStatusDialog.py

branch
eric7
changeset 11166
fd914f897dcf
parent 11090
f5f5f5803935
diff -r 24e1beb8779a -r fd914f897dcf src/eric7/MicroPython/BluetoothDialogs/BluetoothStatusDialog.py
--- a/src/eric7/MicroPython/BluetoothDialogs/BluetoothStatusDialog.py	Thu Mar 06 17:44:49 2025 +0100
+++ b/src/eric7/MicroPython/BluetoothDialogs/BluetoothStatusDialog.py	Sun Mar 09 14:16:35 2025 +0100
@@ -7,9 +7,11 @@
 Module implementing a dialog to show Bluetooth related status information.
 """
 
-from PyQt6.QtCore import Qt
+from PyQt6.QtCore import Qt, pyqtSlot
 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem
 
+from eric7.EricGui import EricPixmapCache
+
 from .Ui_BluetoothStatusDialog import Ui_BluetoothStatusDialog
 
 
@@ -18,20 +20,42 @@
     Class implementing a dialog to show Bluetooth related status information.
     """
 
-    def __init__(self, status, parent=None):
+    def __init__(self, microPython, parent=None):
         """
         Constructor
 
-        @param status status data to be show
-        @type list of tuples of (str, str)
+        @param microPython reference to the MicroPython widget
+        @type MicroPythonWidget
         @param parent reference to the parent widget (defaults to None)
         @type QWidget (optional)
         """
         super().__init__(parent)
         self.setupUi(self)
+        self.setWindowFlags(Qt.WindowType.Window)
 
         self.statusTree.setColumnCount(2)
 
+        self.refreshButton.setIcon(EricPixmapCache.getIcon("reload"))
+        self.refreshButton.clicked.connect(self.__showStatus)
+
+        self.__mpy = microPython
+
+        self.__showStatus()
+
+    @pyqtSlot()
+    def __showStatus(self):
+        """
+        Private slot to show the current WiFi status.
+        """
+        self.statusTree.clear()
+
+        try:
+            status = self.__mpy.getDevice().getBluetoothStatus()
+            # status is a list of user labels and associated values
+        except Exception as exc:
+            self.__mpy.showError("getBluetoothStatus()", str(exc))
+            return
+
         for topic, value in status:
             QTreeWidgetItem(self.statusTree, [topic, str(value)])
 

eric ide

mercurial