forked from HamedRst/FlowBehaviour
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCellGUI.py
More file actions
119 lines (91 loc) · 4.04 KB
/
CellGUI.py
File metadata and controls
119 lines (91 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton, QMessageBox, QDialog, QFormLayout
class CellInputDialog(QDialog):
def __init__(self, cell_number):
super().__init__()
self.cell_number = cell_number
self.setWindowTitle(f'Cell {cell_number} Information')
self.setGeometry(100, 100, 400, 300)
self.initUI()
def initUI(self):
layout = QVBoxLayout()
self.specie_edit = QLineEdit()
self.flow_behavior_edit = QLineEdit()
self.input_connections_edit = QLineEdit()
self.output_connections_edit = QLineEdit()
self.specie_label = QLabel("Specie:")
self.flow_behavior_label = QLabel("Flow Behavior:")
self.input_connections_label = QLabel("Input Connections:")
self.output_connections_label = QLabel("Output Connections:")
layout.addWidget(self.specie_label)
layout.addWidget(self.specie_edit)
layout.addWidget(self.flow_behavior_label)
layout.addWidget(self.flow_behavior_edit)
layout.addWidget(self.input_connections_label)
layout.addWidget(self.input_connections_edit)
layout.addWidget(self.output_connections_label)
layout.addWidget(self.output_connections_edit)
submit_button = QPushButton("Submit")
submit_button.clicked.connect(self.accept)
layout.addWidget(submit_button)
self.setLayout(layout)
def get_cell_info(self):
self.exec_()
return (
self.specie_edit.text(),
self.flow_behavior_edit.text(),
self.input_connections_edit.text(),
self.output_connections_edit.text()
)
class CellInfoWindow(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle('Experiment Information')
self.setGeometry(100, 100, 400, 300)
self.initUI()
def initUI(self):
layout = QVBoxLayout()
self.num_cells_label = QLabel('Number of Cells:')
layout.addWidget(self.num_cells_label)
self.num_cells_input = QLineEdit()
layout.addWidget(self.num_cells_input)
self.experiment_duration_label = QLabel('Experiment Duration:')
layout.addWidget(self.experiment_duration_label)
self.experiment_duration_input = QLineEdit()
layout.addWidget(self.experiment_duration_input)
self.num_medias_label = QLabel('Number of Medias:')
layout.addWidget(self.num_medias_label)
self.num_medias_input = QLineEdit()
layout.addWidget(self.num_medias_input)
self.submit_button = QPushButton('Submit')
self.submit_button.clicked.connect(self.get_cell_info)
layout.addWidget(self.submit_button)
self.setLayout(layout)
def get_cell_info(self):
num_cells = int(self.num_cells_input.text())
experiment_duration = self.experiment_duration_input.text()
num_medias = int(self.num_medias_input.text())
cell_info = {}
for i in range(1, num_cells + 1):
dialog = CellInputDialog(i)
specie, flow_behavior, input_connections, output_connections = dialog.get_cell_info()
cell_info[f"Cell {i}"] = {
"Specie": specie,
"Flow Behavior": flow_behavior,
"Input Connections": input_connections,
"Output Connections": output_connections
}
self.show_message(experiment_duration, num_medias, cell_info)
def show_message(self, experiment_duration, num_medias, cell_info):
message = f'Experiment Duration: {experiment_duration}\nNumber of Medias: {num_medias}\n\n'
message += 'Cell Information:\n'
for cell, info in cell_info.items():
message += f'\n{cell}:\n'
for key, value in info.items():
message += f'{key}: {value}\n'
QMessageBox.information(self, 'Cell Information', message)
if __name__ == '__main__':
app = QApplication(sys.argv)
window = CellInfoWindow()
window.show()
sys.exit(app.exec_())