26 """ |
26 """ |
27 def __init__(self, detailsData, downloadsData, parent=None): |
27 def __init__(self, detailsData, downloadsData, parent=None): |
28 """ |
28 """ |
29 Constructor |
29 Constructor |
30 |
30 |
31 @param detailsData package details (dict) |
31 @param detailsData package details |
32 @param downloadsData downloads information (dict) |
32 @type dict |
33 @param parent reference to the parent widget (QWidget) |
33 @param downloadsData downloads information |
|
34 @type dict |
|
35 @param parent reference to the parent widget |
|
36 @type QWidget |
34 """ |
37 """ |
35 super(PipPackageDetailsDialog, self).__init__(parent) |
38 super(PipPackageDetailsDialog, self).__init__(parent) |
36 self.setupUi(self) |
39 self.setupUi(self) |
37 self.setWindowFlags(Qt.Window) |
40 self.setWindowFlags(Qt.Window) |
38 |
41 |
54 |
57 |
55 def __populateDetails(self, detailsData): |
58 def __populateDetails(self, detailsData): |
56 """ |
59 """ |
57 Private method to populate the details tab. |
60 Private method to populate the details tab. |
58 |
61 |
59 @param detailsData package details (dict) |
62 @param detailsData package details |
|
63 @type dict |
60 """ |
64 """ |
61 self.packageNameLabel.setText( |
65 self.packageNameLabel.setText( |
62 "<h1>{0} {1}</h1".format(self.__sanitize(detailsData["name"]), |
66 "<h1>{0} {1}</h1".format(self.__sanitize(detailsData["name"]), |
63 self.__sanitize(detailsData["version"]))) |
67 self.__sanitize(detailsData["version"]))) |
64 self.summaryLabel.setText( |
68 self.summaryLabel.setText( |
97 |
101 |
98 def __populateDownloadUrls(self, downloadsData): |
102 def __populateDownloadUrls(self, downloadsData): |
99 """ |
103 """ |
100 Private method to populate the download URLs tab. |
104 Private method to populate the download URLs tab. |
101 |
105 |
102 @param downloadsData downloads information (dict) |
106 @param downloadsData downloads information |
|
107 @type dict |
103 """ |
108 """ |
104 index = self.infoWidget.indexOf(self.urls) |
109 index = self.infoWidget.indexOf(self.urls) |
105 if downloadsData: |
110 if downloadsData: |
106 self.infoWidget.setTabEnabled(index, True) |
111 self.infoWidget.setTabEnabled(index, True) |
107 for download in downloadsData: |
112 for download in downloadsData: |
135 |
140 |
136 def __populateRequiresProvides(self, detailsData): |
141 def __populateRequiresProvides(self, detailsData): |
137 """ |
142 """ |
138 Private method to populate the requires/provides tab. |
143 Private method to populate the requires/provides tab. |
139 |
144 |
140 @param detailsData package details (dict) |
145 @param detailsData package details |
|
146 @type dict |
141 """ |
147 """ |
142 populatedItems = 0 |
148 populatedItems = 0 |
143 |
149 |
144 if "requires" in detailsData: |
150 if "requires" in detailsData: |
145 self.requiredPackagesList.addItems(detailsData["requires"]) |
151 self.requiredPackagesList.addItems(detailsData["requires"]) |
161 |
167 |
162 def __sanitize(self, text, forUrl=False): |
168 def __sanitize(self, text, forUrl=False): |
163 """ |
169 """ |
164 Private method to clean-up the given text. |
170 Private method to clean-up the given text. |
165 |
171 |
166 @param text raw text (string) |
172 @param text raw text |
167 @param forUrl flag indicating to sanitize an URL text (boolean) |
173 @type str |
168 @return processed text (string) |
174 @param forUrl flag indicating to sanitize an URL text |
|
175 @type bool |
|
176 @return processed text |
|
177 @rtype str |
169 """ |
178 """ |
170 if text == "UNKNOWN": |
179 if text == "UNKNOWN": |
171 text = "" |
180 text = "" |
172 elif text == "any": |
181 elif text == "any": |
173 text = self.tr("any") |
182 text = self.tr("any") |
198 |
207 |
199 def __formatSize(self, size): |
208 def __formatSize(self, size): |
200 """ |
209 """ |
201 Private slot to format the size. |
210 Private slot to format the size. |
202 |
211 |
203 @param size size to be formatted (integer) |
212 @param size size to be formatted |
204 @return formatted size (string) |
213 @type int |
|
214 @return formatted size |
|
215 @rtype str |
205 """ |
216 """ |
206 unit = "" |
217 unit = "" |
207 if size < 1024: |
218 if size < 1024: |
208 unit = self.tr("B") |
219 unit = self.tr("B") |
209 elif size < 1024 * 1024: |
220 elif size < 1024 * 1024: |