Skip to content

Commit 28ebfcd

Browse files
committed
styling adjustments for Linux
1 parent fc0c92b commit 28ebfcd

7 files changed

Lines changed: 241 additions & 119 deletions

File tree

src/artisanlib/button_style.py

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@
120120
# params:
121121
# min_width
122122
# font_size
123+
# border_radius
123124
artisan_simulator_push_button_style_dict: dict[str, str] = {
124125
'OFF': """
125126
QPushButton {{
126127
min-width: {min_width}px;
127-
border-style:solid;
128-
border-radius:20px;
129-
border-color:grey;
130-
border-width:0;
128+
border-style: solid;
129+
border-radius:{ border_radius}px;
130+
border-color: grey;
131+
border-width: 0;
131132
font-size: {font_size}px;
132133
font-weight: bold;
133134
color: #147bb3;
@@ -149,10 +150,10 @@
149150
'ON': """
150151
QPushButton {{
151152
min-width: {min_width}px;
152-
border-style:solid;
153-
border-radius:20px;
154-
border-color:grey;
155-
border-width:0;
153+
border-style: solid;
154+
border-radius: {border_radius}px;
155+
border-color: grey;
156+
border-width: 0;
156157
font-size: {font_size}px;
157158
font-weight: bold;
158159
color: #cc0f50;
@@ -174,10 +175,10 @@
174175
'STOP': """
175176
QPushButton {{
176177
min-width: {min_width}px;
177-
border-style:solid;
178-
border-radius:20px;
179-
border-color:grey;
180-
border-width:0;
178+
border-style: solid;
179+
border-radius: {border_radius}px;
180+
border-color: grey;
181+
border-width: 0;
181182
font-size: {font_size}px;
182183
font-weight: bold;
183184
color: #147bb3;
@@ -199,10 +200,10 @@
199200
'START': """
200201
QPushButton {{
201202
min-width: {min_width}px;
202-
border-style:solid;
203-
border-radius:20px;
204-
border-color:grey;
205-
border-width:0;
203+
border-style: solid;
204+
border-radius: {border_radius}px;
205+
border-color: grey;
206+
border-width: 0;
206207
font-size: {font_size}px;
207208
font-weight: bold;
208209
color: yellow;
@@ -226,14 +227,15 @@
226227
# params:
227228
# min_width
228229
# font_size
230+
# border_radius
229231
artisan_push_button_style_dict: dict[str, str] = {
230232
'RESET': """
231233
QPushButton {{
232234
min-width: {min_width}px;
233-
border-style:solid;
234-
border-radius:20px;
235-
border-color:grey;
236-
border-width:0;
235+
border-style: solid;
236+
border-radius: {border_radius}px;
237+
border-color: grey;
238+
border-width: 0;
237239
font-size: {font_size}px;
238240
font-weight: bold;
239241
color: white;
@@ -256,7 +258,7 @@
256258
QPushButton {{
257259
min-width: {min_width}px;
258260
border-style:solid;
259-
border-radius:20px;
261+
border-radius: {border_radius}px;
260262
border-color:grey;
261263
border-width:0;
262264
font-size: {font_size}px;
@@ -281,7 +283,7 @@
281283
QPushButton {{
282284
min-width: {min_width}px;
283285
border-style:solid;
284-
border-radius:20px;
286+
border-radius: {border_radius}px;
285287
border-color:grey;
286288
border-width:0;
287289
font-size: {font_size}px;
@@ -306,7 +308,7 @@
306308
QPushButton {{
307309
min-width: {min_width}px;
308310
border-style:solid;
309-
border-radius:20px;
311+
border-radius: {border_radius}px;
310312
border-color:grey;
311313
border-width:0;
312314
font-size: {font_size}px;
@@ -331,7 +333,7 @@
331333
QPushButton {{
332334
min-width: {min_width}px;
333335
border-style:solid;
334-
border-radius:20px;
336+
border-radius: {border_radius}px;
335337
border-color:grey;
336338
border-width:0;
337339
font-size: {font_size}px;
@@ -356,7 +358,7 @@
356358
QPushButton {{
357359
min-width: {min_width}px;
358360
border-style:solid;
359-
border-radius:20px;
361+
border-radius: {border_radius}px;
360362
border-color:grey;
361363
border-width:0;
362364
font-size: {font_size}px;
@@ -381,7 +383,7 @@
381383
QPushButton {{
382384
min-width: {min_width}px;
383385
border-style:solid;
384-
border-radius:20px;
386+
border-radius: {border_radius}px;
385387
border-color:grey;
386388
border-width:0;
387389
font-size: {font_size}px;
@@ -407,16 +409,17 @@
407409
# params:
408410
# min_width
409411
# font_size
412+
# border_radius
410413
artisan_sv_plus_push_button_style: str = """
411414
QPushButton {{
412415
min-width: {min_width}px;
413416
border-style:solid;
414-
border-radius:20px;
417+
border-radius:{border_radius}px;
415418
border-color:grey;
416419
border-width:0;
417-
font-size: {font_size}px;
418-
font-weight: bold;
419-
color: white;
420+
font-size:{font_size}px;
421+
font-weight:bold;
422+
color:white;
420423
background-color: """ + createGradient('#db5785') + """;
421424
}}
422425
QPushButton:pressed {{
@@ -432,24 +435,25 @@
432435
# params:
433436
# min_width
434437
# font_size
438+
# border_radius
435439
artisan_sv_minus_push_button_style: str = """
436440
QPushButton {{
437-
min-width: {min_width}px;
441+
min-width:{min_width}px;
438442
border-style:solid;
439-
border-radius:20px;
443+
border-radius:{border_radius}px;
440444
border-color:grey;
441445
border-width:0;
442-
font-size: {font_size}px;
443-
font-weight: bold;
446+
font-size:{font_size}px;
447+
font-weight:bold;
444448
color: white;
445449
background-color: """ + createGradient('#64b7d8') + """;
446450
}}
447451
QPushButton:pressed {{
448-
color: #EEEEEE;
452+
color:#EEEEEE;
449453
background-color: """ + createGradient('#43a7cf') + """;
450454
}}
451455
QPushButton:hover:!pressed {{
452-
color: white;
456+
color:white;
453457
background-color: """ + createGradient('#85cae1') + """;
454458
}}
455459
"""

src/artisanlib/canvas.py

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7816,14 +7816,26 @@ def reset(self,redraw:bool = True, soundOn:bool = True, keepProperties:bool = Fa
78167816
self.aw.buttonCOOL.setFlat(False)
78177817
self.aw.buttonONOFF.setText(QApplication.translate('Button', 'ON'))
78187818
if self.aw.simulator:
7819-
self.aw.buttonONOFF.setStyleSheet(artisan_simulator_push_button_style_dict['OFF'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
7819+
self.aw.buttonONOFF.setStyleSheet(artisan_simulator_push_button_style_dict['OFF'].format(
7820+
min_width=self.aw.main_button_min_width,
7821+
font_size=self.aw.button_font_size,
7822+
border_radius=self.aw.button_border_radius))
78207823
else:
7821-
self.aw.buttonONOFF.setStyleSheet(artisan_push_button_style_dict['OFF'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
7824+
self.aw.buttonONOFF.setStyleSheet(artisan_push_button_style_dict['OFF'].format(
7825+
min_width=self.aw.main_button_min_width,
7826+
font_size=self.aw.button_font_size,
7827+
border_radius=self.aw.button_border_radius))
78227828
self.aw.buttonSTARTSTOP.setText(QApplication.translate('Button', 'START'))
78237829
if self.aw.simulator:
7824-
self.aw.buttonSTARTSTOP.setStyleSheet(artisan_simulator_push_button_style_dict['STOP'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
7830+
self.aw.buttonSTARTSTOP.setStyleSheet(artisan_simulator_push_button_style_dict['STOP'].format(
7831+
min_width=self.aw.main_button_min_width,
7832+
font_size=self.aw.button_font_size,
7833+
border_radius=self.aw.button_border_radius))
78257834
else:
7826-
self.aw.buttonSTARTSTOP.setStyleSheet(artisan_push_button_style_dict['STOP'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
7835+
self.aw.buttonSTARTSTOP.setStyleSheet(artisan_push_button_style_dict['STOP'].format(
7836+
min_width=self.aw.main_button_min_width,
7837+
font_size=self.aw.button_font_size,
7838+
border_radius=self.aw.button_border_radius))
78277839

78287840
# quantification is blocked if lock_quantification_sampling_ticks is not 0
78297841
# (eg. after a change of the event value by button or slider actions)
@@ -13106,9 +13118,15 @@ def OnMonitor(self) -> None:
1310613118
_log.exception(e)
1310713119

1310813120
if self.aw.simulator:
13109-
self.aw.buttonONOFF.setStyleSheet(artisan_simulator_push_button_style_dict['ON'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
13121+
self.aw.buttonONOFF.setStyleSheet(artisan_simulator_push_button_style_dict['ON'].format(
13122+
min_width=self.aw.main_button_min_width,
13123+
font_size=self.aw.button_font_size,
13124+
border_radius=self.aw.button_border_radius))
1311013125
else:
13111-
self.aw.buttonONOFF.setStyleSheet(artisan_push_button_style_dict['ON'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
13126+
self.aw.buttonONOFF.setStyleSheet(artisan_push_button_style_dict['ON'].format(
13127+
min_width=self.aw.main_button_min_width,
13128+
font_size=self.aw.button_font_size,
13129+
border_radius=self.aw.button_border_radius))
1311213130

1311313131
self.aw.buttonONOFF.setText(QApplication.translate('Button', 'OFF')) # text means click to turn OFF (it is ON)
1311413132
self.aw.buttonONOFF.setToolTip(QApplication.translate('Tooltip', 'Stop monitoring'))
@@ -13266,7 +13284,10 @@ def OffMonitorCloseDown(self, respectAlwaysON:bool, wasRecording:bool) -> None:
1326613284
self.palette['canvas'] = self.palette['canvas_alt']
1326713285
self.aw.updateCanvasColors(checkColors=False)
1326813286
#enable RESET button:
13269-
self.aw.buttonRESET.setStyleSheet(artisan_push_button_style_dict['RESET'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
13287+
self.aw.buttonRESET.setStyleSheet(artisan_push_button_style_dict['RESET'].format(
13288+
min_width=self.aw.main_button_min_width,
13289+
font_size=self.aw.button_font_size,
13290+
border_radius=self.aw.button_border_radius))
1327013291
self.aw.buttonRESET.setEnabled(True)
1327113292
self.aw.buttonRESET.setVisible(True)
1327213293

@@ -13281,9 +13302,15 @@ def OffMonitorCloseDown(self, respectAlwaysON:bool, wasRecording:bool) -> None:
1328113302
_log.exception(e)
1328213303

1328313304
if self.aw.simulator:
13284-
self.aw.buttonONOFF.setStyleSheet(artisan_simulator_push_button_style_dict['OFF'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
13305+
self.aw.buttonONOFF.setStyleSheet(artisan_simulator_push_button_style_dict['OFF'].format(
13306+
min_width=self.aw.main_button_min_width,
13307+
font_size=self.aw.button_font_size,
13308+
border_radius=self.aw.button_border_radius))
1328513309
else:
13286-
self.aw.buttonONOFF.setStyleSheet(artisan_push_button_style_dict['OFF'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
13310+
self.aw.buttonONOFF.setStyleSheet(artisan_push_button_style_dict['OFF'].format(
13311+
min_width=self.aw.main_button_min_width,
13312+
font_size=self.aw.button_font_size,
13313+
border_radius=self.aw.button_border_radius))
1328713314
self.aw.buttonONOFF.setToolTip(QApplication.translate('Tooltip', 'Start monitoring'))
1328813315
self.aw.sendmessage(QApplication.translate('Message','Scope stopped'))
1328913316
self.aw.buttonONOFF.setText(QApplication.translate('Button', 'ON')) # text means click to turn OFF (it is ON)
@@ -13994,14 +14021,23 @@ def OffRecorder(self, autosave:bool = True, enableButton:bool = True) -> None:
1399414021
self.aw.resetCurveVisibilities()
1399514022
self.flagstart = False
1399614023
if self.aw.simulator:
13997-
self.aw.buttonSTARTSTOP.setStyleSheet(artisan_simulator_push_button_style_dict['STOP'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
14024+
self.aw.buttonSTARTSTOP.setStyleSheet(artisan_simulator_push_button_style_dict['STOP'].format(
14025+
min_width=self.aw.main_button_min_width,
14026+
font_size=self.aw.button_font_size,
14027+
border_radius=self.aw.button_border_radius))
1399814028
else:
13999-
self.aw.buttonSTARTSTOP.setStyleSheet(artisan_push_button_style_dict['STOP'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
14029+
self.aw.buttonSTARTSTOP.setStyleSheet(artisan_push_button_style_dict['STOP'].format(
14030+
min_width=self.aw.main_button_min_width,
14031+
font_size=self.aw.button_font_size,
14032+
border_radius=self.aw.button_border_radius))
1400014033
if enableButton:
1400114034
self.aw.buttonSTARTSTOP.setEnabled(True)
1400214035
self.aw.buttonSTARTSTOP.setGraphicsEffect(self.aw.makeShadow())
1400314036
#enable RESET button:
14004-
self.aw.buttonRESET.setStyleSheet(artisan_push_button_style_dict['RESET'].format(min_width=self.aw.main_button_min_width, font_size=self.aw.button_font_size))
14037+
self.aw.buttonRESET.setStyleSheet(artisan_push_button_style_dict['RESET'].format(
14038+
min_width=self.aw.main_button_min_width,
14039+
font_size=self.aw.button_font_size,
14040+
border_radius=self.aw.button_border_radius))
1400514041
self.aw.buttonRESET.setEnabled(True)
1400614042
self.updateLCDtime()
1400714043
#prevents accidentally deleting a modified profile:

src/artisanlib/curves.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,17 +1604,17 @@ def renameBT(self) -> None:
16041604
if self.aw.BTname == '':
16051605
self.aw.BTname = QApplication.translate('Label', 'BT')
16061606
BTname_subst = self.aw.qmc.device_name_subst(self.aw.BTname)
1607-
self.aw.label3.setText(f'<big><b>{BTname_subst}</b></big>')
1608-
self.aw.label5.setText(f'{deltaLabelBigPrefix}{BTname_subst}</b></big>')
1607+
self.aw.label3.setText(self.aw.lcd_label_fmt.format(BTname_subst))
1608+
self.aw.label5.setText(f'{deltaLabelBigPrefix}{self.aw.lcd_label_fmt.format(BTname_subst)}')
16091609

16101610
@pyqtSlot()
16111611
def renameET(self) -> None:
16121612
self.aw.ETname = str(self.renameETLine.text()).strip()
16131613
if self.aw.ETname == '':
16141614
self.aw.ETname = QApplication.translate('Label', 'ET')
16151615
ETname_subst = self.aw.qmc.device_name_subst(self.aw.ETname)
1616-
self.aw.label2.setText(f'<big><b>{ETname_subst}</b></big>')
1617-
self.aw.label4.setText(f'{deltaLabelBigPrefix}{ETname_subst}</b></big>')
1616+
self.aw.label2.setText(self.aw.lcd_label_fmt.format(ETname_subst))
1617+
self.aw.label4.setText(f'{deltaLabelBigPrefix}{self.aw.lcd_label_fmt.format(ETname_subst)}')
16181618

16191619
@pyqtSlot(int)
16201620
def toggleWebLCDsAlerts(self, _:int) -> None:

src/artisanlib/devices.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3352,9 +3352,8 @@ def savedevicetable(self, redraw:bool = True) -> None:
33523352
self.aw.qmc.extradevices[i] = DEVICE_ID_VIRTUAL
33533353
self.aw.qmc.extraname1[i] = name1edit.text()
33543354
self.aw.qmc.extraname2[i] = name2edit.text()
3355-
3356-
self.aw.extraLCDlabel1[i].setText('<b>' + self.aw.qmc.device_name_subst(self.aw.qmc.extraname1[i]) + '</b>')
3357-
self.aw.extraLCDlabel2[i].setText('<b>' + self.aw.qmc.device_name_subst(self.aw.qmc.extraname2[i]) + '</b>')
3355+
self.aw.extraLCDlabel1[i].setText(self.aw.extra_lcd_label_fmt.format(self.aw.qmc.device_name_subst(self.aw.qmc.extraname1[i])))
3356+
self.aw.extraLCDlabel2[i].setText(self.aw.extra_lcd_label_fmt.format(self.aw.qmc.device_name_subst(self.aw.qmc.extraname2[i])))
33583357
self.aw.qmc.extramathexpression1[i] = mexpr1edit.text()
33593358
self.aw.qmc.extramathexpression2[i] = mexpr2edit.text()
33603359
#update legend with new curves

0 commit comments

Comments
 (0)