Package Pmv :: Module videoCommands
[hide private]
[frames] | no frames]

Source Code for Module Pmv.videoCommands

 1   
 2  import weakref 
 3  from Pmv.mvCommand import MVCommand 
 4  from ViewerFramework.VFCommand import CommandGUI 
 5  from DejaVu.videoRecorder import Recorder 
 6   
 7  try: 
 8      from DejaVu.Camera import RecordableCamera 
 9      isrecordable = True 
10  except: 
11      isrecordable = False 
12   
13 -class VideoCommand(MVCommand):
14 """This command uses DajaVu.Camera.RecordableCamera functionality to make mpg video.""" 15
16 - def __init__(self):
17 18 MVCommand.__init__(self) 19 self.recorder = None 20 self.gui = None 21 self.camera = None
22 23
24 - def guiCallback(self):
25 msg = "Camera does not support movie recording" 26 if isrecordable: 27 if not isinstance(self.vf.GUI.VIEWER.cameras[0], RecordableCamera): 28 self.vf.warningMsg(msg) 29 return 30 else: 31 self.vf.warningMsg(msg) 32 return 33 self.camera = weakref.ref(self.vf.GUI.VIEWER.cameras[0]) 34 if self.recorder: 35 self.recorder.buildForm() 36 else: 37 if not hasattr(self.camera, "videoRecorder"): 38 self.camera().videoRecorder = None 39 40 if self.camera().videoRecorder: 41 self.recorder = self.camera().videoRecorder 42 else: 43 filename = "out.mpg" 44 self.recorder = Recorder(self.vf.GUI.ROOT, 45 filetypes=[("MPG", ".mpg")], 46 fileName = filename, camera=self.camera()) 47 self.camera().videoRecorder = self.recorder 48 self.gui = self.recorder.form
49 50 51 VideoCommandGUI = CommandGUI() 52 VideoCommandGUI.addMenuCommand('menuRoot', '3D Graphics','Video Recorder', 53 index = 6) 54