diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..115f7fd
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..cf9ffff
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/ravenlog.iml b/.idea/ravenlog.iml
new file mode 100644
index 0000000..59bbe69
--- /dev/null
+++ b/.idea/ravenlog.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bigtext.py b/bigtext.py
index b696f57..7c79339 100644
--- a/bigtext.py
+++ b/bigtext.py
@@ -1,3 +1,5 @@
+import math
+
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
@@ -16,7 +18,7 @@ class BigText(QWidget):
def __init__(self, model: LogFileModel):
super(BigText, self).__init__()
self.model = model
- self.font = QFont("monospace", 12)
+ self.font = QFont("monospace", 20)
self.update_font_metrics(QPainter(self))
self.lines = []
@@ -35,14 +37,14 @@ class BigText(QWidget):
if self._selection_end_byte != current_byte:
self._selection_end_byte = current_byte
self.update()
- print("-> %s,%s" %(self._selection_start_byte, self._selection_end_byte))
+ #print("-> %s,%s" %(self._selection_start_byte, self._selection_end_byte))
def to_byte_offset(self, e: QMouseEvent) -> int:
line_number = int(e.pos().y() / self.char_height)
if line_number < len(self.lines):
line = self.lines[line_number]
- char_in_line = int(e.pos().x() / self.char_width) + self._left_offset
+ char_in_line = round(e.pos().x() / self.char_width) + self._left_offset
char_in_line = min(char_in_line, line.length())
#print("%s in line %s" % (char_in_line, line_number))
@@ -57,17 +59,22 @@ class BigText(QWidget):
painter.begin(self)
painter.setFont(self.font)
painter.setPen(QColor(0, 0, 0))
- self.update_font_metrics( painter)
+ self.update_font_metrics(painter)
lines_to_show = self.height() / (self.fontMetrics().height())
self.lines = self.model.data(self._byte_offset, lines_to_show)
+ # draw hightlights first - some characters may overlap to the next line
+ # by drawing the background hightlights first we prevent that the hightlight
+ # draws over a character
y_line_offset = self.char_height;
for l in self.lines:
-
if l.intersects(self._selection_start_byte, self._selection_end_byte):
self.draw_selection(painter, l, y_line_offset)
+ y_line_offset = y_line_offset + self.char_height
+ y_line_offset = self.char_height;
+ for l in self.lines:
painter.drawText(0, y_line_offset, l.line())
y_line_offset = y_line_offset + self.char_height
@@ -75,18 +82,19 @@ class BigText(QWidget):
def draw_selection(self, painter: QPainter, line: Line, y_line_offset: int):
hightlight_color = QColor(255, 255, 0)
+
if line.includes_byte(self._selection_start_byte):
- #print("%s bytes in line: " % (self._selection_start_byte - line.byte_offset()))
x1 = (self._selection_start_byte - line.byte_offset() - self._left_offset) * self.char_width
else:
x1 = 0
if line.includes_byte(self._selection_end_byte):
width = (self._selection_end_byte - line.byte_offset() - self._left_offset) * self.char_width - x1
+ #print("char in line: %d -> width: %d" % (self._selection_end_byte - line.byte_offset() - self._left_offset, width))
else:
width = len(line.line().rstrip()) * self.char_width -x1
- y1 = y_line_offset- self.char_height
+ y1 = y_line_offset- self.char_height + self.char_height / 7
height = self.char_height
rect = QRect(x1,y1,width,height)
#print(rect)
@@ -96,9 +104,8 @@ class BigText(QWidget):
old_brush = painter.brush()
old_pen = painter.pen()
painter.setBrush(color)
- painter.setPen(color)
+ painter.setPen(Qt.PenStyle.NoPen)
painter.drawRoundedRect(rect, 3.0, 3.0)
- #painter.drawRect(rect)
painter.setBrush(old_brush)
painter.setPen(old_pen)
@@ -106,4 +113,7 @@ class BigText(QWidget):
fm: QFontMetrics = painter.fontMetrics()
self.char_height = fm.height()
self.char_width = fm.averageCharWidth()# all chars have same with for monospace font
- print("font width=%s height=%s" % (self.char_width, self.char_height))
\ No newline at end of file
+ text = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
+ self.char_width = fm.horizontalAdvance(text)/float(len(text))
+ #print("bounding rect: %s"%(boundingRect))
+ #print("font width=%s height=%s" % (self.char_width, self.char_height))
\ No newline at end of file
diff --git a/example.log b/example.log
index 07eaafe..43f29b3 100644
--- a/example.log
+++ b/example.log
@@ -3,3 +3,111 @@
0123456789012345678901234567890123456789
01234567890123456789
0123456789012345678901234567890123456789
+01234567890123456789
+0123456789012345678901234567890123456789
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+...............................|
+ |
+äääääääääääääääääääääääääääääää|
+2018-09-06T00:00:16.381Z,0,vapfacbk01,HealthCheckService.isOperable,AXC_5.14_526,,successful
+2018-09-06T00:00:18.096Z,0,vapfacbk01,HealthCheckService.isOperable,AXC_5.14_526,,successful
+2018-09-06T00:00:27.114Z,64,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.115Z,66,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.130Z,11,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.131Z,12,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.133Z,2,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.182Z,9,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.183Z,10,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.185Z,2,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.256Z,15,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.257Z,16,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.259Z,2,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.295Z,49,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.307Z,61,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.309Z,9,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.310Z,11,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.312Z,1,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.317Z,6,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.318Z,7,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.354Z,8,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.355Z,9,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.357Z,2,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.402Z,7,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.402Z,9,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.404Z,2,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.447Z,8,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.448Z,9,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.450Z,2,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.495Z,9,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.496Z,10,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.498Z,2,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.543Z,8,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.544Z,10,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.545Z,1,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.591Z,8,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.591Z,8,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.593Z,1,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.637Z,9,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.637Z,9,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.639Z,1,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.683Z,8,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.683Z,8,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.685Z,1,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.728Z,9,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.729Z,10,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.730Z,1,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:27.774Z,8,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:27.775Z,9,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:27.777Z,2,vapfacbk01,ApplicationLockService.isLocked,AXC_5.14_526,,successful
+2018-09-06T00:00:30.317Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.319Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.353Z,1,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.355Z,1,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.394Z,1,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.397Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.439Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.441Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.450Z,5,vapfacbk01,ViewService.getFieldViews,AXC_5.14_526,,successful
+2018-09-06T00:00:30.485Z,35,vapfacbk01,ViewService.getFieldViews,AXC_5.14_526,,successful
+2018-09-06T00:00:30.502Z,1,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.504Z,1,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.550Z,1,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.552Z,1,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.596Z,1,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.598Z,1,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.640Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.642Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.682Z,1,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.684Z,1,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.721Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.723Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.750Z,5,vapfacbk01,ViewService.getFieldViews,AXC_5.14_526,,successful
+2018-09-06T00:00:30.761Z,11,vapfacbk01,ViewService.getFieldViews,AXC_5.14_526,,successful
+2018-09-06T00:00:30.764Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.766Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.806Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.808Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.864Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.866Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.906Z,7,vapfacbk01,MatterApplicationService.search,AXC_5.14_526,,successful
+2018-09-06T00:00:30.908Z,9,vapfacbk01,CollectionService.getApplications,AXC_5.14_526,,successful
+2018-09-06T00:00:30.933Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.935Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:30.974Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:30.976Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:31.032Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:31.034Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:31.078Z,1,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:31.081Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:31.113Z,1,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:31.115Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:31.147Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:31.149Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:31.180Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:31.182Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:31.222Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:31.224Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:31.266Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:31.268Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
+2018-09-06T00:00:31.309Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
+2018-09-06T00:00:31.311Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
\ No newline at end of file
diff --git a/line.py b/line.py
index 9492f23..c931dd4 100644
--- a/line.py
+++ b/line.py
@@ -22,4 +22,13 @@ class Line:
def intersects(self, start_byte: int, end_byte: int):
result = start_byte < self._byte_end and end_byte > self._byte_offset
#print("%d,%d in %d,%d" % (start_byte, end_byte, self._byte_offset, self._byte_end))
- return result
\ No newline at end of file
+ return result
+
+ def prefix(self, index: int) -> str:
+ return self._line[0:index]
+
+ def substr(self, offset: int, length: int) -> str:
+ return self._line[offset:offset+length]
+
+ def suffix(self, index: int) -> str:
+ return self._line[index:]
\ No newline at end of file