Beispiel #1
0
class LogViewHandler(logging.Handler, QWidget):
    def __init__(self, parent):
        logging.Handler.__init__(self)
        QWidget.__init__(self, parent)

        self.ui = Ui_LogViewTab()
        self.ui.setupUi(self)
        self.model = LogModel()
        self.filter_model = FilteredLogModel()
        self.filter_model.setSourceModel(self.model)
        self.ui.logView.setModel(self.filter_model)
        self.ui.filterSlider.valueChanged.connect(self.setFilter)
        self.ui.filterSlider.setValue(3)

        self.parent().addClearAction()
        self.parent().clearRequested.connect(self.model.clear)

    def emit(self, record):
        self.model.insertMessage(record)
        self.updateView()

    def updateView(self):
        self.ui.logView.resizeColumnsToContents()
        if self.ui.logView.columnWidth(2) > 500:
            self.ui.logView.setColumnWidth(2, 500)
        self.ui.logView.scrollToBottom()

    def setFilter(self, value):
        self.filter_model.setMinimum(value * 10)
        self.updateView()
Beispiel #2
0
    def __init__(self, parent):
        logging.Handler.__init__(self)
        QWidget.__init__(self, parent)

        self.ui = Ui_LogViewTab()
        self.ui.setupUi(self)
        self.model = LogModel()
        self.filter_model = FilteredLogModel()
        self.filter_model.setSourceModel(self.model)
        self.ui.logView.setModel(self.filter_model)
        self.ui.filterSlider.valueChanged.connect(self.setFilter)
        self.ui.filterSlider.setValue(3)

        self.parent().addClearAction()
        self.parent().clearRequested.connect(self.model.clear)
Beispiel #3
0
 def __init__(self, target_widget, filter_slider):
     logging.Handler.__init__(self)
     self.target_widget = target_widget
     self.model = LogModel()
     self.filter_model = FilteredLogModel()
     self.filter_model.setSourceModel(self.model)
     target_widget.setModel(self.filter_model)
     self.target_widget = target_widget
     QObject.connect(filter_slider, SIGNAL("valueChanged(int)"), self.setFilter)
Beispiel #4
0
 def __init__(self, target_widget, filter_slider):
     logging.Handler.__init__(self)
     self.target_widget = target_widget
     self.model = LogModel()
     self.filter_model = FilteredLogModel()
     self.filter_model.setSourceModel(self.model)
     target_widget.setModel(self.filter_model)
     self.target_widget = target_widget
     filter_slider.valueChanged.connect(self.setFilter)
Beispiel #5
0
class LogViewHandler(logging.Handler):
    def __init__(self, target_widget, filter_slider):
        logging.Handler.__init__(self)
        self.target_widget = target_widget
        self.model = LogModel()
        self.filter_model = FilteredLogModel()
        self.filter_model.setSourceModel(self.model)
        target_widget.setModel(self.filter_model)
        self.target_widget = target_widget
        QObject.connect(filter_slider, SIGNAL("valueChanged(int)"), self.setFilter)

    def emit(self, record):
        self.model.insertMessage(record)
        self.updateView()

    def updateView(self):
        self.target_widget.resizeColumnsToContents()
        if self.target_widget.columnWidth(2) > 500:
            self.target_widget.setColumnWidth(2, 500)
        self.target_widget.scrollToBottom()

    def setFilter(self, value):
        self.filter_model.setMinimum(value * 10)
        self.updateView()