#NEWLINE# def profileFormulaMenuCommand( cntlr ) : #NEWLINE# #INDENT# if ( ( cntlr . modelManager is None ) or ( cntlr . modelManager . modelXbrl is None ) ) : #NEWLINE# #INDENT# cntlr . addToLog ( 'No taxonomy loaded.' ) #NEWLINE# return #NEWLINE# #UNINDENT# profileReportFile = cntlr . uiFileDialog ( 'save' , title = _ ( 'arelle - Save Formula Profile Report' ) , initialdir = cntlr . config . setdefault ( 'formulaProfileReportDir' , '.' ) , filetypes = [ ( _ ( 'Profile report file .log' ) , '*.log' ) ] , defaultextension = '.log' ) #NEWLINE# if ( not profileReportFile ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# errMsg = '' #NEWLINE# maxRunTime = 0 #NEWLINE# while 1 : #NEWLINE# #INDENT# timeout = simpledialog . askstring ( _ ( 'arelle - Set formula run time limit' ) , _ ( '{0}You may enter the maximum number of minutes to run formulas.\n(Leave empty for no run time limitation.)' . format ( errMsg ) ) , parent = cntlr . parent ) #NEWLINE# if timeout : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# maxRunTime = float ( timeout ) #NEWLINE# break #NEWLINE# #UNINDENT# except ValueError as err : #NEWLINE# #INDENT# errMsg = ( str ( err ) + '\n\n' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# excludeCompileTime = messagebox . askyesno ( _ ( 'arelle - Exclude formula compile statistics' ) , _ ( 'Should formula compiling be excluded from the statistics?\n(Yes will make a separate compiling "pass" so that statistics include execution only.)' . format ( errMsg ) ) , parent = cntlr . parent ) #NEWLINE# cntlr . config [ 'formulaProfileReportDir' ] = os . path . dirname ( profileReportFile ) #NEWLINE# cntlr . saveConfig ( ) #NEWLINE# import threading #NEWLINE# thread = threading . Thread ( target = ( lambda c = cntlr , f = profileReportFile , t = maxRunTime , e = excludeCompileTime : backgroundProfileFormula ( c , f , t , e ) ) ) #NEWLINE# thread . daemon = True #NEWLINE# thread . start ( )