Skip to content

Commit

Permalink
Merge pull request #23417 from ccordoba12/issue-22458
Browse files Browse the repository at this point in the history
PR: Recreate thumbnails list after dropping one in a new position (Plots)
  • Loading branch information
ccordoba12 authored Jan 5, 2025
2 parents ff3940a + c30ab5a commit 0dad5d1
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 0dad5d1

Please sign in to comment.