コード例 #1
0
ファイル: engine.py プロジェクト: kaizhao1123/My-Single-Seed
 def save_visualization(self, file_or_fname):
     """Given a file or a file name, this saves the current
     visualization to the file.
     """
     # Save the state of VTK's global warning display.
     o = vtk.vtkObject
     w = o.GetGlobalWarningDisplay()
     o.SetGlobalWarningDisplay(0) # Turn it off.
     try:
         #FIXME: This is for streamline seed point widget position which
         #does not get serialized correctly
         if is_old_pipeline():
             state_pickler.dump(self, file_or_fname)
         else:
             state = state_pickler.get_state(self)
             st = state.scenes[0].children[0].children[0].children[4]
             l_pos = st.seed.widget.position
             st.seed.widget.position = [pos.item() for pos in l_pos]
             saved_state = state_pickler.dumps(state)
             file_or_fname.write(saved_state)
     except (IndexError, AttributeError):
         state_pickler.dump(self, file_or_fname)
     finally:
         # Reset the warning state.
         o.SetGlobalWarningDisplay(w)
コード例 #2
0
ファイル: engine.py プロジェクト: PerryZh/mayavi
 def save_visualization(self, file_or_fname):
     """Given a file or a file name, this saves the current
     visualization to the file.
     """
     # Save the state of VTK's global warning display.
     o = vtk.vtkObject
     w = o.GetGlobalWarningDisplay()
     o.SetGlobalWarningDisplay(0) # Turn it off.
     try:
         #FIXME: This is for streamline seed point widget position which
         #does not get serialized correctly
         if is_old_pipeline():
             state_pickler.dump(self, file_or_fname)
         else:
             state = state_pickler.get_state(self)
             st = state.scenes[0].children[0].children[0].children[4]
             l_pos = st.seed.widget.position
             st.seed.widget.position = [pos.item() for pos in l_pos]
             saved_state = state_pickler.dumps(state)
             file_or_fname.write(saved_state)
     except (IndexError, AttributeError):
         state_pickler.dump(self, file_or_fname)
     finally:
         # Reset the warning state.
         o.SetGlobalWarningDisplay(w)
コード例 #3
0
 def __getstate__(self):
     """Allows standard pickle to work via the state_pickler.
     """
     return state_pickler.dumps(self)
コード例 #4
0
ファイル: engine.py プロジェクト: kaizhao1123/My-Single-Seed
 def __getstate__(self):
     return state_pickler.dumps(self)
コード例 #5
0
ファイル: tvtk_scene.py プロジェクト: giapdangle/mayavi
 def __getstate__(self):
     return state_pickler.dumps(self)
コード例 #6
0
ファイル: base.py プロジェクト: B-Rich/mayavi
 def __getstate__(self):
     """Allows standard pickle to work via the state_pickler.
     """
     return state_pickler.dumps(self)