src/eric7/MicroPython/EthernetDialogs/EthernetStatusDialog.py

branch
mpy_network
changeset 9878
a82014a9e57b
child 10439
21c28b0f9e41
equal deleted inserted replaced
9877:dad1f6d37366 9878:a82014a9e57b
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to show Ethernet related status information.
8 """
9
10 from PyQt6.QtCore import Qt
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem
12
13 from .Ui_EthernetStatusDialog import Ui_EthernetStatusDialog
14
15
16 class EthernetStatusDialog(QDialog, Ui_EthernetStatusDialog):
17 """
18 Class implementing a dialog to show Ethernet related status information.
19 """
20
21 def __init__(self, status, parent=None):
22 """
23 Constructor
24
25 @param status status data to be show
26 @type list of tuples of (str, str)
27 @param parent reference to the parent widget (defaults to None)
28 @type QWidget (optional)
29 """
30 super().__init__(parent)
31 self.setupUi(self)
32
33 self.statusTree.setColumnCount(2)
34
35 for topic, value in status:
36 QTreeWidgetItem(self.statusTree, [topic, str(value)])
37
38 for col in range(self.statusTree.columnCount()):
39 self.statusTree.resizeColumnToContents(col)
40
41 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True)
42 self.buttonBox.setFocus(Qt.FocusReason.OtherFocusReason)

eric ide

mercurial