diff options
-rw-r--r-- | src/ui.py | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -171,7 +171,7 @@ class OptBox(QVBoxLayout): # Enable checkbox self.enable = QCheckBox("Enable") self.enable.setChecked(True) - self.enable.stateChanged.connect(update) + self.enable.stateChanged.connect(self.change_enable) self.addWidget(self.enable) # Angle @@ -189,6 +189,10 @@ class OptBox(QVBoxLayout): menu.addAction("Delete", lambda: half_assed_element_deletion(self.rownum - 1)) menu.exec_(self.name.mapToGlobal(pos)) + def change_enable(self): + self.row.pol.enable = self.enable.isChecked() + update() + class TableRow: def __init__(self, pol, grid, rownum): @@ -218,21 +222,12 @@ class TableRow: self.info.addItem(ExpandingSpacer()) grid.addLayout(self.info, rownum, 3) - @staticmethod def angle_change(row): row.angle = row.optbox.angle.angle / 180 * np.pi row.pol.angle = row.angle update() - @staticmethod - def t_change(row): - try: - row.pol.t1 = float(row.optbox.t1.text()) - row.pol.t2 = float(row.optbox.t2.text()) - except ValueError: - pass - update() def populate_table(): @@ -252,16 +247,12 @@ def populate_table(): GUI.opt_operand.addItem("Element #%d" % (i + 1), i) def update(): - system.ignore = [False] * len(system.elements) for i, pol in enumerate(system.elements): row = GUI.table_rows[i] if pol.ref is not False: pol.angle += system.elements[pol.ref].angle - if not row.optbox.enable.isChecked(): - system.ignore[i] = True - system.recalculate() I = 1 @@ -271,7 +262,7 @@ def update(): # update all the diagrams row.ellipse.state = system.states[i] row.ellipse.ellipse = system.ellipses[i] - row.ellipse.is_used = not system.ignore[i] + row.ellipse.is_used = system.elements[i].enable row.ellipse.repaint() text = "%s at %f°" \ |