src/eric7/CondaInterface/CondaPackageDetailsWidget.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
17 17
18 class CondaPackageDetailsWidget(QWidget, Ui_CondaPackageDetailsWidget): 18 class CondaPackageDetailsWidget(QWidget, Ui_CondaPackageDetailsWidget):
19 """ 19 """
20 Class implementing a widget to show package details. 20 Class implementing a widget to show package details.
21 """ 21 """
22
22 def __init__(self, details, parent=None): 23 def __init__(self, details, parent=None):
23 """ 24 """
24 Constructor 25 Constructor
25 26
26 @param details dictionary containing the package details 27 @param details dictionary containing the package details
27 @type dict 28 @type dict
28 @param parent reference to the parent widget 29 @param parent reference to the parent widget
29 @type QWidget 30 @type QWidget
30 """ 31 """
31 super().__init__(parent) 32 super().__init__(parent)
32 self.setupUi(self) 33 self.setupUi(self)
33 34
34 self.headerLabel.setText(self.tr("<b>{0} / {1} / {2}</b>").format( 35 self.headerLabel.setText(
35 details["name"], details["version"], details["build"])) 36 self.tr("<b>{0} / {1} / {2}</b>").format(
37 details["name"], details["version"], details["build"]
38 )
39 )
36 if "fn" in details: 40 if "fn" in details:
37 self.filenameLabel.setText(details["fn"]) 41 self.filenameLabel.setText(details["fn"])
38 if "size" in details: 42 if "size" in details:
39 self.sizeLabel.setText(dataString(details["size"])) 43 self.sizeLabel.setText(dataString(details["size"]))
40 if "channel" in details: 44 if "channel" in details:
51 self.platformLabel.setText(details["platform"]) 55 self.platformLabel.setText(details["platform"])
52 else: 56 else:
53 self.platformLabel.setText(self.tr("unknown")) 57 self.platformLabel.setText(self.tr("unknown"))
54 if "depends" in details: 58 if "depends" in details:
55 self.dependenciesEdit.setPlainText("\n".join(details["depends"])) 59 self.dependenciesEdit.setPlainText("\n".join(details["depends"]))
56 60
57 if "timestamp" in details: 61 if "timestamp" in details:
58 dt = QDateTime.fromMSecsSinceEpoch(details["timestamp"], 62 dt = QDateTime.fromMSecsSinceEpoch(details["timestamp"], Qt.TimeSpec.UTC)
59 Qt.TimeSpec.UTC)
60 self.timestampLabel.setText(dt.toString("yyyy-MM-dd hh:mm:ss t")) 63 self.timestampLabel.setText(dt.toString("yyyy-MM-dd hh:mm:ss t"))
61 64
62 self.resize(600, 450) 65 self.resize(600, 450)
63 66
64 67
65 class CondaPackageDetailsDialog(QDialog): 68 class CondaPackageDetailsDialog(QDialog):
66 """ 69 """
67 Class implementing a dialog to show package details. 70 Class implementing a dialog to show package details.
68 """ 71 """
72
69 def __init__(self, details, parent=None): 73 def __init__(self, details, parent=None):
70 """ 74 """
71 Constructor 75 Constructor
72 76
73 @param details dictionary containing the package details 77 @param details dictionary containing the package details
74 @type dict 78 @type dict
75 @param parent reference to the parent widget 79 @param parent reference to the parent widget
76 @type QWidget 80 @type QWidget
77 """ 81 """
78 super().__init__(parent) 82 super().__init__(parent)
79 self.setSizeGripEnabled(True) 83 self.setSizeGripEnabled(True)
80 84
81 self.__layout = QVBoxLayout(self) 85 self.__layout = QVBoxLayout(self)
82 self.setLayout(self.__layout) 86 self.setLayout(self.__layout)
83 87
84 self.__cw = CondaPackageDetailsWidget(details, self) 88 self.__cw = CondaPackageDetailsWidget(details, self)
85 size = self.__cw.size() 89 size = self.__cw.size()
86 self.__layout.addWidget(self.__cw) 90 self.__layout.addWidget(self.__cw)
87 self.__buttonBox = QDialogButtonBox(self) 91 self.__buttonBox = QDialogButtonBox(self)
88 self.__buttonBox.setStandardButtons( 92 self.__buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Close)
89 QDialogButtonBox.StandardButton.Close)
90 self.__layout.addWidget(self.__buttonBox) 93 self.__layout.addWidget(self.__buttonBox)
91 94
92 self.resize(size) 95 self.resize(size)
93 self.setWindowTitle(self.tr("Package Details")) 96 self.setWindowTitle(self.tr("Package Details"))
94 97
95 self.__buttonBox.accepted.connect(self.accept) 98 self.__buttonBox.accepted.connect(self.accept)
96 self.__buttonBox.rejected.connect(self.reject) 99 self.__buttonBox.rejected.connect(self.reject)

eric ide

mercurial