class maintainer_gui(QTabWidget): LOG_REQUEST_TIMEOUT = 20 # 10 seconds until request is invalid def __init__(self, parent, logger): super(maintainer_gui, self).__init__(parent) self.logger = logger self.info_table = None self.membersWidget = MembersWidget(parent, logger) self.addTab(self.membersWidget, "Members") self.addTab(self.create_info_table_widget(self), "Info") self.addTab(ConsoleWidget(self, logger), "Log") self.setCurrentIndex(0) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding) def update_dropdown_members(self): self.membersWidget.update_dropdown_members() def create_info_table_widget(self, parent): self.info_table = QTreeView(parent) self.info_table.setSortingEnabled(True) self.info_table.setHeaderHidden(False) self.info_table.setAlternatingRowColors(True) self.info_table.setIndentation(0) self.info_table_model = ExtendedMembersModel(get_peers(), self.logger) proxyModel = QSortFilterProxyModel(self.info_table) proxyModel.setSortCaseSensitivity(Qt.CaseInsensitive) proxyModel.setDynamicSortFilter(True) proxyModel.setSourceModel(self.info_table_model) self.info_table.setModel(proxyModel) get_notification_center().connectPeerAppended(self.info_table_model.externalRowAppended) get_notification_center().connectPeerUpdated(self.info_table_model.externalRowUpdated) get_notification_center().connectPeerRemoved(self.info_table_model.externalRowRemoved) return self.info_table def destroy_widget(self): get_notification_center().disconnectPeerAppended(self.info_table_model.externalRowAppended) get_notification_center().disconnectPeerUpdated(self.info_table_model.externalRowUpdated) get_notification_center().disconnectPeerRemoved(self.info_table_model.externalRowRemoved) self.membersWidget.destroy_widget()
def __init__(self, parent, logger): super(maintainer_gui, self).__init__(parent) self.logger = logger self.info_table = None self.membersWidget = MembersWidget(parent, logger) self.addTab(self.membersWidget, "Members") self.addTab(self.create_info_table_widget(self), "Info") self.addTab(ConsoleWidget(self, logger), "Log") self.setCurrentIndex(0) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.MinimumExpanding)