diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2019-05-02 20:05:30 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2019-05-02 20:05:30 +0200 |
commit | 1c137af4c4049bad85511e584b8b5739e03ee5e4 (patch) | |
tree | ca6eac5ef78a6ab8ce714602744c34bc647f33b6 /src | |
parent | 6fcef36d90a66afd7c974748af7de2017f4f5792 (diff) |
Fix enabling/disabling
Diffstat (limited to 'src')
-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°" \ |