def onSwitchPerspective(self, perspective): self.stop_logging() if perspective == "Remote": if hasattr(self, 'hostName') and hasattr(self, 'port'): host, port = self.hostName, self.port else: isValid = False dft = "%s:%d" % (socket.gethostname(), logging.handlers.DEFAULT_TCP_LOGGING_PORT) while not isValid: txt, res = Qt.QInputDialog.getText( self, "Please input remote logging host and port", "Location (<host>:<port>):", Qt.QLineEdit.Normal, dft) if not res: return try: host, port = str(txt).split(":", 1) port = int(port) isValid = True except: Qt.QMessageBox.information( self, "Invalid name", "Please type a valid <host>:<port>") ret = QBaseTableWidget.onSwitchPerspective(self, perspective) qmodel = self.getQModel() qmodel.connect_logging(host=host, port=port) else: ret = QBaseTableWidget.onSwitchPerspective(self, perspective) return ret
def onSwitchPerspective(self, perspective): self.stop_logging() if perspective == "Remote": if hasattr(self, 'hostName') and hasattr(self, 'port'): host, port = self.hostName, self.port else: isValid = False dft = "%s:%d" % (socket.gethostname(), logging.handlers.DEFAULT_TCP_LOGGING_PORT) while not isValid: txt, res = Qt.QInputDialog.getText(self, "Please input remote logging host and port", "Location (<host>:<port>):", Qt.QLineEdit.Normal, dft) if not res: return try: host, port = str(txt).split(":", 1) port = int(port) isValid = True except: Qt.QMessageBox.information(self, "Invalid name", "Please type a valid <host>:<port>") ret = QBaseTableWidget.onSwitchPerspective(self, perspective) qmodel = self.getQModel() qmodel.connect_logging(host=host, port=port) else: ret = QBaseTableWidget.onSwitchPerspective(self, perspective) return ret
def __init__(self, parent=None, designMode=False, with_filter_widget=LoggingToolBar, with_selection_widget=True, with_refresh_widget=True, perspective=None, proxy=None): QBaseTableWidget.__init__(self, parent=parent, designMode=designMode, with_filter_widget=with_filter_widget, with_selection_widget=False, with_refresh_widget=False, perspective=perspective, proxy=proxy)
def onFilterChanged(self, filter): if not self.usesProxyQModel(): return proxy_model = self.getQModel() level = self.getFilterBar().getLogLevel() proxy_model.setFilterLogLevel(level) return QBaseTableWidget.onFilterChanged(self, filter)
def createViewWidget(self, klass=None): if klass is None: klass = QLoggingTable view = QBaseTableWidget.createViewWidget(self, klass=klass) hh = view.horizontalHeader() hh.setResizeMode(MSG, Qt.QHeaderView.Stretch) view.setShowGrid(False) view.sortByColumn(TIME, Qt.Qt.AscendingOrder) return view
def destroy(self, destroyWindow=True, destroySubWindows=True): self.stop_logging() return QBaseTableWidget.destroy(self, destroyWindow, destroySubWindows)
def createToolArea(self): tb = QBaseTableWidget.createToolArea(self) filterBar = self.getFilterBar() Qt.QObject.connect(filterBar, Qt.SIGNAL("scrollLockToggled(bool)"), self.onScrollLockToggled) return tb
def createToolArea(self): tb = QBaseTableWidget.createToolArea(self) filterBar = self.getFilterBar() filterBar.scrollLockToggled.connect(self.onScrollLockToggled) return tb