From 20b2c759c99ba8e7fca953e25484c5d6d8e07331 Mon Sep 17 00:00:00 2001
From: PrimozGodec
Date: Wed, 26 Jul 2023 11:36:56 +0200
Subject: [PATCH] owexplainfeaturebase - use deferred commit
---
orangecontrib/explain/widgets/owexplainfeaturebase.py | 5 +++--
orangecontrib/explain/widgets/owexplainmodel.py | 2 +-
orangecontrib/explain/widgets/owpermutationimportance.py | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/orangecontrib/explain/widgets/owexplainfeaturebase.py b/orangecontrib/explain/widgets/owexplainfeaturebase.py
index 85abc83..eb68624 100644
--- a/orangecontrib/explain/widgets/owexplainfeaturebase.py
+++ b/orangecontrib/explain/widgets/owexplainfeaturebase.py
@@ -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:
diff --git a/orangecontrib/explain/widgets/owexplainmodel.py b/orangecontrib/explain/widgets/owexplainmodel.py
index 7b7316f..a3a6e3e 100644
--- a/orangecontrib/explain/widgets/owexplainmodel.py
+++ b/orangecontrib/explain/widgets/owexplainmodel.py
@@ -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] \
diff --git a/orangecontrib/explain/widgets/owpermutationimportance.py b/orangecontrib/explain/widgets/owpermutationimportance.py
index 2484530..c77b4c5 100644
--- a/orangecontrib/explain/widgets/owpermutationimportance.py
+++ b/orangecontrib/explain/widgets/owpermutationimportance.py
@@ -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: