src/eric7/MicroPython/BluetoothDialogs/BluetoothScanWindow.py

branch
mpy_network
changeset 9859
829c1edbf253
parent 9857
0122ae72618d
child 10090
8be7dd9460c5
diff -r 6518c336fcd3 -r 829c1edbf253 src/eric7/MicroPython/BluetoothDialogs/BluetoothScanWindow.py
--- a/src/eric7/MicroPython/BluetoothDialogs/BluetoothScanWindow.py	Wed Mar 08 17:40:14 2023 +0100
+++ b/src/eric7/MicroPython/BluetoothDialogs/BluetoothScanWindow.py	Wed Mar 08 19:27:43 2023 +0100
@@ -73,6 +73,9 @@
             )
 
         else:
+            self.statusLabel.setText(
+                self.tr("<p>Detected <b>%n</b> device(s).</p>", "", len(scanResults))
+            )
             for res in scanResults.values():
                 name = res.name
                 if not name:
@@ -95,19 +98,31 @@
                         if isComplete
                         else self.tr("Incomplete {0}-bit Service UUID: {1}")
                     )
-                    sitm = QTreeWidgetItem(itm, [template.format(bits, service)])
-                    sitm.setFirstColumnSpanned(True)
+                    citm = QTreeWidgetItem(itm, [template.format(bits, service)])
+                    citm.setFirstColumnSpanned(True)
 
+                seenMIds = []
                 for mid, _, mname in res.manufacturer(withName=True):
-                    mitm = QTreeWidgetItem(
-                        itm,
-                        [
-                            self.tr("Manufacturer ID: 0x{0:x} ({1})").format(mid, mname)
-                            if bool(mname)
-                            else self.tr("Manufacturer ID: 0x{0:x}").format(mid)
-                        ],
+                    if mid not in seenMIds:
+                        citm = QTreeWidgetItem(
+                            itm,
+                            [
+                                self.tr("Manufacturer ID: 0x{0:x} ({1})").format(
+                                    mid, mname
+                                )
+                                if bool(mname)
+                                else self.tr("Manufacturer ID: 0x{0:x}").format(mid)
+                            ],
+                        )
+                        citm.setFirstColumnSpanned(True)
+                        seenMIds.append(mid)
+
+                txPower = res.txPower
+                if txPower:
+                    citm = QTreeWidgetItem(
+                        itm, [self.tr("Tx Power Level [dBm]: {0}").format(txPower)]
                     )
-                    mitm.setFirstColumnSpanned(True)
+                    citm.setFirstColumnSpanned(True)
 
             self.__resizeColumns()
             self.__resort()

eric ide

mercurial