diff --git a/.idea/misc.xml b/.idea/misc.xml index 115f7fd..dd09d79 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/ravenlog.iml b/.idea/ravenlog.iml index 59bbe69..a3cf086 100644 --- a/.idea/ravenlog.iml +++ b/.idea/ravenlog.iml @@ -4,8 +4,9 @@ + - + \ No newline at end of file diff --git a/bigtext.py b/bigtext.py index 79276d3..57ea5f3 100644 --- a/bigtext.py +++ b/bigtext.py @@ -58,6 +58,7 @@ class FileWatchdogThread(QRunnable): def destruct(self): self.observer.stop() + #self.observer.join(1) class BigText(QWidget): @@ -97,6 +98,7 @@ class BigText(QWidget): def destruct(self): self.watchdog.destruct() + pass class InnerBigText(QWidget): @@ -261,7 +263,7 @@ class InnerBigText(QWidget): if self.longest_line < length: self.longest_line = length maximum = max(0, length - width_in_chars + 1) - self.parent.h_scroll_bar.setMaximum(maximum) + self.parent.h_scroll_bar.setMaximum(round(maximum)) def y_pos_to_line(self, y: int) -> int: return int(y / self.char_height) @@ -345,7 +347,9 @@ class InnerBigText(QWidget): # print("paintEvent") painter = QPainter(self) # painter.setFont(self.model.settings.font()) - painter.setFont(QFont("monospace", self.model.settings.getint_session('general', "font_size"))) + #print("%s" % QFontDatabase.families()) + # Courier New, DejaVu Sans Mono + painter.setFont(QFont("Courier New", self.model.settings.getint_session('general', "font_size"))) painter.setPen(QColor(0, 0, 0)) self.update_font_metrics(painter) @@ -382,7 +386,7 @@ class InnerBigText(QWidget): self.draw_highlights(highlight_ranges, painter, y_line_offset) y_line_offset = y_line_offset + self.char_height - left_offset = -1 * self._left_offset * self.char_width + left_offset = int(-1 * self._left_offset * self.char_width) y_line_offset = self.char_height; for l in self.lines: painter.drawText(left_offset, y_line_offset, l.line()) @@ -398,7 +402,7 @@ class InnerBigText(QWidget): y1 = y_line_offset - self.char_height + self.char_height / 7 height = self.char_height full_width = Settings.max_line_length() * self.char_width - rect = QRect(left_offset, y1, full_width, height) + rect = QRect(round(left_offset), round(y1), round(full_width), round(height)) self.highlight_background(painter, rect, highlight.get_brush_full_line()) for highlight in highlights: @@ -408,7 +412,7 @@ class InnerBigText(QWidget): y1 = y_line_offset - self.char_height + self.char_height / 7 height = self.char_height - rect = QRect(left_offset + x1, y1, width, height) + rect = QRect(round(left_offset + x1), round(y1), round(width), round(height)) self.highlight_background(painter, rect, highlight.get_brush()) def highlight_background(self, painter: QPainter, rect: QRect, brush: QBrush): diff --git a/filterwidget.py b/filterwidget.py index 5d013c0..3df21c3 100644 --- a/filterwidget.py +++ b/filterwidget.py @@ -104,7 +104,8 @@ class FilterWidget(QWidget): filter_bar.layout.addWidget(self.ignore_case) filter_bar.layout.addWidget(self.is_regex) - (_handle, self.tmpfilename) = tempfile.mkstemp() + (handle, self.tmpfilename) = tempfile.mkstemp() + os.close(handle) self.filter_model = LogFileModel(self.tmpfilename, self.source_model.settings) self.hits_view = BigText(self.filter_model) diff --git a/highlightingdialog.py b/highlightingdialog.py index 2f06b55..e151d6e 100644 --- a/highlightingdialog.py +++ b/highlightingdialog.py @@ -89,7 +89,6 @@ class HighlightingDialog(QDialog): self._load_existing_hightlighters() self.list.setCurrentItem(None) self._selection_changed() - self.list.currentItemChanged.connect(self._item_changed) self.list.itemSelectionChanged.connect(self._selection_changed) def _add(self): diff --git a/main.py b/main.py index 3f4b06e..95e9ac5 100644 --- a/main.py +++ b/main.py @@ -61,7 +61,8 @@ class MainWindow(QMainWindow): open_file.setShortcut('Ctrl+O') open_file.triggered.connect(self._open_file_dialog) - close_action = QAction(QIcon.fromTheme("exit"), self.tr("E&xit", "menu item to close the application"), self) + # Linux: QIcon.fromTheme("exit") + close_action = QAction(QIcon.fromTheme("close"), self.tr("E&xit", "menu item to close the application"), self) close_action.setShortcut('Ctrl+X') close_action.triggered.connect(self.destruct) @@ -206,10 +207,11 @@ if __name__ == "__main__": window = MainWindow() RavenUI.window = window window.show() - window.open_file("/home/andi/ws/performanceDb/data/production/logs_2018-09-06_2018-09-06.csv") - window.open_file("/home/andi/ws/performanceDb/data/production/vapbdcom.csv") - window.open_file("/var/log/syslog") - window.open_file("/home/andi/ws/ravenlog/example.log") + #window.open_file("/home/andi/ws/performanceDb/data/production/logs_2018-09-06_2018-09-06.csv") + #window.open_file("/home/andi/ws/performanceDb/data/production/vapbdcom.csv") + #window.open_file("/var/log/syslog") + #window.open_file("/home/andi/ws/ravenlog/example.log") + window.open_file("C:\\Users\\andi\\ws\\some.log") signal.signal(signal.SIGINT, stop_signal) signal.signal(signal.SIGTERM, stop_signal)