Skip to content

Commit

Permalink
owexplainfeaturebase - use deferred commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimozGodec committed Jul 26, 2023
1 parent a673d5b commit 20b2c75
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions orangecontrib/explain/widgets/owexplainfeaturebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,16 +549,17 @@ def _update_plot(self):
def _clear_selection(self):
if self.selection:
self.selection = ()
self.commit()
self.commit.deferred()

def update_selection(self, *_):
raise NotImplementedError

def select_pending(self, pending_selection: Tuple):
self.__pending_selection = pending_selection
self.unconditional_commit()
self.commit.now()

# Outputs
@gui.deferred
def commit(self):
selected_data = self.get_selected_data()
if not selected_data:
Expand Down
2 changes: 1 addition & 1 deletion orangecontrib/explain/widgets/owexplainmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def update_selection(self, min_val: float, max_val: float, attr_name: str):
if not self.selection and not any(mask):
return
self.selection = (attr_name, list(np.flatnonzero(mask)))
self.commit()
self.commit.deferred()

def select_pending(self, pending_selection: Tuple):
if not pending_selection or not pending_selection[1] \
Expand Down
2 changes: 1 addition & 1 deletion orangecontrib/explain/widgets/owpermutationimportance.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def update_selection(self, attr_names: Set[str]):
return
assert self.results is not None
self.selection = tuple(attr_names)
self.commit()
self.commit.deferred()

def select_pending(self, pending_selection: Tuple):
if not pending_selection or self.results is None:
Expand Down

0 comments on commit 20b2c75

Please sign in to comment.