9 |
9 |
10 from PyQt6.QtCore import Qt, pyqtSlot |
10 from PyQt6.QtCore import Qt, pyqtSlot |
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem |
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem |
12 |
12 |
13 from eric7.EricGui import EricPixmapCache |
13 from eric7.EricGui import EricPixmapCache |
|
14 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor |
14 from eric7.SystemUtilities.NetworkUtilities import ipv6AddressScope |
15 from eric7.SystemUtilities.NetworkUtilities import ipv6AddressScope |
15 |
16 |
16 from .Ui_EthernetStatusDialog import Ui_EthernetStatusDialog |
17 from .Ui_EthernetStatusDialog import Ui_EthernetStatusDialog |
17 |
18 |
18 |
19 |
39 self.refreshButton.setIcon(EricPixmapCache.getIcon("reload")) |
40 self.refreshButton.setIcon(EricPixmapCache.getIcon("reload")) |
40 self.refreshButton.clicked.connect(self.__showStatus) |
41 self.refreshButton.clicked.connect(self.__showStatus) |
41 |
42 |
42 self.__mpy = microPython |
43 self.__mpy = microPython |
43 |
44 |
|
45 @pyqtSlot() |
|
46 def show(self): |
|
47 """ |
|
48 Public slot to show the dialog and populate the status. |
|
49 """ |
|
50 super().show() |
|
51 |
44 self.__showStatus() |
52 self.__showStatus() |
45 |
53 |
46 @pyqtSlot() |
54 @pyqtSlot() |
47 def __showStatus(self): |
55 def __showStatus(self): |
48 """ |
56 """ |
50 """ |
58 """ |
51 # clear old data |
59 # clear old data |
52 self.statusTree.clear() |
60 self.statusTree.clear() |
53 |
61 |
54 # get the status |
62 # get the status |
55 try: |
63 with EricOverrideCursor(): |
56 status, addressInfo = self.__mpy.getDevice().getEthernetStatus() |
64 try: |
57 except Exception as exc: |
65 status, addressInfo = self.__mpy.getDevice().getEthernetStatus() |
58 self.__mpy.showError("getEthernetStatus()", str(exc)) |
66 except Exception as exc: |
59 return |
67 self.__mpy.showError("getEthernetStatus()", str(exc)) |
|
68 return |
60 |
69 |
61 for topic, value in status: |
70 for topic, value in status: |
62 QTreeWidgetItem(self.statusTree, [topic, str(value)]) |
71 QTreeWidgetItem(self.statusTree, [topic, str(value)]) |
63 |
72 |
64 if addressInfo["ipv4"]: |
73 if addressInfo["ipv4"]: |