<s> """<STR_LIT>""" <EOL> import os <EOL> from os . path import join , abspath , dirname <EOL> from mayavi . scripts import mayavi2 <EOL> from mayavi . sources . vtk_file_reader import VTKFileReader <EOL> from mayavi . modules . outline import Outline <EOL> from mayavi . modules . contour_grid_plane import ContourGridPlane <EOL> from pyface . timer . api import Timer <EOL> class Pollster ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , fname , data ) : <EOL> """<STR_LIT>""" <EOL> self . fname = fname <EOL> self . data = data <EOL> self . last_stat = os . stat ( fname ) <EOL> def poll_file ( self ) : <EOL> s = os . stat ( self . fname ) <EOL> if s [ - <NUM_LIT:2> ] == self . last_stat [ - <NUM_LIT:2> ] : <EOL> return <EOL> else : <EOL> self . last_stat = s <EOL> self . update_pipeline ( ) <EOL> def update_pipeline ( self ) : <EOL> """<STR_LIT>""" <EOL> print ( "<STR_LIT>" ) <EOL> d = self . data <EOL> d . reader . modified ( ) <EOL> d . update ( ) <EOL> d . data_changed = True <EOL> def setup_data ( fname ) : <EOL> """<STR_LIT>""" <EOL> mayavi . new_scene ( ) <EOL> d = VTKFileReader ( ) <EOL> d . initialize ( fname ) <EOL> mayavi . add_source ( d ) <EOL> return d <EOL> def view_data ( ) : <EOL> """<STR_LIT>""" <EOL> o = Outline ( ) <EOL> mayavi . add_module ( o ) <EOL> c = ContourGridPlane ( ) <EOL> mayavi . add_module ( c ) <EOL> c . grid_plane . position = <NUM_LIT:16> <EOL> c . module_manager . scalar_lut_manager . show_scalar_bar = True <EOL> @ mayavi2 . standalone <EOL> def main ( ) : <EOL> fname = join ( mayavi2 . get_data_dir ( abspath ( dirname ( __file__ ) ) ) , <EOL> '<STR_LIT>' ) <EOL> data = setup_data ( fname ) <EOL> view_data ( ) <EOL> p = Pollster ( fname , data ) <EOL> timer = Timer ( <NUM_LIT:1000> , p . poll_file ) <EOL> mayavi2 . savedtimerbug = timer <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
