Skip to content

Commit 6053e44

Browse files
committed
fixed diff_checkbox state being ignored when switching arrays
1 parent 75a4a7f commit 6053e44

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

larray_editor/comparator.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ def __init__(self, parent=None):
2323
maxdiff_layout.addStretch()
2424
layout.addLayout(maxdiff_layout)
2525

26-
self.arraywidget = ArrayEditorWidget(self, np.array([]), readonly=True, bg_gradient='red-white-blue')
26+
self.arraywidget = ArrayEditorWidget(self, data=None, readonly=True, bg_gradient='red-white-blue')
2727

2828
diff_checkbox = QCheckBox(_('Differences Only'))
29-
diff_checkbox.stateChanged.connect(self.show_differences_only)
29+
diff_checkbox.stateChanged.connect(self.display)
3030
self.diff_checkbox = diff_checkbox
3131
self.arraywidget.btn_layout.addWidget(diff_checkbox)
3232

@@ -72,11 +72,10 @@ def set_data(self, arrays, stack_axis):
7272
self.bg_value = full_like(self.array, 0.5)
7373

7474
self.maxdiff_label.setText(str(maxabsreldiff))
75-
self.arraywidget.set_data(self.array, bg_value=self.bg_value)
75+
self.display(self.diff_checkbox.isChecked())
7676

77-
def show_differences_only(self, yes):
78-
if yes:
79-
# only show rows with a difference. For some reason, this is abysmally slow though.
77+
def display(self, diff_only):
78+
if diff_only:
8079
row_filter = (~self.isequal).any(self.stack_axis.name)
8180
self.arraywidget.set_data(self.array[row_filter], bg_value=self.bg_value[row_filter])
8281
else:

0 commit comments

Comments
 (0)