src/eric7/WebBrowser/VirusTotal/VirusTotalIpReportDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
17 17
18 class VirusTotalIpReportDialog(QDialog, Ui_VirusTotalIpReportDialog): 18 class VirusTotalIpReportDialog(QDialog, Ui_VirusTotalIpReportDialog):
19 """ 19 """
20 Class implementing a dialog to show the VirusTotal IP address report. 20 Class implementing a dialog to show the VirusTotal IP address report.
21 """ 21 """
22
22 def __init__(self, ip, owner, resolutions, urls, parent=None): 23 def __init__(self, ip, owner, resolutions, urls, parent=None):
23 """ 24 """
24 Constructor 25 Constructor
25 26
26 @param ip IP address 27 @param ip IP address
27 @type str 28 @type str
28 @param owner owner of the IP address 29 @param owner owner of the IP address
29 @type str 30 @type str
30 @param resolutions list of resolved host names 31 @param resolutions list of resolved host names
35 @type QWidget 36 @type QWidget
36 """ 37 """
37 super().__init__(parent) 38 super().__init__(parent)
38 self.setupUi(self) 39 self.setupUi(self)
39 self.setWindowFlags(Qt.WindowType.Window) 40 self.setWindowFlags(Qt.WindowType.Window)
40 41
41 self.headerLabel.setText( 42 self.headerLabel.setText(self.tr("<b>Report for IP {0}</b>").format(ip))
42 self.tr("<b>Report for IP {0}</b>").format(ip)) 43 self.headerPixmap.setPixmap(UI.PixmapCache.getPixmap("virustotal"))
43 self.headerPixmap.setPixmap(
44 UI.PixmapCache.getPixmap("virustotal"))
45 self.ownerLabel.setText(owner) 44 self.ownerLabel.setText(owner)
46 45
47 for resolution in resolutions: 46 for resolution in resolutions:
48 QTreeWidgetItem( 47 QTreeWidgetItem(
49 self.resolutionsList, 48 self.resolutionsList,
50 [resolution["hostname"], 49 [resolution["hostname"], resolution["last_resolved"].split()[0]],
51 resolution["last_resolved"].split()[0]]
52 ) 50 )
53 self.resolutionsList.resizeColumnToContents(0) 51 self.resolutionsList.resizeColumnToContents(0)
54 self.resolutionsList.resizeColumnToContents(1) 52 self.resolutionsList.resizeColumnToContents(1)
55 self.resolutionsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) 53 self.resolutionsList.sortByColumn(0, Qt.SortOrder.AscendingOrder)
56 54
57 if not urls: 55 if not urls:
58 self.detectedUrlsGroup.setVisible(False) 56 self.detectedUrlsGroup.setVisible(False)
59 for url in urls: 57 for url in urls:
60 QTreeWidgetItem( 58 QTreeWidgetItem(
61 self.urlsList, 59 self.urlsList,
62 [url["url"], 60 [
63 self.tr("{0}/{1}", "positives / total").format( 61 url["url"],
64 url["positives"], url["total"]), 62 self.tr("{0}/{1}", "positives / total").format(
65 url["scan_date"].split()[0]] 63 url["positives"], url["total"]
64 ),
65 url["scan_date"].split()[0],
66 ],
66 ) 67 )
67 self.urlsList.resizeColumnToContents(0) 68 self.urlsList.resizeColumnToContents(0)
68 self.urlsList.resizeColumnToContents(1) 69 self.urlsList.resizeColumnToContents(1)
69 self.urlsList.resizeColumnToContents(2) 70 self.urlsList.resizeColumnToContents(2)
70 self.urlsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) 71 self.urlsList.sortByColumn(0, Qt.SortOrder.AscendingOrder)

eric ide

mercurial