@@ -3098,21 +3098,25 @@ def _get_child_props(self, child):
3098
3098
return None
3099
3099
else :
3100
3100
# ### Child a compound property ###
3101
- if child .plotly_name in self ._compound_props :
3102
- return self ._props .get (child .plotly_name , None )
3101
+ if child .plotly_name in self :
3102
+ from _plotly_utils .basevalidators import CompoundValidator , CompoundArrayValidator
3103
+ validator = self ._get_validator (child .plotly_name )
3103
3104
3104
- # ### Child an element of a compound array property ###
3105
- elif child .plotly_name in self ._compound_array_props :
3106
- children = self ._compound_array_props [child .plotly_name ]
3107
- child_ind = BaseFigure ._index_is (children , child )
3108
- assert child_ind is not None
3105
+ if isinstance (validator , CompoundValidator ):
3106
+ return self ._props .get (child .plotly_name , None )
3109
3107
3110
- children_props = self ._props .get (child .plotly_name , None )
3111
- return (
3112
- children_props [child_ind ]
3113
- if children_props is not None and len (children_props ) > child_ind
3114
- else None
3115
- )
3108
+ # ### Child an element of a compound array property ###
3109
+ elif isinstance (validator , CompoundArrayValidator ):
3110
+ children = self [child .plotly_name ]
3111
+ child_ind = BaseFigure ._index_is (children , child )
3112
+ assert child_ind is not None
3113
+
3114
+ children_props = self ._props .get (child .plotly_name , None )
3115
+ return (
3116
+ children_props [child_ind ]
3117
+ if children_props is not None and len (children_props ) > child_ind
3118
+ else None
3119
+ )
3116
3120
3117
3121
# ### Invalid child ###
3118
3122
else :
@@ -3320,7 +3324,9 @@ def __getitem__(self, prop):
3320
3324
-------
3321
3325
Any
3322
3326
"""
3323
- from _plotly_utils .basevalidators import CompoundValidator , CompoundArrayValidator
3327
+ from _plotly_utils .basevalidators import (
3328
+ CompoundValidator , CompoundArrayValidator , BaseDataValidator
3329
+ )
3324
3330
3325
3331
# Normalize prop
3326
3332
# --------------
@@ -3346,10 +3352,15 @@ def __getitem__(self, prop):
3346
3352
if isinstance (validator , CompoundValidator ):
3347
3353
if self ._compound_props .get (prop , None ) is None :
3348
3354
# Init compound objects
3349
- self ._compound_props [prop ] = validator .data_class (_parent = self )
3355
+ self ._compound_props [prop ] = validator .data_class (
3356
+ _parent = self , plotly_name = prop
3357
+ )
3358
+ # Update plotly_name value in case the validator applies
3359
+ # non-standard name (e.g. imagedefaults instead of image)
3360
+ self ._compound_props [prop ]._plotly_name = prop
3350
3361
3351
3362
return validator .present (self ._compound_props [prop ])
3352
- elif isinstance (validator , CompoundArrayValidator ):
3363
+ elif isinstance (validator , ( CompoundArrayValidator , BaseDataValidator ) ):
3353
3364
if self ._compound_array_props .get (prop , None ) is None :
3354
3365
# Init list of compound objects
3355
3366
self ._compound_array_props [prop ] = [
0 commit comments