Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure GridSpec override handles duplicate matches #2150

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions panel/layout/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,9 @@ def __setitem__(self, index, obj):
grid = clone.grid
grid[t:b, l:r] += 1

overlap_grid = grid>1
overlap_grid = grid > 1
new_objects = OrderedDict(self.objects)
if (overlap_grid).any():
if overlap_grid.any():
overlapping = ''
objects = []
for (yidx, xidx) in zip(*np.where(overlap_grid)):
Expand All @@ -465,7 +465,10 @@ def __setitem__(self, index, obj):
objects = [list(subgrid)[0][0]] if subgrid else []
else:
objects = [list(o)[0][0] for o in subgrid.flatten()]
for dkey in objects:
del new_objects[dkey]
for dkey in set(objects):
try:
del new_objects[dkey]
except KeyError:
continue
new_objects[key] = panel(obj)
self.objects = new_objects