Skip to content

Commit 66456a0

Browse files
authored
Merge pull request #3 from nikhil-robinson/main
Fix for various screen resolution bug
2 parents 1770317 + f290b4f commit 66456a0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

embox.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,17 @@ class serial_PopupWindow(QDialog):
3131
def __init__(self, parent=None):
3232
super().__init__(parent)
3333
self.setWindowTitle("Settings")
34+
self.combox_stylesheet ="""
35+
QComboBox {
36+
color: cyan;
37+
}
38+
"""
3439

3540

3641
self.serial_parity_combo = QComboBox()
3742
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)
3845

3946
parity_layout = QHBoxLayout()
4047
parity_label =QLabel("Parity")
@@ -44,6 +51,8 @@ def __init__(self, parent=None):
4451

4552
self.serial_stopbits_combo = QComboBox()
4653
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)
4756

4857
stopbits_layout = QHBoxLayout()
4958
stopbits_label =QLabel("Stop bits")
@@ -53,6 +62,8 @@ def __init__(self, parent=None):
5362

5463
self.serial_bytesize_combo = QComboBox()
5564
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)
5667

5768
bytesize_layout = QHBoxLayout()
5869
bytesize_label = QLabel("Byte size")
@@ -103,6 +114,18 @@ def __init__(self):
103114
self.central_widget = QWidget()
104115
self.setCentralWidget(self.central_widget)
105116

117+
self.qline_stylesheet = """
118+
QLineEdit {
119+
color: cyan;
120+
}
121+
"""
122+
123+
self.combox_stylesheet ="""
124+
QComboBox {
125+
color: cyan;
126+
}
127+
"""
128+
106129
# Create a vertical layout for the main window
107130
self.main_layout = QHBoxLayout()
108131

@@ -199,13 +222,17 @@ def serverConf(self):
199222

200223
# Create the input fields for the form
201224
self.server_type_combo = QComboBox()
225+
202226
self.server_type_combo.addItems(["--Select Server--","HTTP", "UDP", "TCP","MQTT"])
203227
self.server_type_combo.setCurrentIndex(0)
204228
self.server_type_combo.currentIndexChanged.connect(self.server_combo_box_changed)
229+
self.server_type_combo.setStyleSheet(self.combox_stylesheet)
230+
205231
# self.server_type_combo.currentIndexChanged.connect(self.handle_server_type_change)
206232

207233
self.server_port_input = QLineEdit()
208234
self.server_port_input.setPlaceholderText("Enter Port Number")
235+
self.server_port_input.setStyleSheet(self.qline_stylesheet)
209236

210237

211238

@@ -218,6 +245,7 @@ def serverConf(self):
218245
self.server_ip_input = QLineEdit()
219246
self.server_ip_input.setPlaceholderText("Enter ip address")
220247
self.server_ip_input.setText("127.0.0.1")
248+
self.server_ip_input.setStyleSheet(self.qline_stylesheet)
221249

222250
self.server_address_bar = QHBoxLayout()
223251
self.server_address_bar.addWidget(self.server_ip_label)
@@ -229,6 +257,7 @@ def serverConf(self):
229257
self.server_send_data = QLineEdit()
230258
self.server_send_data.setPlaceholderText("Enter server response")
231259
self.server_send_data.returnPressed.connect(self.server_send_data_retuened)
260+
self.server_send_data.setStyleSheet(self.qline_stylesheet)
232261

233262

234263
server_port_regex = QRegularExpression("^[0-9]{1,5}$")
@@ -587,6 +616,7 @@ def serialConf(self):
587616
self.serial_orgnise = QHBoxLayout()
588617
self.serial_form_widget.setLayout(self.serial_form_layout)
589618
self.serial_port_combo = QComboBox()
619+
self.serial_port_combo.setStyleSheet(self.combox_stylesheet)
590620

591621
serialPortInfos = QtSerialPort.QSerialPortInfo.availablePorts()
592622
serial_ports = [p.portName() for p in serialPortInfos]
@@ -596,10 +626,12 @@ def serialConf(self):
596626
self.serial_baudrate_combo = QComboBox()
597627
self.serial_baudrate_combo.addItems(["9600", "19200", "38400", "57600", "115200"])
598628
self.serial_port_combo.setCurrentIndex(0)
629+
self.serial_baudrate_combo.setStyleSheet(self.combox_stylesheet)
599630

600631
self.lineending_combobox = QComboBox()
601632
self.lineending_combobox.addItems(['NONE', 'NL', 'CR', 'NL & CR'])
602633
self.lineending_combobox.currentIndexChanged.connect(self.handle_lineending_change)
634+
self.lineending_combobox.setStyleSheet(self.combox_stylesheet)
603635

604636

605637
self.serial_connect_button = QPushButton("Connect")
@@ -622,6 +654,7 @@ def serialConf(self):
622654
# Create a QLineEdit widget for entering filter serial_pattern
623655
self.serial_filter_pattern = QLineEdit()
624656
self.serial_filter_pattern.setPlaceholderText('Enter filter serial_pattern')
657+
self.serial_filter_pattern.setStyleSheet(self.qline_stylesheet)
625658

626659
# self.filter_layout = QHBoxLayout()
627660
# self.filter_layout.addWidget(self.serial_filter_pattern)
@@ -633,6 +666,7 @@ def serialConf(self):
633666

634667
self.serial_send_input = QLineEdit()
635668
self.serial_send_input.returnPressed.connect(self.serial_send_data)
669+
self.serial_send_input.setStyleSheet(self.qline_stylesheet)
636670

637671
self.serial_send_button = QPushButton("Send")
638672
self.serial_send_button.clicked.connect(self.serial_send_data)
@@ -861,7 +895,9 @@ def serial_ploter_open_window(self):
861895
# Create combo boxes for line colors and update interval
862896
self.serial_ploter_color_combo = QComboBox()
863897
self.serial_ploter_color_combo.addItems(['red', 'green', 'blue', 'black'])
898+
self.serial_ploter_color_combo.setStyleSheet(self.combox_stylesheet)
864899
self.serial_ploter_time_edit = QLineEdit()
900+
self.serial_ploter_time_edit.setStyleSheet(self.qline_stylesheet)
865901
self.serial_ploter_time_edit.setPlaceholderText("Enter time delay in (ms)")
866902
self.serial_ploter_time_edit.setValidator(QIntValidator())
867903

@@ -989,13 +1025,16 @@ def client_conf(self):
9891025
self.client_protocol_combobox.addItem('TCP')
9901026
self.client_protocol_combobox.addItem('MQTT')
9911027
self.client_protocol_combobox.setMinimumWidth(150)
1028+
self.client_protocol_combobox.setStyleSheet(self.combox_stylesheet)
9921029
self.client_protocol_combobox.activated.connect(self.on_client_combo_box_activated)
9931030

9941031

9951032
self.client_ip_edit = QLineEdit()
1033+
self.client_ip_edit.setStyleSheet(self.qline_stylesheet)
9961034
self.client_ip_edit.setPlaceholderText("IP Address")
9971035
self.client_port_edit = QLineEdit()
9981036
self.client_port_edit.setPlaceholderText("PORT")
1037+
self.client_port_edit.setStyleSheet(self.qline_stylesheet)
9991038

10001039
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]?)$")
10011040
client_port_regex = QRegularExpression("^[0-9]{1,5}$")
@@ -1012,6 +1051,7 @@ def client_conf(self):
10121051

10131052
self.client_send_edit = QLineEdit()
10141053
self.client_send_edit.setDisabled(True)
1054+
self.client_send_edit.setStyleSheet(self.qline_stylesheet)
10151055

10161056
self.client_send_button = QPushButton('Send')
10171057
self.client_send_button.clicked.connect(self.client_send_data)

0 commit comments

Comments
 (0)