Skip to content

Commit

Permalink
Don't reset table model if not changing data layer. Account for curre…
Browse files Browse the repository at this point in the history
…nt order in _update_visible.
  • Loading branch information
Carifio24 committed Mar 4, 2023
1 parent d7f83b0 commit 74a065f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion glue/viewers/table/qt/data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _update_visible(self):
visible = np.zeros(self.order.shape, dtype=bool)
for layer_artist in self._table_viewer.layers:
if layer_artist.visible:
mask = layer_artist.layer.to_mask()
mask = layer_artist.layer.to_mask()[self.order]
if DASK_INSTALLED and isinstance(mask, da.Array):
mask = mask.compute()
visible |= mask
Expand Down Expand Up @@ -295,6 +295,13 @@ def _on_layers_changed(self, *args):
break
else:
return

# If we aren't changing the data layer, we don't need to
# reset the model, just update visible rows
if layer_state.layer == self.data:
self.model._update_visible()
return

self.data = layer_state.layer
self.setUpdatesEnabled(False)
self.model = DataTableModel(self)
Expand Down

0 comments on commit 74a065f

Please sign in to comment.