def update(self, servers, protocol, use_tor): self.clear() for _host, d in sorted(servers.items()): if _host.endswith('.onion') and not use_tor: continue port = d.get(protocol) if port: x = QTreeWidgetItem([_host, port]) server = serialize_server(_host, port, protocol) x.setData(1, Qt.UserRole, server) self.addTopLevelItem(x) h = self.header() h.setStretchLastSection(False) h.setSectionResizeMode(0, QHeaderView.Stretch) h.setSectionResizeMode(1, QHeaderView.ResizeToContents)
def update(self, servers, protocol, use_tor): self.clear() for _host, d in sorted(servers.items()): if _host.endswith('.onion') and not use_tor: continue port = d.get(protocol) if port: x = QTreeWidgetItem([_host, port]) server = serialize_server(_host, port, protocol) x.setData(1, Qt.UserRole, server) self.addTopLevelItem(x) h = self.header() h.setStretchLastSection(False) h.setSectionResizeMode(0, QHeaderView.Stretch) h.setSectionResizeMode(1, QHeaderView.ResizeToContents) super().update()