diff options
Diffstat (limited to 'src/ui.py')
-rw-r--r-- | src/ui.py | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -236,6 +236,8 @@ class TableRow: def populate_table(): + GUI.input_intensity.setText("%g" % system.input_intensity) + GUI.table = QGridLayout() GUI.table.setColumnStretch(1, 1) GUI.table.setColumnStretch(2, 2) @@ -444,17 +446,37 @@ def optimize(which): GUI.table_rows[op_idx].optbox.angle.edit.setText("%g" % round(opt.x * 180 / np.pi, 3)) + +def change_input_intensity(): + try: + system.input_intensity = float(GUI.input_intensity.text()) + update() + except ValueError: + pass + def setup(win, system_): global system system = system_ # Needless to say, I'm getting real tired of this whole Layout/Widget # clusterfuck in Qt - root = QHBoxLayout() + root = QVBoxLayout() root_fucking_random_container = QWidget() root_fucking_random_container.setLayout(root) win.setCentralWidget(root_fucking_random_container) + # Top bar (input intensity) + box = QHBoxLayout() + root.addLayout(box) + + box.addWidget(QLabel("Input intensity")) + GUI.input_intensity = QLineEdit("1") + GUI.input_intensity.textChanged.connect(change_input_intensity) + box.addWidget(GUI.input_intensity) + + hbox = QHBoxLayout() + root.addLayout(hbox) + rhs = QVBoxLayout() Widocques.image = QImage("jones.jpg") @@ -479,8 +501,8 @@ def setup(win, system_): GUI.table_frame.setLayout(GUI.table) GUI.scroll.setWidget(GUI.table_frame) - root.addWidget(GUI.scroll) - root.addLayout(rhs) + hbox.addWidget(GUI.scroll) + hbox.addLayout(rhs) setup_menubar(win) |