def __init__(self, input_fn): GladeApp.__init__(self, "sympler_viewer.glade", "view_window") self.input_parser = SymplerInputParser(input_fn) self.renderer = SymplerRenderer() self.renderer.setGeometry("geometry.vtk") self.renderer.setTimesteps(self.input_parser.positionFilenames()) self.renderer.selectTimestep(0) self.scale.set_range(0, self.renderer.size() - 1) self.vtk_view = self.renderer.ren_win self.vtk_view.show() self.vbox_view.pack_start(self.vtk_view) self.vbox_view.reorder_child(self.vtk_view, 0)
class SymplerViewer(GladeApp): def __init__(self, input_fn): GladeApp.__init__(self, "sympler_viewer.glade", "view_window") self.input_parser = SymplerInputParser(input_fn) self.renderer = SymplerRenderer() self.renderer.setGeometry("geometry.vtk") self.renderer.setTimesteps(self.input_parser.positionFilenames()) self.renderer.selectTimestep(0) self.scale.set_range(0, self.renderer.size() - 1) self.vtk_view = self.renderer.ren_win self.vtk_view.show() self.vbox_view.pack_start(self.vtk_view) self.vbox_view.reorder_child(self.vtk_view, 0) def on_scale_value_changed(self, range, *args): if round(range.get_value()) != self.renderer.timestep: self.renderer.selectTimestep(int(round(range.get_value()))) def on_play_button_clicked(self, button, *args): gobject.timeout_add(1000, self.animation_timer) def on_stop_button_clicked(self, button, *args): pass def animation_timer(self): if self.renderer.timestep == self.renderer.size() - 1: return gtk.FALSE else: self.scale.set_value(self.renderer.timestep + 1) return gtk.TRUE
def __init__(self, input_fn): GladeApp.__init__(self, "sympler_viewer.glade", "view_window") self.input_parser = SymplerInputParser(input_fn) self.renderer = SymplerRenderer() self.renderer.setGeometry("geometry.vtk") self.renderer.setTimesteps(self.input_parser.positionFilenames()) self.renderer.selectTimestep(0) self.scale.set_range(0, self.renderer.size()-1) self.vtk_view = self.renderer.ren_win self.vtk_view.show() self.vbox_view.pack_start(self.vtk_view) self.vbox_view.reorder_child(self.vtk_view, 0)
class SymplerViewer(GladeApp): def __init__(self, input_fn): GladeApp.__init__(self, "sympler_viewer.glade", "view_window") self.input_parser = SymplerInputParser(input_fn) self.renderer = SymplerRenderer() self.renderer.setGeometry("geometry.vtk") self.renderer.setTimesteps(self.input_parser.positionFilenames()) self.renderer.selectTimestep(0) self.scale.set_range(0, self.renderer.size()-1) self.vtk_view = self.renderer.ren_win self.vtk_view.show() self.vbox_view.pack_start(self.vtk_view) self.vbox_view.reorder_child(self.vtk_view, 0) def on_scale_value_changed(self, range, *args): if round(range.get_value()) != self.renderer.timestep: self.renderer.selectTimestep(int(round(range.get_value()))) def on_play_button_clicked(self, button, *args): gobject.timeout_add(1000, self.animation_timer) def on_stop_button_clicked(self, button, *args): pass def animation_timer(self): if self.renderer.timestep == self.renderer.size()-1: return gtk.FALSE else: self.scale.set_value(self.renderer.timestep+1) return gtk.TRUE