@@ -150,31 +150,25 @@ def onInit(self): # pylint: disable=invalid-name
150150 pass
151151
152152 # Set enabled condition for various controls
153+ # Load any skin-defined enable condition overrides
154+ enable_overrides : dict [int , str ] = {}
155+ tree = self .data_func .get_overrides_skin ()
156+ for elem in tree .findall ("enable" ):
157+ control_id = elem .get ("id" )
158+ if control_id and elem .text :
159+ enable_overrides [int (control_id )] = elem .text
160+
153161 has111 = True
154- try :
155- self .getControl (111 ).setEnableCondition (
156- "String.IsEmpty(Container(211).ListItem.Property(LOCKED))"
157- )
158- except :
159- has111 = False
160- try :
161- self .getControl (302 ).setEnableCondition (
162- "String.IsEmpty(Container(211).ListItem.Property(LOCKED))"
163- )
164- except :
165- pass
166- try :
167- self .getControl (307 ).setEnableCondition (
168- "String.IsEmpty(Container(211).ListItem.Property(LOCKED))"
169- )
170- except :
171- pass
172- try :
173- self .getControl (401 ).setEnableCondition (
174- "String.IsEmpty(Container(211).ListItem.Property(LOCKED))"
175- )
176- except :
177- pass
162+ locked_condition = "String.IsEmpty(Container(211).ListItem.Property(LOCKED))"
163+ for control_id in (111 , 302 , 307 , 401 ):
164+ condition = locked_condition
165+ if control_id in enable_overrides :
166+ condition = f"{ locked_condition } + [{ enable_overrides [control_id ]} ]"
167+ try :
168+ self .getControl (control_id ).setEnableCondition (condition )
169+ except :
170+ if control_id == 111 :
171+ has111 = False
178172
179173 # Set button labels
180174 if self .nolabels == "false" :
0 commit comments