<s> import Gaffer <EOL> import GafferUI <EOL> class FileSystemPathPlugValueWidget ( GafferUI . PathPlugValueWidget ) : <EOL> def __init__ ( self , plug , path = None , parenting = None ) : <EOL> GafferUI . PathPlugValueWidget . __init__ ( <EOL> self , <EOL> plug , <EOL> path , <EOL> parenting = parenting <EOL> ) <EOL> self . _updateFromPlug ( ) <EOL> self . __plugMetadataChangedConnection = Gaffer . Metadata . plugValueChangedSignal ( ) . connect ( Gaffer . WeakMethod ( self . __plugMetadataChanged ) ) <EOL> def getToolTip ( self ) : <EOL> result = GafferUI . PathPlugValueWidget . getToolTip ( self ) <EOL> extensions = self . __extensions ( ) <EOL> if extensions : <EOL> result += "<STR_LIT>" + "<STR_LIT:U+002CU+0020>" . join ( extensions ) <EOL> return result <EOL> def _pathChooserDialogue ( self ) : <EOL> dialogue = GafferUI . PathPlugValueWidget . _pathChooserDialogue ( self ) <EOL> if Gaffer . Metadata . plugValue ( self . getPlug ( ) , "<STR_LIT>" ) : <EOL> columns = dialogue . pathChooserWidget ( ) . pathListingWidget ( ) . getColumns ( ) <EOL> columns . append ( GafferUI . PathListingWidget . StandardColumn ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> dialogue . pathChooserWidget ( ) . pathListingWidget ( ) . setColumns ( columns ) <EOL> return dialogue <EOL> def _updateFromPlug ( self ) : <EOL> GafferUI . PathPlugValueWidget . _updateFromPlug ( self ) <EOL> includeSequences = Gaffer . Metadata . plugValue ( self . getPlug ( ) , "<STR_LIT>" ) or False <EOL> self . path ( ) . setFilter ( <EOL> Gaffer . FileSystemPath . createStandardFilter ( <EOL> self . __extensions ( ) , <EOL> Gaffer . Metadata . plugValue ( self . getPlug ( ) , "<STR_LIT>" ) or "<STR_LIT>" , <EOL> includeSequenceFilter = includeSequences , <EOL> ) <EOL> ) <EOL> self . path ( ) . setIncludeSequences ( includeSequences ) <EOL> def _setPlugFromPath ( self , path ) : <EOL> if Gaffer . Metadata . plugValue ( self . getPlug ( ) , "<STR_LIT>" ) : <EOL> sequence = path . fileSequence ( ) <EOL> if sequence : <EOL> self . getPlug ( ) . setValue ( str ( sequence ) ) <EOL> return <EOL> GafferUI . PathPlugValueWidget . _setPlugFromPath ( self , path ) <EOL> def __plugMetadataChanged ( self , nodeTypeId , plugPath , key , plug ) : <EOL> if self . getPlug ( ) is None : <EOL> return <EOL> if plug is not None and not plug . isSame ( self . getPlug ( ) ) : <EOL> return <EOL> if not self . getPlug ( ) . node ( ) . isInstanceOf ( nodeTypeId ) : <EOL> return <EOL> if key . startswith ( "<STR_LIT>" ) : <EOL> self . _updateFromPlug ( ) <EOL> def __extensions ( self ) : <EOL> if self . getPlug ( ) is None : <EOL> return [ ] <EOL> extensions = Gaffer . Metadata . plugValue ( self . getPlug ( ) , "<STR_LIT>" ) or [ ] <EOL> if isinstance ( extensions , str ) : <EOL> extensions = extensions . split ( ) <EOL> else : <EOL> extensions = list ( extensions ) <EOL> return extensions </s>
