- GCode view now has line numbers

- solved a bug that made selection of objects on canvas impossible if there is an object of type FlatCAMScript or FlatCAMDocument opened
This commit is contained in:
Marius Stanciu
2019-11-22 16:31:40 +02:00
parent 0aff3a6d4c
commit 9fd98b4573
8 changed files with 127 additions and 97 deletions

View File

@@ -2382,11 +2382,9 @@ class FCTextAreaLineNumber(QtWidgets.QFrame):
FCPlainTextAreaExtended.__init__(self, *args)
#self.setFrameStyle(QFrame.NoFrame)
self.setFrameStyle(QtWidgets.QFrame.NoFrame)
self.highlight()
#self.setLineWrapMode(QPlainTextEdit.NoWrap)
self.cursorPositionChanged.connect(self.highlight)
def highlight(self):
@@ -2405,6 +2403,7 @@ class FCTextAreaLineNumber(QtWidgets.QFrame):
block = self.firstVisibleBlock()
line_count = block.blockNumber()
painter = QtGui.QPainter(number_bar)
painter.fillRect(event.rect(), self.palette().base())
@@ -2421,16 +2420,18 @@ class FCTextAreaLineNumber(QtWidgets.QFrame):
# We want the line number for the selected line to be bold.
if line_count == current_line:
font = painter.font()
font.setBold(True)
# font.setBold(True)
painter.setPen(QtCore.Qt.blue)
painter.setFont(font)
else:
font = painter.font()
font.setBold(False)
# font.setBold(False)
painter.setPen(QtCore.Qt.lightGray)
painter.setFont(font)
# Draw the line number right justified at the position of the line.
paint_rect = QtCore.QRect(0, block_top, number_bar.width(), font_metrics.height())
painter.drawText(paint_rect, Qt.AlignRight, str(line_count))
painter.drawText(paint_rect, Qt.AlignRight, ' ' + str(line_count) + ' ')
block = block.next()