@@ -34,25 +34,30 @@ def show_popup(self):
34
34
def startBtn (self ):
35
35
session_prefix = self .download_prefix_text .toPlainText ()
36
36
self .save_last_prefix_text ()
37
- if self .isPrefix (session_prefix ):
37
+ if self .isPrefix (session_prefix ) and self . start_btn . isEnabled () :
38
38
try :
39
39
self .ws .send ("START_REC@@" + session_prefix )
40
40
self .label .setText ('Recording Started' )
41
41
self .label .adjustSize ()
42
+ self .start_btn .setEnabled (False )
43
+ self .stop_btn .setEnabled (True )
42
44
except Exception as e :
43
45
self .show_popup ()
44
46
self .save_last_prefix_text ()
45
47
sys .exit ()
46
48
47
49
def stopBtn (self ):
48
50
self .save_last_prefix_text ()
49
- self .label .setText ('Recording Stopped' )
50
- try :
51
- self .ws .send ("STOP_REC" )
52
- except Exception as e :
53
- self .show_popup ()
54
- self .save_last_prefix_text ()
55
- sys .exit ()
51
+ if self .stop_btn .isEnabled () and not self .start_btn .isEnabled ():
52
+ self .label .setText ('Recording Stopped' )
53
+ self .stop_btn .setEnabled (False )
54
+ self .start_btn .setEnabled (True )
55
+ try :
56
+ self .ws .send ("STOP_REC" )
57
+ except Exception as e :
58
+ self .show_popup ()
59
+ self .save_last_prefix_text ()
60
+ sys .exit ()
56
61
57
62
def statusBtn (self ):
58
63
self .save_last_prefix_text ()
@@ -157,6 +162,7 @@ def setupUi(self, MainWindow):
157
162
self .stop_btn .setFont (font )
158
163
self .stop_btn .setObjectName ("pushButton_2" )
159
164
self .stop_btn .clicked .connect (self .stopBtn )
165
+ self .stop_btn .setEnabled (False )
160
166
self .status_btn = QtWidgets .QPushButton (self .centralwidget )
161
167
self .status_btn .setGeometry (QtCore .QRect (280 , 200 , 161 , 61 ))
162
168
self .status_btn .setFont (font )
0 commit comments