various fixes for windows
This commit is contained in:
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):
|
||||
|
||||
Reference in New Issue
Block a user