<s> import os <EOL> import IECore <EOL> import Gaffer <EOL> import GafferUI <EOL> class AboutWindow ( GafferUI . Window ) : <EOL> def __init__ ( self , about , parenting = None ) : <EOL> GafferUI . Window . __init__ ( self , title = "<STR_LIT>" + about . name ( ) , sizeMode = GafferUI . Window . SizeMode . Manual , borderWidth = <NUM_LIT:6> , parenting = parenting ) <EOL> self . __linkActivatedConnections = [ ] <EOL> with self : <EOL> with GafferUI . TabbedContainer ( ) : <EOL> with GafferUI . ListContainer ( <EOL> GafferUI . ListContainer . Orientation . Vertical , <EOL> spacing = <NUM_LIT:10> , <EOL> borderWidth = <NUM_LIT:10> , <EOL> parenting = { "<STR_LIT:label>" : "<STR_LIT>" } , <EOL> ) : <EOL> GafferUI . Spacer ( <EOL> IECore . V2i ( <NUM_LIT:1> ) , <EOL> parenting = { "<STR_LIT>" : True } <EOL> ) <EOL> GafferUI . Image ( <EOL> "<STR_LIT>" , <EOL> parenting = { "<STR_LIT>" : GafferUI . HorizontalAlignment . Center } <EOL> ) <EOL> text = "<STR_LIT>" % ( <EOL> about . url ( ) , <EOL> about . url ( ) , <EOL> about . versionString ( ) , <EOL> ) <EOL> self . __label ( <EOL> text , <EOL> horizontalAlignment = GafferUI . HorizontalAlignment . Center , <EOL> parenting = { "<STR_LIT>" : GafferUI . Label . HorizontalAlignment . Center } , <EOL> ) <EOL> GafferUI . Spacer ( <EOL> IECore . V2i ( <NUM_LIT:1> ) , <EOL> parenting = { "<STR_LIT>" : True } <EOL> ) <EOL> self . __label ( <EOL> "<STR_LIT>" % about . copyright ( ) . replace ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> parenting = { "<STR_LIT>" : GafferUI . Label . HorizontalAlignment . Center } , <EOL> ) <EOL> with GafferUI . ListContainer ( <EOL> GafferUI . ListContainer . Orientation . Vertical , <EOL> spacing = <NUM_LIT:10> , <EOL> borderWidth = <NUM_LIT:10> , <EOL> parenting = { "<STR_LIT:label>" : "<STR_LIT>" } , <EOL> ) : <EOL> license = "<STR_LIT>" . join ( open ( os . path . expandvars ( about . license ( ) ) ) . readlines ( ) ) <EOL> with GafferUI . ScrolledContainer ( <EOL> horizontalMode = GafferUI . ScrolledContainer . ScrollMode . Never , <EOL> verticalMode = GafferUI . ScrolledContainer . ScrollMode . Automatic , <EOL> borderWidth = <NUM_LIT:5> <EOL> ) : <EOL> self . __label ( "<STR_LIT>" + license + "<STR_LIT>" ) <EOL> dependencies = about . dependencies ( ) <EOL> if dependencies : <EOL> with GafferUI . ListContainer ( <EOL> GafferUI . ListContainer . Orientation . Vertical , <EOL> spacing = <NUM_LIT:10> , <EOL> borderWidth = <NUM_LIT:10> , <EOL> parenting = { "<STR_LIT:label>" : "<STR_LIT>" } , <EOL> ) : <EOL> with GafferUI . ScrolledContainer ( <EOL> horizontalMode = GafferUI . ScrolledContainer . ScrollMode . Never , <EOL> verticalMode = GafferUI . ScrolledContainer . ScrollMode . Always , <EOL> borderWidth = <NUM_LIT:5> <EOL> ) : <EOL> with GafferUI . ListContainer ( GafferUI . ListContainer . Orientation . Vertical , spacing = <NUM_LIT:5> , borderWidth = <NUM_LIT:10> ) : <EOL> text = "<STR_LIT>" % self . __wrapText ( about . dependenciesPreamble ( ) ) <EOL> for d in dependencies : <EOL> text += "<STR_LIT>" % d [ "<STR_LIT:name>" ] <EOL> if "<STR_LIT>" in d : <EOL> text += "<STR_LIT>" % self . __wrapText ( d [ "<STR_LIT>" ] ) <EOL> if "<STR_LIT>" in d : <EOL> text += "<STR_LIT>" % os . path . expandvars ( d [ "<STR_LIT>" ] ) <EOL> if "<STR_LIT:url>" in d : <EOL> if "<STR_LIT>" in d : <EOL> text += "<STR_LIT>" <EOL> text += "<STR_LIT>" % ( d [ "<STR_LIT:url>" ] , d [ "<STR_LIT:url>" ] ) <EOL> self . __label ( text ) <EOL> def __wrapText ( self , text ) : <EOL> return IECore . StringUtil . wrap ( text , <NUM_LIT> ) . replace ( '<STR_LIT:\n>' , "<STR_LIT>" ) <EOL> def __label ( self , text , ** kw ) : <EOL> header = "<STR_LIT>" <EOL> header += "<STR_LIT>" <EOL> header += "<STR_LIT>" <EOL> footer = "<STR_LIT>" <EOL> text = header + text + footer <EOL> label = GafferUI . Label ( text , ** kw ) <EOL> self . __linkActivatedConnections . append ( label . linkActivatedSignal ( ) . connect ( Gaffer . WeakMethod ( self . __linkActivated ) ) ) <EOL> return label <EOL> def __linkActivated ( self , label , url ) : <EOL> GafferUI . showURL ( url ) </s>
