From 25c56e728799b43920427f687abc3d5463f0b4f9 Mon Sep 17 00:00:00 2001 From: Oliver Hensby Date: Fri, 10 Jan 2025 16:27:00 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20EditGrid:=20Only=20pass=20necess?= =?UTF-8?q?ary=20kwargs=20Only=20pass=20kwargs=20to=20EditGrid=20that=20do?= =?UTF-8?q?=20not=20have=20an=20associated=20trait=20in=20AutoGrid.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ipyautoui/custom/editgrid.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ipyautoui/custom/editgrid.py b/src/ipyautoui/custom/editgrid.py index f0156ea..4540ebd 100644 --- a/src/ipyautoui/custom/editgrid.py +++ b/src/ipyautoui/custom/editgrid.py @@ -34,7 +34,7 @@ from ipyautoui.autoobject import AutoObjectForm from ipyautoui.custom.buttonbars import CrudButtonBar -from ipyautoui._utils import frozenmap +from ipyautoui._utils import frozenmap, traits_in_kwargs from ipyautoui.constants import BUTTON_WIDTH_MIN from ipyautoui.custom.autogrid import AutoGrid from ipyautoui.custom.title_description import TitleDescription @@ -336,9 +336,13 @@ def __init__( self._init_form() self._init_row_controls() self._init_controls() - # NOTE: setting kwargs here and in _init_autogrid may cause unwanted behaviour - # PR: https://github.com/maxfordham/ipyautoui/pull/351 - super().__init__(**kwargs) + super().__init__( + **{ + k: v + for k, v in kwargs.items() + if k not in traits_in_kwargs(AutoGrid, kwargs) + } + ) # NOTE: Only pass kwargs not in AutoGrid traits self.warn_on_delete = warn_on_delete # self.show_copy_dialogue = show_copy_dialogue self.show_copy_dialogue = False