Skip to content

Commit 7df3d6c

Browse files
committed
Merge branch '2.9'
2 parents 4f18441 + 494b531 commit 7df3d6c

File tree

8 files changed

+84
-473
lines changed

8 files changed

+84
-473
lines changed

lib/python/qtvcp/widgets/gcode_editor.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,19 @@ def __init__(self, parent=None):
206206

207207
self.set_lexer("g-code")
208208

209+
self._marginWidth = '00000'
210+
209211
# Margin 0 is used for line numbers
210-
self.set_margin_width(1)
212+
self.setMarginWidth(0, self._marginWidth)
211213
self.linesChanged.connect(self.on_lines_changed)
212214
self.setMarginLineNumbers(0, True)
213215

214216
# Clickable margin for showing markers
215217
self.marginClicked.connect(self.on_margin_clicked)
216218
self.setMarginMarkerMask(0, 0b1111)
217219
self.setMarginSensitivity(0, True)
218-
# setting marker margin width to zero make the marker highlight line
219-
self.setMarginWidth(1, 5)
220+
# setting _marker_ margin width
221+
self.setMarginWidth(1, 0)
220222

221223
# Gcode highlight current line
222224
self.currentHandle = self.markerDefine(QsciScintilla.Background,
@@ -286,12 +288,20 @@ def set_font_colors(self):
286288
for i in range(0, self.lexer_num_styles):
287289
self.lexer.setColor(self._styleColor.get(i, self._styleColor[0]), i)
288290

289-
def set_margin_width(self, width):
291+
def set_margin_width(self):
292+
self.setMarginWidth(0, self._marginWidth)
293+
294+
def set_margin_metric(self, width):
290295
fontmetrics = QFontMetrics(self.getFontMargins())
291296
self.setMarginWidth(0, fontmetrics.width("0" * width) + 6)
292297

298+
# reset margin width when number od lines change
293299
def on_lines_changed(self):
294-
self.set_margin_width(len(str(self.lines())))
300+
if len(str(self.lines())) < 3:
301+
self._marginWidth = '0000'
302+
else:
303+
self._marginWidth = str(self.lines())+'0'
304+
self.setMarginWidth(0, self._marginWidth)
295305

296306
def on_margin_clicked(self, nmargin, nline, modifiers):
297307
# Toggle marker for the line the margin was clicked on
@@ -714,6 +724,16 @@ def jump_line(self, jump):
714724
self.setCursorPosition(line, 0)
715725
self.highlight_line(None, line)
716726

727+
# overridden functions #
728+
#####################################
729+
def zoomIn(self):
730+
super().zoomIn()
731+
self.set_margin_width()
732+
def zoomOut(self):
733+
super().zoomOut()
734+
self.set_margin_width()
735+
#####################################
736+
717737
# designer recognized getter/setters
718738
# auto_show_mdi status
719739
def set_auto_show_mdi(self, data):
@@ -1065,8 +1085,8 @@ def jump_line(self, jump):
10651085
def get_line(self):
10661086
return self.editor.getCursorPosition()[0] +1
10671087

1068-
def set_margin_width(self,width):
1069-
self.editor.set_margin_width(width)
1088+
def set_margin_metric(self,width):
1089+
self.editor.set_margin_metric(width)
10701090

10711091
def set_font(self, font):
10721092
self.editor.setDefaultFont(font)

share/qtvcp/screens/qtdragon/argentium.qss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ StatusLabel#lbl_mcodes {
135135
color: #e0e0e0;
136136
}
137137

138+
StatusLabel#status_rpm, Label {
139+
font: 20pt "Lato Heavy";
140+
}
141+
138142
DROLabel {
139143
background: #202020;
140144
border: 1px solid #e0e0e0;

share/qtvcp/screens/qtdragon/qtdragon-bright.qss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ StateLabel {
7474
color: black;
7575
}
7676

77+
StatusLabel#status_rpm, Label {
78+
font: 20pt "Lato Heavy";
79+
}
80+
7781
DROLabel {
7882
background: #202020;
7983
border: 1px solid black;

share/qtvcp/screens/qtdragon/qtdragon.qss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ StatusLabel, StateLabel {
101101
color: white;
102102
}
103103

104+
StatusLabel#status_rpm, Label {
105+
font: 20pt "Lato Heavy";
106+
}
107+
108+
109+
104110
QLineEdit {
105111
background: black;
106112
border: 1px solid gray;
@@ -205,7 +211,7 @@ QProgressBar {
205211
background-color: rgb(250, 250, 250);
206212
border: 1px solid black;
207213
border-radius: 4px;
208-
font: 9 pt "Lato Heavy";
214+
font: 9pt "Lato Heavy";
209215
}
210216

211217
QProgressBar::chunk {
@@ -451,3 +457,4 @@ QTabBar::tab:selected {
451457
QTabBar::tab:!selected {
452458
margin-top: 2px; /* make non-selected tabs look smaller */
453459
}
460+

0 commit comments

Comments
 (0)