Commit 600f339 1 parent a976f4d commit 600f339 Copy full SHA for 600f339
File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -739,12 +739,17 @@ def init_field(title):
739
739
def onload_script_visibility (params ):
740
740
title = params .get ('Script' , None )
741
741
if title :
742
- title_index = self .titles .index (title )
743
- visibility = title_index == self .script_load_ctr
744
- self .script_load_ctr = (self .script_load_ctr + 1 ) % len (self .titles )
745
- return gr .update (visible = visibility )
746
- else :
747
- return gr .update (visible = False )
742
+ try :
743
+ title_index = self .titles .index (title )
744
+ visibility = title_index == self .script_load_ctr
745
+ self .script_load_ctr = (self .script_load_ctr + 1 ) % len (self .titles )
746
+ return gr .update (visible = visibility )
747
+ except ValueError :
748
+ params ['Script' ] = None
749
+ massage = f'Cannot find Script: "{ title } "'
750
+ print (massage )
751
+ gr .Warning (massage )
752
+ return gr .update (visible = False )
748
753
749
754
self .infotext_fields .append ((dropdown , lambda x : gr .update (value = x .get ('Script' , 'None' ))))
750
755
self .infotext_fields .extend ([(script .group , onload_script_visibility ) for script in self .selectable_scripts ])
You can’t perform that action at this time.
0 commit comments