<s> """<STR_LIT>""" <EOL> import sys <EOL> from os . path import isfile <EOL> from pyface . api import FileDialog , OK <EOL> from pyface . action . api import Action <EOL> from mayavi . plugins . script import get_imayavi <EOL> from mayavi . core . common import error , exception <EOL> class SaveVisualization ( Action ) : <EOL> """<STR_LIT>""" <EOL> tooltip = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> def perform ( self , event ) : <EOL> """<STR_LIT>""" <EOL> wildcard = '<STR_LIT>' + FileDialog . WILDCARD_ALL <EOL> dialog = FileDialog ( parent = self . window . control , <EOL> title = '<STR_LIT>' , <EOL> action = '<STR_LIT>' , wildcard = wildcard <EOL> ) <EOL> if dialog . open ( ) == OK : <EOL> mv = get_imayavi ( self . window ) <EOL> mv . save_visualization ( dialog . path ) <EOL> class LoadVisualization ( Action ) : <EOL> """<STR_LIT>""" <EOL> tooltip = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> def perform ( self , event ) : <EOL> """<STR_LIT>""" <EOL> wildcard = '<STR_LIT>' + FileDialog . WILDCARD_ALL <EOL> parent = self . window . control <EOL> dialog = FileDialog ( parent = parent , <EOL> title = '<STR_LIT>' , <EOL> action = '<STR_LIT>' , wildcard = wildcard <EOL> ) <EOL> if dialog . open ( ) == OK : <EOL> if not isfile ( dialog . path ) : <EOL> error ( "<STR_LIT>" % dialog . path , parent ) <EOL> return <EOL> mv = get_imayavi ( self . window ) <EOL> mv . load_visualization ( dialog . path ) <EOL> class RunScript ( Action ) : <EOL> """<STR_LIT>""" <EOL> tooltip = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> def perform ( self , event ) : <EOL> """<STR_LIT>""" <EOL> wildcard = '<STR_LIT>' <EOL> parent = self . window . control <EOL> dialog = FileDialog ( parent = parent , <EOL> title = '<STR_LIT>' , <EOL> action = '<STR_LIT>' , wildcard = wildcard <EOL> ) <EOL> if dialog . open ( ) == OK : <EOL> if not isfile ( dialog . path ) : <EOL> error ( "<STR_LIT>" % dialog . path , parent ) <EOL> return <EOL> g = sys . modules [ '<STR_LIT:__main__>' ] . __dict__ <EOL> if '<STR_LIT>' not in g : <EOL> mv = get_imayavi ( self . window ) <EOL> g [ '<STR_LIT>' ] = mv <EOL> g [ '<STR_LIT>' ] = mv . engine <EOL> g [ '<STR_LIT>' ] = dialog . path <EOL> try : <EOL> exec ( compile ( <EOL> open ( dialog . path ) . read ( ) , dialog . path , '<STR_LIT>' ) , g , g <EOL> ) <EOL> except Exception as msg : <EOL> exception ( str ( msg ) ) </s>
