From 6fcef36d90a66afd7c974748af7de2017f4f5792 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Thu, 2 May 2019 19:54:26 +0200 Subject: Input intensity --- src/ui.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/ui.py') diff --git a/src/ui.py b/src/ui.py index 33da1ea..ccdff63 100644 --- a/src/ui.py +++ b/src/ui.py @@ -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) -- cgit