Public Member Functions | Public Attributes | List of all members
lib.draw.SeqsDataEntry Class Reference
Inheritance diagram for lib.draw.SeqsDataEntry:

Public Member Functions

def __init__ (self, allowed_extensions=['.mp4', avi, args, kwargs)
def drawButtonFrame (self, cancel_label, submit_label)
def incrementStartTime (self, duration_h=1.0)
def decrementStartTime (self, duration_h=1.0)
def autoSearchStartTime (self)
- Public Member Functions inherited from lib.draw.DataEntry
def __init__ (self, instructions='', instructions2='', submit_label='Enter', cancel_label='Cancel', rows={}, sites=None, config=None, sites_selection_depth=1, dropdowns={}, multiSelectionListBoxes={})
def submitCallback (self)
def cancelCallback (self)
def getEntries (self)
def getDropDowns (self)
def getMSLBs (self)
def getSiteSelection (self)
def getCamViewSelection (self)
def getSequenceSelection (self)
def getSelectedSite (self)
def getSelectedCamView (self)
def setEntry (self, label, value)
def updateCameraOptions (self, index, value, op)
def updateSequenceOptions (self, index, value, op)
def drawButtonFrame (self, cancel_label, submit_label)

Public Attributes

- Public Attributes inherited from lib.draw.DataEntry
 Style. More...
 Data. More...
 Handle regular entries. More...
 Handle dropdown menu items. More...
 Handle multi-selection lists. More...

Detailed Description

Definition at line 920 of file

Constructor & Destructor Documentation

◆ __init__()

def lib.draw.SeqsDataEntry.__init__ (   self,
  allowed_extensions = ['.mp4',

Definition at line 921 of file

921  def __init__(self, allowed_extensions=['.mp4', '.avi'], *args, **kwargs):
922  self.allowed_extensions = allowed_extensions
923  DataEntry.__init__(self, *args, **kwargs)

Member Function Documentation

◆ autoSearchStartTime()

def lib.draw.SeqsDataEntry.autoSearchStartTime (   self)

Definition at line 950 of file

950  def autoSearchStartTime(self):
951  from datetime import datetime
952  try:
953  for first_file in sorted(os.listdir(os.path.join(self.getSelectedCamView().getBaseDirectory()))):
954  if(os.path.splitext(first_file)[-1].lower() in self.allowed_extensions): break
955  self.setEntry('startTime', datetime.fromtimestamp(os.path.getmtime(os.path.join(self.getSelectedCamView().getBaseDirectory(), first_file))).strftime('%Y-%m-%d %H:%M:%S'))
956  try:
957  import cv2
958  video_capture = cv2.VideoCapture(os.path.join(self.getSelectedCamView().getBaseDirectory(), first_file))
959  video_length = int(video_capture.get(cv2.CAP_PROP_FRAME_COUNT))
960  fps = video_capture.get(cv2.CAP_PROP_FPS)
961  '''count = 0
962  while(True):
963  # Capture frame-by-frame
964  ret, frame =
965  if(not ret): break
966  count += 1'''
967  video_capture.release()
968  cv2.destroyAllWindows()
969  if(int(video_length/float(fps))):
970  self.setEntry('duration', 'auto ('+str(int(video_length/float(fps)))+')')
971  self.setEntry('durationUnit', 's')
972  except: tvaLib.printWarning('Failed to detect video duration')
973  except: tvaLib.printWarning('Could not find video sequence on disk to auto-fill time information')

◆ decrementStartTime()

def lib.draw.SeqsDataEntry.decrementStartTime (   self,
  duration_h = 1.0 

Definition at line 943 of file

943  def decrementStartTime(self, duration_h=1.0):
944  from datetime import datetime, timedelta
945  try: t = datetime.strptime(self.getEntries()['startTime'], '%Y-%m-%d %H:%M:%S')
946  except:
947  tvaLib.printWarning('Time format in startTime field is invalid. Use the "2010-01-31 10:00:00" format.')
948  return False
949  self.setEntry('startTime', (t-timedelta(0,0,0,0,0,duration_h)).strftime('%Y-%m-%d %H:%M:%S'))

◆ drawButtonFrame()

def lib.draw.SeqsDataEntry.drawButtonFrame (   self,

Definition at line 926 of file

926  def drawButtonFrame(self, cancel_label, submit_label):
927  from Tkinter import Button, Frame
928  self.buttonframe = Frame(self.root)
929  self.buttonframe.grid(columnspan=3)
930  Button(self.buttonframe, text='Auto-fill time', command=self.autoSearchStartTime,,, column=0)
931  Button(self.buttonframe, text='T+h', command=self.incrementStartTime,,, column=1)
932  Button(self.buttonframe, text='T-h', command=self.decrementStartTime,,, column=2)
933  Button(self.buttonframe, text=cancel_label, command=self.cancelCallback,,, column=3)
934  Button(self.buttonframe, text=submit_label, command=self.submitCallback,,, column=4)

◆ incrementStartTime()

def lib.draw.SeqsDataEntry.incrementStartTime (   self,
  duration_h = 1.0 

Definition at line 936 of file

936  def incrementStartTime(self, duration_h=1.0):
937  from datetime import datetime, timedelta
938  try: t = datetime.strptime(self.getEntries()['startTime'], '%Y-%m-%d %H:%M:%S')
939  except:
940  tvaLib.printWarning('Time format in startTime field is invalid. Use the "2010-01-31 10:00:00" format.')
941  return False
942  self.setEntry('startTime', (t+timedelta(0,0,0,0,0,duration_h)).strftime('%Y-%m-%d %H:%M:%S'))

Member Data Documentation

◆ allowed_extensions


Definition at line 922 of file

◆ buttonframe


Definition at line 928 of file

The documentation for this class was generated from the following file: