From 76dd52c9387f330278bb4864fa93246f160f878a Mon Sep 17 00:00:00 2001 From: janezd Date: Fri, 23 Jan 2026 15:51:59 +0100 Subject: [PATCH 1/2] Network Clustering: Call auto-commit when changing the hop attenuation check box --- orangecontrib/network/widgets/OWNxClustering.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orangecontrib/network/widgets/OWNxClustering.py b/orangecontrib/network/widgets/OWNxClustering.py index 13ca29d..faf3bd5 100644 --- a/orangecontrib/network/widgets/OWNxClustering.py +++ b/orangecontrib/network/widgets/OWNxClustering.py @@ -41,7 +41,8 @@ def __init__(self): label="Max. iterations: ", callback=self.commit) gui.doubleSpin(box, self, "hop_attenuation", 0, 1, 0.01, label="Apply hop attenuation: ", - checked="attenuate", callback=self.commit) + checked="attenuate", callback=self.commit, + checkCallback=self.commit) self.random_state = gui.checkBox( box, self, "use_random_state", label="Replicable clustering", callback=self.commit) From 33ed74aa44a34ba009c11d12816a45f79849329f Mon Sep 17 00:00:00 2001 From: janezd Date: Fri, 23 Jan 2026 15:54:05 +0100 Subject: [PATCH 2/2] Network Clustering: Use deferred commit --- orangecontrib/network/widgets/OWNxClustering.py | 11 ++++++----- .../network/widgets/tests/test_OWNxClustering.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/orangecontrib/network/widgets/OWNxClustering.py b/orangecontrib/network/widgets/OWNxClustering.py index faf3bd5..5e9a86f 100644 --- a/orangecontrib/network/widgets/OWNxClustering.py +++ b/orangecontrib/network/widgets/OWNxClustering.py @@ -38,22 +38,23 @@ def __init__(self): box = gui.vBox(self.controlArea, "Label Propagation") gui.spin( box, self, "iterations", 1, 100000, 1, - label="Max. iterations: ", callback=self.commit) + label="Max. iterations: ", callback=self.commit.deferred) gui.doubleSpin(box, self, "hop_attenuation", 0, 1, 0.01, label="Apply hop attenuation: ", - checked="attenuate", callback=self.commit, - checkCallback=self.commit) + checked="attenuate", callback=self.commit.deferred, + checkCallback=self.commit.deferred) self.random_state = gui.checkBox( box, self, "use_random_state", - label="Replicable clustering", callback=self.commit) + label="Replicable clustering", callback=self.commit.deferred) gui.auto_apply(self.controlArea, self) @Inputs.network def set_network(self, net): self.net = net - self.commit() + self.commit.now() + @gui.deferred def commit(self): kwargs = {'iterations': self.iterations} if self.attenuate: diff --git a/orangecontrib/network/widgets/tests/test_OWNxClustering.py b/orangecontrib/network/widgets/tests/test_OWNxClustering.py index cdf0e6f..9f9905e 100644 --- a/orangecontrib/network/widgets/tests/test_OWNxClustering.py +++ b/orangecontrib/network/widgets/tests/test_OWNxClustering.py @@ -28,7 +28,7 @@ def test_does_not_crash_when_cluster_variable_already_exists(self): # Should not crash self.send_signal(self.widget.Inputs.network, graph) - self.widget.unconditional_commit() + self.widget.commit.now() # There should be an additional cluster column output = self.get_output(self.widget.Outputs.network).nodes @@ -39,11 +39,11 @@ def test_reproducible_clustering(self): self.widget.controls.use_random_state.setChecked(True) self.send_signal(self.widget.Inputs.network, network) - self.widget.unconditional_commit() + self.widget.commit.now() res1 = self.get_output(self.widget.Outputs.network).nodes.metas self.send_signal(self.widget.Inputs.network, network) - self.widget.unconditional_commit() + self.widget.commit.now() res2 = self.get_output(self.widget.Outputs.network).nodes.metas # Seeded rerun should give same clustering result @@ -55,7 +55,7 @@ def test_multiple_reruns_override_variable(self): for _ in range(10): self.send_signal(self.widget.Inputs.network, network) - self.widget.unconditional_commit() + self.widget.commit.now() output = self.get_output(self.widget.Outputs.network).nodes # Multiple reruns should override the results instead of adding new feature every time