def start_recording(self):
# check that a dir has been specified
if self.txt_outputDir.IsEmpty():
msg = wx.MessageDialog(self, 'Specify the Output Directory', 'Error', wx.OK | wx.ICON_ERROR)
msg.ShowModal() == wx.ID_YES
msg.Destroy()
self.recording = False
else: # a directory was specified
self.outputDir = self.txt_outputDir.GetValue()
self.t = 0
# check if path exists - ie may be saving over data
if os.path.exists(self.outputDir):
msg = wx.MessageDialog(self, 'Output Directory Exists - Overwrite Data?', 'Yes or No', wx.YES_NO | wx.ICON_QUESTION)
result = msg.ShowModal() == wx.ID_YES
msg.Destroy()
# overwrite the data
if result == True:
# delete the dir
shutil.rmtree(self.outputDir)
# re-make dir
os.mkdir(self.outputDir)
# do not overwrite the data
else: # result == False
self.recording = False
self.txt_outputDir.SetFocus()
# no directory so make one
else:
os.mkdir(self.outputDir)
评论列表
文章目录