2525from Dialog import *
2626from Mapping import *
2727from NotePage import *
28- from tkinter import filedialog
28+ import tkFileDialog as filedialog
29+ import os
30+ import sys
31+ from time import sleep
32+ import time
33+ import datetime
2934
3035class Timelapse ( BasicNotepage ):
3136 def BuildPage ( self ):
@@ -189,14 +194,9 @@ def ToggleTL ( self ):
189194 self .Started = not self .Started
190195 if self .Started :
191196 self .StartButton .configure (text = 'Stop' )
197+ self .LoopTimeLapse ()
192198 else :
193199 self .StartButton .configure (text = 'Start' )
194- self .camera .capture (str (self .Directory + self .BaseTxt .get ()+ self .ExtensionCombo .get ()))
195- self .Started = not self .Started
196- if self .Started :
197- self .StartButton .configure (text = 'Stop' )
198- else :
199- self .StartButton .configure (text = 'Start' )
200200 pass
201201 def Clear ( self ):
202202 pass
@@ -210,37 +210,38 @@ def StartDelayCapture ( self ):
210210 def Reset ( self ):
211211 pass
212212
213- '''
214-
215- Label(f,text='Custom name').grid(row=1,column=0,sticky='E')
216-
217-
218-
219- self.Eexecute = Button(f,text='Ok',width=10, command=self.ReadEntry)
220- self.Eexecute.grid(row=1,column=3,sticky='W')
221-
222- self.Button2 = Button(f,text='Clear',width=10, command=self.Clear)
223- self.Button2.grid(row=1,column=4,sticky='W')
224-
225-
226- self.LowLightCaptureButton = Button(f,text='Low Light',width=15, \
227-
228- command=self.CaptureLowLight)
229- self.LowLightCaptureButton.grid(row=3,column=0,sticky='W')
230-
231- self.StartDelayCaptureButton = Button(f,text='Delay Capture',width=15, \
232- command=self.StartDelayCapture)
233-
234- self.StartDelayCaptureButton.grid(row=3,column=1,sticky='W')
235-
236- self.combo = Combobox(f)
237- self.combo['values']= (1, 2, 3, 4, 5, "Text")
238-
239- self.combo.current(1) #set the selected item
213+ def LoopTimeLapse ( self ):
214+ steps = int (self .EndTxt .get ())
215+ folder = str (self .Directory )
216+ filename = self .BaseTxt .get ()
217+ interval = int (self .DelayTxt .get ())
218+ # Run the timelapse loop
219+ for i in range (steps ):
220+
221+ t1 = time .time ()
222+ print ('Cycle ' + str (i ))
223+
224+ #Side Light
225+ # turn the side LEDs on
226+ os .system ('python turnONs.py' )
227+
228+ datestr = datetime .datetime .now ().strftime ("%Y-%m-%d-%H_%M_%S" )
229+ fname = os .path .join (folder , datestr + "_" + filename + "_%04d.png" % (i ))
230+ self .camera .capture (fname , 'png' )
231+
232+ #turn the LEDs off
233+ os .system ('python turnOFFs.py' )
234+
235+ elapsed = time .time ()- t1
236+
237+ # print some relevant information
238+ print ('Elapsed cycle time: ' + str (elapsed ))
239+ #e = self.camera.exposure_speed
240+ #print('Effective camera shutter speed :' + str(e) + '\n')
240241
241- self.combo.grid( row=4, column=0)
242-
243- '''
242+ sleep ( interval - elapsed ) ## waiting time between cycles
243+
244+ pass
244245
245246
246247
0 commit comments