From 90b599d65e0d035f35910748cf3187d1bd265486 Mon Sep 17 00:00:00 2001 From: chepo Date: Wed, 28 Nov 2018 23:02:49 +0300 Subject: [PATCH] update timelapse --- Source/Timelapse.py | 75 +++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/Source/Timelapse.py b/Source/Timelapse.py index 6f89af9..eb2c17e 100644 --- a/Source/Timelapse.py +++ b/Source/Timelapse.py @@ -25,7 +25,12 @@ from Dialog import * from Mapping import * from NotePage import * -from tkinter import filedialog +import tkFileDialog as filedialog +import os +import sys +from time import sleep +import time +import datetime class Timelapse ( BasicNotepage ): def BuildPage ( self ): @@ -189,14 +194,9 @@ def ToggleTL ( self ): self.Started= not self.Started if self.Started: self.StartButton.configure(text='Stop') + self.LoopTimeLapse() else: self.StartButton.configure(text='Start') - self.camera.capture(str(self.Directory+self.BaseTxt.get()+self.ExtensionCombo.get())) - self.Started= not self.Started - if self.Started: - self.StartButton.configure(text='Stop') - else: - self.StartButton.configure(text='Start') pass def Clear ( self ): pass @@ -210,37 +210,38 @@ def StartDelayCapture ( self ): def Reset ( self ): pass -''' - - Label(f,text='Custom name').grid(row=1,column=0,sticky='E') - - - - self.Eexecute = Button(f,text='Ok',width=10, command=self.ReadEntry) - self.Eexecute.grid(row=1,column=3,sticky='W') - - self.Button2 = Button(f,text='Clear',width=10, command=self.Clear) - self.Button2.grid(row=1,column=4,sticky='W') - - - self.LowLightCaptureButton = Button(f,text='Low Light',width=15, \ - - command=self.CaptureLowLight) - self.LowLightCaptureButton.grid(row=3,column=0,sticky='W') - - self.StartDelayCaptureButton = Button(f,text='Delay Capture',width=15, \ - command=self.StartDelayCapture) - - self.StartDelayCaptureButton.grid(row=3,column=1,sticky='W') - - self.combo = Combobox(f) - self.combo['values']= (1, 2, 3, 4, 5, "Text") - - self.combo.current(1) #set the selected item + def LoopTimeLapse ( self ): + steps=int(self.EndTxt.get()) + folder=str(self.Directory) + filename=self.BaseTxt.get() + interval=int(self.DelayTxt.get()) + # Run the timelapse loop + for i in range(steps): + + t1 = time.time() + print('Cycle ' + str(i)) + + #Side Light + # turn the side LEDs on + os.system('python turnONs.py') + + datestr = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") + fname = os.path.join(folder, datestr + "_" + filename + "_%04d.png"%(i)) + self.camera.capture(fname, 'png') + + #turn the LEDs off + os.system('python turnOFFs.py') + + elapsed = time.time()-t1 + + # print some relevant information + print('Elapsed cycle time: ' + str(elapsed)) + #e = self.camera.exposure_speed + #print('Effective camera shutter speed :' + str(e) + '\n') - self.combo.grid( row=4, column=0) - - ''' + sleep(interval-elapsed) ## waiting time between cycles + + pass