7 Module implementing a dialog to show details about a package. |
7 Module implementing a dialog to show details about a package. |
8 """ |
8 """ |
9 |
9 |
10 |
10 |
11 from PyQt5.QtCore import Qt, QLocale |
11 from PyQt5.QtCore import Qt, QLocale |
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem, \ |
12 from PyQt5.QtWidgets import ( |
13 QLabel, QHeaderView |
13 QDialog, QDialogButtonBox, QTreeWidgetItem, QLabel, QHeaderView |
|
14 ) |
14 |
15 |
15 from .Ui_PipPackageDetailsDialog import Ui_PipPackageDetailsDialog |
16 from .Ui_PipPackageDetailsDialog import Ui_PipPackageDetailsDialog |
16 |
17 |
17 |
18 |
18 class PipPackageDetailsDialog(QDialog, Ui_PipPackageDetailsDialog): |
19 class PipPackageDetailsDialog(QDialog, Ui_PipPackageDetailsDialog): |
174 elif text == "any": |
175 elif text == "any": |
175 text = self.tr("any") |
176 text = self.tr("any") |
176 elif text is None: |
177 elif text is None: |
177 text = "" |
178 text = "" |
178 if forUrl: |
179 if forUrl: |
179 if not isinstance(text, str) or \ |
180 if ( |
180 not text.startswith(("http://", "https://", "ftp://")): |
181 not isinstance(text, str) or |
|
182 not text.startswith(("http://", "https://", "ftp://")) |
|
183 ): |
181 # ignore if the schema is not one of the listed ones |
184 # ignore if the schema is not one of the listed ones |
182 text = "" |
185 text = "" |
183 |
186 |
184 return text |
187 return text |
185 |
188 |