-
Notifications
You must be signed in to change notification settings - Fork 19
Update channel visibility when unit is changed in unitview #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7c734ce
0ebdd27
c9d9033
92c1958
02d4a33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,13 @@ def update_manual_labels(self): | |
| elif self.backend == 'panel': | ||
| self._panel_update_labels() | ||
|
|
||
| def notify_unit_visibility_changed(self): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You think do the channel visibility update on
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #266 |
||
| selected_units = self.controller.get_visible_unit_ids() | ||
| visible_channel_inds = self.controller.get_common_sparse_channels(selected_units) | ||
| self.controller.set_channel_visibility(visible_channel_inds) | ||
| self.notify_channel_visibility_changed() | ||
| super().notify_unit_visibility_changed() | ||
|
|
||
| ## Qt ## | ||
| def _qt_make_layout(self): | ||
|
|
||
|
|
@@ -326,8 +333,11 @@ def _qt_on_item_changed(self, item): | |
| is_visible = item.checkState() == QT.Qt.Checked | ||
| # visibility checkbox | ||
| unit_id = item.unit_id | ||
| current_visible_units = self.controller.get_visible_unit_ids() | ||
| self.controller.set_unit_visibility(unit_id, is_visible) | ||
| self.notify_unit_visibility_changed() | ||
| updated_visibile_units = self.controller.get_visible_unit_ids() | ||
| if set(current_visible_units) != set(updated_visibile_units): | ||
| self.notify_unit_visibility_changed() | ||
|
|
||
|
|
||
| elif col in self.label_columns: | ||
|
|
@@ -342,12 +352,12 @@ def _qt_on_item_changed(self, item): | |
|
|
||
| def _qt_on_double_clicked(self, row, col): | ||
| unit_id = self.table.item(row, 1).unit_id | ||
| current_visible_units = self.controller.get_visible_unit_ids() | ||
| self.controller.set_visible_unit_ids([unit_id]) | ||
| # self.refresh() | ||
|
|
||
|
|
||
| self.notify_unit_visibility_changed() | ||
| self._qt_refresh_visibility_items() | ||
| updated_visibile_units = self.controller.get_visible_unit_ids() | ||
| if set(current_visible_units) != set(updated_visibile_units): | ||
| self.notify_unit_visibility_changed() | ||
| self._qt_refresh_visibility_items() | ||
|
|
||
| def _qt_on_open_context_menu(self): | ||
| self.menu.popup(self.qt_widget.cursor().pos()) | ||
|
|
@@ -369,38 +379,45 @@ def _qt_get_selected_unit_ids(self): | |
| def _qt_on_visible_shortcut(self): | ||
| rows = self._qt_get_selected_rows() | ||
|
|
||
| current_visible_units = self.controller.get_visible_unit_ids() | ||
| self.controller.set_visible_unit_ids(self.get_selected_unit_ids()) | ||
| # self.refresh() | ||
| self.notify_unit_visibility_changed() | ||
| self._qt_refresh_visibility_items() | ||
|
|
||
| for row in rows: | ||
| self.table.selectRow(row) | ||
| updated_visibile_units = self.controller.get_visible_unit_ids() | ||
| if set(current_visible_units) != set(updated_visibile_units): | ||
| self.notify_unit_visibility_changed() | ||
| self._qt_refresh_visibility_items() | ||
|
|
||
| for row in rows: | ||
| self.table.selectRow(row) | ||
|
|
||
| def _qt_on_only_previous_shortcut(self): | ||
| sel_rows = self._qt_get_selected_rows() | ||
| if len(sel_rows) == 0: | ||
| sel_rows = [self.table.rowCount()] | ||
| new_row = max(sel_rows[0] - 1, 0) | ||
| unit_id = self.table.item(new_row, 1).unit_id | ||
| current_visible_units = self.controller.get_visible_unit_ids() | ||
| self.controller.set_visible_unit_ids([unit_id]) | ||
| self.notify_unit_visibility_changed() | ||
| self._qt_refresh_visibility_items() | ||
|
|
||
| self.table.clearSelection() | ||
| self.table.selectRow(new_row) | ||
| updated_visibile_units = self.controller.get_visible_unit_ids() | ||
| if set(current_visible_units) != set(updated_visibile_units): | ||
| self.notify_unit_visibility_changed() | ||
| self._qt_refresh_visibility_items() | ||
| self.table.clearSelection() | ||
| self.table.selectRow(new_row) | ||
|
|
||
| def _qt_on_only_next_shortcut(self): | ||
| sel_rows = self._qt_get_selected_rows() | ||
| if len(sel_rows) == 0: | ||
| sel_rows = [-1] | ||
| new_row = min(sel_rows[-1] + 1, self.table.rowCount() - 1) | ||
| unit_id = self.table.item(new_row, 1).unit_id | ||
| current_visible_units = self.controller.get_visible_unit_ids() | ||
| self.controller.set_visible_unit_ids([unit_id]) | ||
| self.notify_unit_visibility_changed() | ||
| self._qt_refresh_visibility_items() | ||
| self.table.clearSelection() | ||
| self.table.selectRow(new_row) | ||
| updated_visibile_units = self.controller.get_visible_unit_ids() | ||
| if set(current_visible_units) != set(updated_visibile_units): | ||
| self.notify_unit_visibility_changed() | ||
| self._qt_refresh_visibility_items() | ||
| self.table.clearSelection() | ||
| self.table.selectRow(new_row) | ||
|
|
||
| def _qt_on_delete_shortcut(self): | ||
| sel_rows = self._qt_get_selected_rows() | ||
|
|
@@ -728,13 +745,16 @@ def _panel_update_labels(self): | |
| def _panel_on_only_selection(self): | ||
| selected_unit = self.table.selection[0] | ||
| unit_id = self.table.value.index.values[selected_unit] | ||
| current_visible_units = self.controller.get_visible_unit_ids() | ||
| self.controller.set_visible_unit_ids([unit_id]) | ||
| self._panel_refresh_colors() | ||
| # update the visible column | ||
| df = self.table.value | ||
| df.loc[self.controller.unit_ids, "visible"] = self.controller.get_units_visibility_mask() | ||
| self.table.value = df | ||
| self.notify_unit_visibility_changed() | ||
| updated_visibile_units = self.controller.get_visible_unit_ids() | ||
| if set(current_visible_units) != set(updated_visibile_units): | ||
| self._panel_refresh_colors() | ||
| # update the visible column | ||
| df = self.table.value | ||
| df.loc[self.controller.unit_ids, "visible"] = self.controller.get_units_visibility_mask() | ||
| self.table.value = df | ||
| self.notify_unit_visibility_changed() | ||
|
|
||
| def _panel_get_selected_unit_ids(self): | ||
| unit_ids = self.table.value.index.values | ||
|
|
@@ -785,9 +805,12 @@ def _panel_handle_shortcut(self, event): | |
| if self.controller.curation: | ||
| self._panel_merge_units() | ||
| elif event.data == "visible": | ||
| current_visibile_units = self.controller.get_visible_unit_ids() | ||
| self.controller.set_visible_unit_ids(selected_unit_ids) | ||
| self.notify_unit_visibility_changed() | ||
| self.refresh() | ||
| updated_visibile_units = self.controller.get_visible_unit_ids() | ||
| if set(current_visibile_units) != set(updated_visibile_units): | ||
| self.notify_unit_visibility_changed() | ||
| self.refresh() | ||
| elif event.data == "clear": | ||
| for unit_id in selected_unit_ids: | ||
| self.controller.set_label_to_unit(unit_id, "quality", None) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already handled in the
_panel_add_event_lines