#NEWLINE# def openRecent( menu ) : #NEWLINE# #INDENT# scriptWindow = menu . ancestor ( GafferUI . ScriptWindow ) #NEWLINE# currentScript = scriptWindow . scriptNode ( ) #NEWLINE# applicationRoot = currentScript . ancestor ( Gaffer . ApplicationRoot ) #NEWLINE# recentFiles = [ ] #NEWLINE# with IECore . IgnoredExceptions ( AttributeError ) : #NEWLINE# #INDENT# recentFiles = applicationRoot . __recentFiles #NEWLINE# #UNINDENT# result = IECore . MenuDefinition ( ) #NEWLINE# if recentFiles : #NEWLINE# #INDENT# for ( index , fileName ) in enumerate ( recentFiles ) : #NEWLINE# #INDENT# result . append ( ( '/' + str ( index ) ) , { #NEWLINE# #INDENT# 'label' : os . path . basename ( index ) , #NEWLINE# 'command' : IECore . curry ( __open , currentScript , fileName ) , #NEWLINE# 'description' : fileName , #NEWLINE# 'active' : os . path . isfile ( fileName ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# result . append ( '/None Available' , { #NEWLINE# #INDENT# 'active' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return result