various fixes for windows
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (ravenlog) (2)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (ravenlog)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
3
.idea/ravenlog.iml
generated
3
.idea/ravenlog.iml
generated
@@ -4,8 +4,9 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv39" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv310" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.9 (ravenlog) (2)" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.10 (ravenlog)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
14
bigtext.py
14
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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
12
main.py
12
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)
|
||||
|
||||
Reference in New Issue
Block a user