#!/usr/bin/env python

import wx
import vtk

###INTERIM CODE FOR PRODUCING A 360 degree spin movie
def drawStillImages(the_frame_parent):

    export_file_types = "TIFF|*.tif"
    
    save_name = wx.FileDialog(the_frame_parent, 'Save the image series as ..', '', '', export_file_types, wx.SAVE)
    if save_name.ShowModal() == wx.ID_OK:
        save_name.data_source_path = save_name.GetPath()
        
    else:
        print 'Write cancelled\n' 
        return          
    
    fname = save_name.data_source_path 

    for i in range(180):
        
        ren = the_frame_parent.ren
        widget = the_frame_parent.widget
        
        cam = ren.GetActiveCamera()
        cam.Azimuth(2)
        #renWin.SetSize(2300,2300)
        widget.Render()
        w2i = vtk.vtkWindowToImageFilter()
        writer = vtk.vtkJPEGWriter()
        w2i.SetInput(ren.GetRenderWindow())
        w2i.Update()
        writer.SetInputConnection(w2i.GetOutputPort())
        #prompt_user_input()
        widget.Render()
        #save_name = raw_input("Save file as ... :")
        writer.SetFileName("%s%04d.jpg" %(fname,i))
        #remove_prompt_user_input()
        widget.Render()
        writer.Write()
        print 'saved main window to %s%04d.tif sucessfully' %(fname,i)
