@@ -31,10 +31,17 @@ class serial_PopupWindow(QDialog):
31
31
def __init__ (self , parent = None ):
32
32
super ().__init__ (parent )
33
33
self .setWindowTitle ("Settings" )
34
+ self .combox_stylesheet = """
35
+ QComboBox {
36
+ color: cyan;
37
+ }
38
+ """
34
39
35
40
36
41
self .serial_parity_combo = QComboBox ()
37
42
self .serial_parity_combo .addItems (['NONE' , 'EVEN' , 'ODD' , 'SPACE' ,'MARK' ])
43
+ self .serial_parity_combo .setStyleSheet (self .combox_stylesheet )
44
+ self .serial_parity_combo .setMinimumWidth (150 )
38
45
39
46
parity_layout = QHBoxLayout ()
40
47
parity_label = QLabel ("Parity" )
@@ -44,6 +51,8 @@ def __init__(self, parent=None):
44
51
45
52
self .serial_stopbits_combo = QComboBox ()
46
53
self .serial_stopbits_combo .addItems (['1' ,'1.5' , '2' ])
54
+ self .serial_stopbits_combo .setStyleSheet (self .combox_stylesheet )
55
+ self .serial_stopbits_combo .setMinimumWidth (150 )
47
56
48
57
stopbits_layout = QHBoxLayout ()
49
58
stopbits_label = QLabel ("Stop bits" )
@@ -53,6 +62,8 @@ def __init__(self, parent=None):
53
62
54
63
self .serial_bytesize_combo = QComboBox ()
55
64
self .serial_bytesize_combo .addItems (['5' , '6' , '7' , '8' ])
65
+ self .serial_bytesize_combo .setStyleSheet (self .combox_stylesheet )
66
+ self .serial_bytesize_combo .setMinimumWidth (150 )
56
67
57
68
bytesize_layout = QHBoxLayout ()
58
69
bytesize_label = QLabel ("Byte size" )
@@ -103,6 +114,18 @@ def __init__(self):
103
114
self .central_widget = QWidget ()
104
115
self .setCentralWidget (self .central_widget )
105
116
117
+ self .qline_stylesheet = """
118
+ QLineEdit {
119
+ color: cyan;
120
+ }
121
+ """
122
+
123
+ self .combox_stylesheet = """
124
+ QComboBox {
125
+ color: cyan;
126
+ }
127
+ """
128
+
106
129
# Create a vertical layout for the main window
107
130
self .main_layout = QHBoxLayout ()
108
131
@@ -199,13 +222,17 @@ def serverConf(self):
199
222
200
223
# Create the input fields for the form
201
224
self .server_type_combo = QComboBox ()
225
+
202
226
self .server_type_combo .addItems (["--Select Server--" ,"HTTP" , "UDP" , "TCP" ,"MQTT" ])
203
227
self .server_type_combo .setCurrentIndex (0 )
204
228
self .server_type_combo .currentIndexChanged .connect (self .server_combo_box_changed )
229
+ self .server_type_combo .setStyleSheet (self .combox_stylesheet )
230
+
205
231
# self.server_type_combo.currentIndexChanged.connect(self.handle_server_type_change)
206
232
207
233
self .server_port_input = QLineEdit ()
208
234
self .server_port_input .setPlaceholderText ("Enter Port Number" )
235
+ self .server_port_input .setStyleSheet (self .qline_stylesheet )
209
236
210
237
211
238
@@ -218,6 +245,7 @@ def serverConf(self):
218
245
self .server_ip_input = QLineEdit ()
219
246
self .server_ip_input .setPlaceholderText ("Enter ip address" )
220
247
self .server_ip_input .setText ("127.0.0.1" )
248
+ self .server_ip_input .setStyleSheet (self .qline_stylesheet )
221
249
222
250
self .server_address_bar = QHBoxLayout ()
223
251
self .server_address_bar .addWidget (self .server_ip_label )
@@ -229,6 +257,7 @@ def serverConf(self):
229
257
self .server_send_data = QLineEdit ()
230
258
self .server_send_data .setPlaceholderText ("Enter server response" )
231
259
self .server_send_data .returnPressed .connect (self .server_send_data_retuened )
260
+ self .server_send_data .setStyleSheet (self .qline_stylesheet )
232
261
233
262
234
263
server_port_regex = QRegularExpression ("^[0-9]{1,5}$" )
@@ -587,6 +616,7 @@ def serialConf(self):
587
616
self .serial_orgnise = QHBoxLayout ()
588
617
self .serial_form_widget .setLayout (self .serial_form_layout )
589
618
self .serial_port_combo = QComboBox ()
619
+ self .serial_port_combo .setStyleSheet (self .combox_stylesheet )
590
620
591
621
serialPortInfos = QtSerialPort .QSerialPortInfo .availablePorts ()
592
622
serial_ports = [p .portName () for p in serialPortInfos ]
@@ -596,10 +626,12 @@ def serialConf(self):
596
626
self .serial_baudrate_combo = QComboBox ()
597
627
self .serial_baudrate_combo .addItems (["9600" , "19200" , "38400" , "57600" , "115200" ])
598
628
self .serial_port_combo .setCurrentIndex (0 )
629
+ self .serial_baudrate_combo .setStyleSheet (self .combox_stylesheet )
599
630
600
631
self .lineending_combobox = QComboBox ()
601
632
self .lineending_combobox .addItems (['NONE' , 'NL' , 'CR' , 'NL & CR' ])
602
633
self .lineending_combobox .currentIndexChanged .connect (self .handle_lineending_change )
634
+ self .lineending_combobox .setStyleSheet (self .combox_stylesheet )
603
635
604
636
605
637
self .serial_connect_button = QPushButton ("Connect" )
@@ -622,6 +654,7 @@ def serialConf(self):
622
654
# Create a QLineEdit widget for entering filter serial_pattern
623
655
self .serial_filter_pattern = QLineEdit ()
624
656
self .serial_filter_pattern .setPlaceholderText ('Enter filter serial_pattern' )
657
+ self .serial_filter_pattern .setStyleSheet (self .qline_stylesheet )
625
658
626
659
# self.filter_layout = QHBoxLayout()
627
660
# self.filter_layout.addWidget(self.serial_filter_pattern)
@@ -633,6 +666,7 @@ def serialConf(self):
633
666
634
667
self .serial_send_input = QLineEdit ()
635
668
self .serial_send_input .returnPressed .connect (self .serial_send_data )
669
+ self .serial_send_input .setStyleSheet (self .qline_stylesheet )
636
670
637
671
self .serial_send_button = QPushButton ("Send" )
638
672
self .serial_send_button .clicked .connect (self .serial_send_data )
@@ -861,7 +895,9 @@ def serial_ploter_open_window(self):
861
895
# Create combo boxes for line colors and update interval
862
896
self .serial_ploter_color_combo = QComboBox ()
863
897
self .serial_ploter_color_combo .addItems (['red' , 'green' , 'blue' , 'black' ])
898
+ self .serial_ploter_color_combo .setStyleSheet (self .combox_stylesheet )
864
899
self .serial_ploter_time_edit = QLineEdit ()
900
+ self .serial_ploter_time_edit .setStyleSheet (self .qline_stylesheet )
865
901
self .serial_ploter_time_edit .setPlaceholderText ("Enter time delay in (ms)" )
866
902
self .serial_ploter_time_edit .setValidator (QIntValidator ())
867
903
@@ -989,13 +1025,16 @@ def client_conf(self):
989
1025
self .client_protocol_combobox .addItem ('TCP' )
990
1026
self .client_protocol_combobox .addItem ('MQTT' )
991
1027
self .client_protocol_combobox .setMinimumWidth (150 )
1028
+ self .client_protocol_combobox .setStyleSheet (self .combox_stylesheet )
992
1029
self .client_protocol_combobox .activated .connect (self .on_client_combo_box_activated )
993
1030
994
1031
995
1032
self .client_ip_edit = QLineEdit ()
1033
+ self .client_ip_edit .setStyleSheet (self .qline_stylesheet )
996
1034
self .client_ip_edit .setPlaceholderText ("IP Address" )
997
1035
self .client_port_edit = QLineEdit ()
998
1036
self .client_port_edit .setPlaceholderText ("PORT" )
1037
+ self .client_port_edit .setStyleSheet (self .qline_stylesheet )
999
1038
1000
1039
client_ip_regex = QRegularExpression ("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\ .){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" )
1001
1040
client_port_regex = QRegularExpression ("^[0-9]{1,5}$" )
@@ -1012,6 +1051,7 @@ def client_conf(self):
1012
1051
1013
1052
self .client_send_edit = QLineEdit ()
1014
1053
self .client_send_edit .setDisabled (True )
1054
+ self .client_send_edit .setStyleSheet (self .qline_stylesheet )
1015
1055
1016
1056
self .client_send_button = QPushButton ('Send' )
1017
1057
self .client_send_button .clicked .connect (self .client_send_data )
0 commit comments