This repository has been archived by the owner on Sep 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
spidrecordwindow.py
47 lines (34 loc) · 1.53 KB
/
spidrecordwindow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt4 import QtGui
from PyQt4 import QtCore
from AudioRecorder import AudioRecorderThread
from ui.ui_recordwindow import Ui_SPIDRecordWindow
class SPIDRecordWindow(QtGui.QDialog, Ui_SPIDRecordWindow):
def __init__(self, parent=None, s_id=None):
QtGui.QDialog.__init__(self, parent)
self.s_id = s_id
self.setupUi(self)
self.pushButtonStartRecording.clicked.connect(self.slotStartRecording)
self.pushButtonStopRecording.clicked.connect(self.slotStopRecording)
self.thread = AudioRecorderThread(self)
self.thread.finished.connect(self.slotRecordingFinished)
self.thread.finished.connect(self.parent().slotSampleRecordingFinished)
def slotStopRecording(self):
self.thread.exiting = True
self.hide()
def slotStartRecording(self):
if self.checkBoxTestingSample.isChecked():
# Testing
self.thread.setOutputFileName(self.parent().marf.get_next_testing_sample_path())
else:
# Training
self.thread.setOutputFileName(self.parent().marf.get_next_training_sample_path(self.s_id))
self.parent()._fileName = self.thread.outputFileName
print self.parent()._fileName
self.thread.start()
self.pushButtonStartRecording.setEnabled(False)
self.pushButtonStopRecording.setEnabled(True)
def slotRecordingFinished(self):
self.pushButtonStopRecording.setEnabled(False)
self.pushButtonStartRecording.setEnabled(True)