@@ -677,16 +677,18 @@ def _get_subentry(self) -> "Optional[EntryConstruct]":
677677 """Evaluate the conditional function to detect the type of the subentry"""
678678 obj = self .obj
679679 if obj is None :
680- self ._dvc_item = None # reset dvc_item, so that the subentries can correctly identify its parents dvc_item
681680 return None
681+
682+ metadata = get_gui_metadata (obj )
683+ if metadata is None :
684+ return None
685+
686+ ctx = metadata ["context" ]
687+ cond = evaluate (self .construct .condfunc , ctx )
688+ if cond :
689+ return self ._subentry_then
682690 else :
683- metadata = get_gui_metadata (obj )
684- ctx = metadata ["context" ] if metadata is not None else None
685- cond = evaluate (self .construct .condfunc , ctx )
686- if cond :
687- return self ._subentry_then
688- else :
689- return self ._subentry_else
691+ return self ._subentry_else
690692
691693 @property
692694 def obj_str (self ) -> str :
@@ -771,16 +773,18 @@ def _get_subentry(self) -> "Optional[EntryConstruct]":
771773 """Evaluate the conditional function to detect the type of the subentry"""
772774 obj = self .obj
773775 if obj is None :
774- self ._dvc_item = None # reset dvc_item, so that the subentries can correctly identify its parents dvc_item
775776 return None
777+
778+ metadata = get_gui_metadata (obj )
779+ if metadata is None :
780+ return None
781+
782+ ctx = metadata ["context" ]
783+ key = evaluate (self .construct .keyfunc , ctx )
784+ if key in self ._subentry_cases :
785+ return self ._subentry_cases [key ]
776786 else :
777- metadata = get_gui_metadata (obj )
778- ctx = metadata ["context" ] if metadata is not None else None
779- key = evaluate (self .construct .keyfunc , ctx )
780- if key in self ._subentry_cases :
781- return self ._subentry_cases [key ]
782- else :
783- return self ._subentry_default
787+ return self ._subentry_default
784788
785789 @property
786790 def obj_str (self ) -> str :
@@ -1262,14 +1266,16 @@ def _get_subentry(self) -> "Optional[EntryConstruct]":
12621266 """Evaluate the conditional function to detect the type of the subentry"""
12631267 obj = self .obj
12641268 if obj is None :
1265- self ._dvc_item = None # reset dvc_item, so that the subentries can correctly identify its parents dvc_item
12661269 return None
1267- else :
1268- metadata = get_gui_metadata (obj )
1269- ctx = metadata ["context" ] if metadata is not None else None
1270- parsebuildfrom = evaluate (self .construct .parsebuildfrom , ctx )
1271- subentry = self ._subentries [parsebuildfrom ]
1272- return subentry
1270+
1271+ metadata = get_gui_metadata (obj )
1272+ if metadata is None :
1273+ return None
1274+
1275+ ctx = metadata ["context" ]
1276+ parsebuildfrom = evaluate (self .construct .parsebuildfrom , ctx )
1277+ subentry = self ._subentries [parsebuildfrom ]
1278+ return subentry
12731279
12741280 @property
12751281 def obj_str (self ) -> str :
@@ -1343,21 +1349,21 @@ def _get_subentry(self) -> "Optional[EntryConstruct]":
13431349 """Evaluate the conditional function to detect the type of the subentry"""
13441350 obj = self .obj
13451351 if obj is None :
1346- self ._dvc_item = None # reset dvc_item, so that the subentries can correctly identify its parents dvc_item
13471352 return None
1348- else :
1349- metadata = get_gui_metadata (obj )
1350- if metadata is None :
1351- return None
1352- # we are not interested in the metadata of the
1353- # cs.Select, but of its childs
1354- metadata = metadata ["child_gui_metadata" ]
1355- if metadata is None :
1356- return None
1357- if id (metadata ["construct" ]) not in self ._subentries :
1358- print ("error" )
1359- subentry = self ._subentries [id (metadata ["construct" ])]
1360- return subentry
1353+
1354+ metadata = get_gui_metadata (obj )
1355+ if metadata is None :
1356+ return None
1357+
1358+ # we are not interested in the metadata of the
1359+ # cs.Select, but of its childs
1360+ metadata = metadata ["child_gui_metadata" ]
1361+ if metadata is None :
1362+ return None
1363+ if id (metadata ["construct" ]) not in self ._subentries :
1364+ print ("error" )
1365+ subentry = self ._subentries [id (metadata ["construct" ])]
1366+ return subentry
13611367
13621368 @property
13631369 def obj_str (self ) -> str :
0 commit comments