Skip to content

Commit

Permalink
Ensure GridSpec override handles duplicate matches
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Apr 8, 2021
1 parent 56ce69c commit cf4cebe
Showing 1 changed file with 7 additions and 4 deletions.
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

0 comments on commit cf4cebe

Please sign in to comment.