@@ -24,14 +24,15 @@ def __init__(self, **kwargs):
24
24
self .window .size = (50 , 50 )
25
25
self .window .clearcolor = (255 , 255 , 255 )
26
26
self .window .always_on_top = True
27
- self .PROC = None
27
+ self .record_proc = None
28
+ self .replay_proc = None
28
29
self .button = Button (background_normal = "assets/logo.png" )
29
30
self .button .bind (on_press = self .callback )
30
31
self .current_state = "default"
31
32
self .add_widget (self .button )
32
33
# Check for active window changes every 0.5 seconds
33
34
self .prev_active_window_position = None
34
- self . _active_window_checker = Clock .schedule_interval (
35
+ Clock .schedule_interval (
35
36
self .position_above_active_window , 0.5
36
37
)
37
38
@@ -67,32 +68,26 @@ def callback(self, instance):
67
68
self .resume_replay ()
68
69
69
70
def start_recording (self ):
70
- self .PROC = Popen (
71
+ self .record_proc = Popen (
71
72
"python -m openadapt.record " + "test" ,
72
73
shell = True ,
73
74
)
74
75
75
76
def stop_recording (self ):
76
- try :
77
- self .PROC .send_signal (signal .CTRL_C_EVENT )
78
- # Wait for process to terminate
79
- self .PROC .wait ()
80
- except KeyboardInterrupt :
81
- # Catch the KeyboardInterrupt exception to prevent termination
82
- pass
83
- self .PROC = None
77
+ self .record_proc .send_signal (signal .CTRL_C_EVENT )
78
+ self .record_proc .wait ()
84
79
85
80
def replay_recording (self ):
86
- self .PROC = Popen (
81
+ self .replay_proc = Popen (
87
82
"python -m openadapt.replay " + "NaiveReplayStrategy" ,
88
83
shell = True ,
89
84
)
90
85
91
86
def pause_replay (self ):
92
- self .PROC .send_signal (signal .SIGSTOP )
87
+ self .replay_proc .send_signal (signal .SIGSTOP )
93
88
94
89
def resume_replay (self ):
95
- self .PROC .send_signal (signal .SIGCONT )
90
+ self .replay_proc .send_signal (signal .SIGCONT )
96
91
97
92
98
93
class OpenAdapt (App ):
0 commit comments