Skip to content

Commit

Permalink
Backport PR #23417 on branch 6.x (PR: Recreate thumbnails list after …
Browse files Browse the repository at this point in the history
…dropping one in a new position (Plots)) (#23418)
  • Loading branch information
meeseeksmachine authored Jan 6, 2025
1 parent 076400e commit 8d0dcbd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spyder/plugins/plots/widgets/figurebrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,12 @@ def dropEvent(self, event):
self.scene.insertWidget(i - 1, dropped_thumbnail)
break

# Recreate thumbnails list to take into account the new order
# Fixes spyder-ide/spyder#22458
self._thumbnails = []
for i in range(n_thumbnails):
self._thumbnails.append(self.scene.itemAt(i).widget())

event.accept()

# ---- Save Figure
Expand Down Expand Up @@ -1041,7 +1047,7 @@ def remove_thumbnail(self, thumbnail):
if thumbnail in self._thumbnails:
self._thumbnails.remove(thumbnail)

# Select a new thumbnail if any :
# Select a new thumbnail, if any
if thumbnail == self.current_thumbnail:
if len(self._thumbnails) > 0:
self.set_current_index(
Expand Down

0 comments on commit 8d0dcbd

Please sign in to comment.