diff --git a/src/ui/bigtext/bigtext.py b/src/ui/bigtext/bigtext.py index 9b0bea0..04697df 100644 --- a/src/ui/bigtext/bigtext.py +++ b/src/ui/bigtext/bigtext.py @@ -39,7 +39,7 @@ class FileObserver(FileSystemEventHandler): # block the UI thread and make the UI unresponsive. # Note: we don't miss events, because they are queued and de-duplicated time.sleep(0.5) - self.big_text.update() + self.big_text.trigger_update.emit() class FileWatchdogThread(QRunnable): @@ -60,6 +60,7 @@ class FileWatchdogThread(QRunnable): class BigText(QWidget): + trigger_update = Signal() def __init__(self, model: LogFileModel): super(BigText, self).__init__() @@ -68,6 +69,7 @@ class BigText(QWidget): self.watchdog = FileWatchdogThread(self, model.get_file()) QThreadPool.globalInstance().start(self.watchdog) + self.trigger_update.connect(self.update) self.grid = QGridLayout() self.grid.setContentsMargins(0, 0, 0, 0) @@ -371,7 +373,7 @@ class InnerBigText(QWidget): self.update() def paintEvent(self, event: QPaintEvent) -> None: - # print("paintEvent") + # print("paintEvent %s" % (self.model.get_file())) painter = QPainter(self) # painter.setFont(self.model.settings.font()) # Courier New, DejaVu Sans Mono, Monospace, Liberation Mono, Noto Mono, Nimbus Mono L, Tlwg Mono, Ubuntu Mono, FreeMono, Mitra Mono @@ -380,8 +382,6 @@ class InnerBigText(QWidget): painter.setPen(QColor(0, 0, 0)) self.update_font_metrics(painter) - tab_string = " " * constants.tab_width - lines_to_show = self.lines_shown() # print("%s / %s = %s" %(self.height(), float(self.char_height), lines_to_show))