Skip to content

Commit

Permalink
spectra: do not send selection_changed on the same selection
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Oct 12, 2023
1 parent 921aedf commit b9e32a4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions orangecontrib/spectroscopy/widgets/owspectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@ def current_selection():

old_sel_ci = current_selection()

changed = False

if add_to_group: # both keys - need to test it before add_group
selnum = np.max(self.selection_group)
elif add_group:
Expand All @@ -1331,15 +1333,20 @@ def current_selection():
else:
# remove the current selection
redraw_curve_indices.update(old_sel_ci)
self.selection_group *= 0 # remove
if np.any(self.selection_group):
self.selection_group *= 0 # remove
changed = True
selnum = 1
# add new
if data_indices is not None:
self.selection_group[data_indices] = selnum
redraw_curve_indices.update(
icurve for idata, icurve in invd.items() if idata in data_indices_set)
changed = True

fixes = self.make_selection_valid()
if fixes:
changed = True
redraw_curve_indices.update(
icurve for idata, icurve in invd.items() if idata in fixes)

Expand All @@ -1351,7 +1358,8 @@ def current_selection():
redraw_curve_indices.update(old_sel_ci)

self.set_curve_pens(redraw_curve_indices)
self.selection_changed_confirm()
if changed:
self.selection_changed_confirm()

def make_selection_valid(self):
""" Make the selection valid and return the changed positions. """
Expand Down

0 comments on commit b9e32a4

Please sign in to comment.