3
3
< head >
4
4
< meta charset ="UTF-8 ">
5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
- < title > Chords-Python</ title >
6
+ < title > Chords-Python Applications </ title >
7
7
< link rel ="stylesheet " href ="{{ url_for('static', filename='style.css') }} ">
8
8
</ head >
9
9
< body >
10
10
< div class ="container ">
11
11
< div class ="header ">
12
- < h1 > Chords-Python</ h1 >
12
+ < h1 > Chords-Python Applications</ h1 >
13
+ < p class ="bottom-text "> Designed with < span class ="heart "> ❤</ span > at Upside Down Labs</ p >
13
14
</ div >
14
15
15
16
<!-- Pop-up message -->
@@ -19,37 +20,90 @@ <h1>Chords-Python</h1>
19
20
</ div >
20
21
{% endif %}
21
22
22
- < div class ="controls ">
23
+ < div class ="controls ">
23
24
{% if not lsl_started %}
24
25
< form action ="/start_lsl " method ="POST ">
25
- < button type ="submit " id ="start_lsl_button "> Start LSL Stream</ button >
26
+ < button type ="submit " id ="start_lsl_button " class =" lsl-not-running " > Start LSL Stream</ button >
26
27
</ form >
27
28
{% else %}
28
- < button id ="start_lsl_button " disabled > LSL Stream Running</ button >
29
+ < button id ="start_lsl_button " class =" lsl-running " disabled > LSL Stream Running</ button >
29
30
{% endif %}
30
- </ div >
31
-
31
+ </ div >
32
32
< div class ="app-buttons ">
33
33
<!-- Row 1: ECG, EMG, EOG, EEG -->
34
34
< div class ="row ">
35
35
< form action ="/run_app " method ="POST ">
36
- < button type ="submit " name ="app_name " value ="heartbeat_ecg " {% if not lsl_started %}disabled{% endif %} > ECG with Heart Rate</ button >
37
- < button type ="submit " name ="app_name " value ="emgenvelope " {% if not lsl_started %}disabled{% endif %} > EMG with Envelope</ button >
38
- < button type ="submit " name ="app_name " value ="eog " {% if not lsl_started %}disabled{% endif %} > EOG with Blinks</ button >
39
- < button type ="submit " name ="app_name " value ="ffteeg " {% if not lsl_started %}disabled{% endif %} > EEG with FFT</ button >
36
+ < button type ="submit " name ="app_name " value ="heartbeat_ecg "
37
+ class ="{% if 'heartbeat_ecg' in running_apps %}running{% else %}not-running{% endif %} "
38
+ {% if not lsl_started %}disabled{% endif %} >
39
+ ECG with Heart Rate
40
+ </ button >
41
+ < button type ="submit " name ="app_name " value ="emgenvelope "
42
+ class ="{% if 'emgenvelope' in running_apps %}running{% else %}not-running{% endif %} "
43
+ {% if not lsl_started %}disabled{% endif %} >
44
+ EMG with Envelope
45
+ </ button >
46
+ < button type ="submit " name ="app_name " value ="eog "
47
+ class ="{% if 'eog' in running_apps %}running{% else %}not-running{% endif %} "
48
+ {% if not lsl_started %}disabled{% endif %} >
49
+ EOG with Blinks
50
+ </ button >
51
+ < button type ="submit " name ="app_name " value ="ffteeg "
52
+ class ="{% if 'ffteeg' in running_apps %}running{% else %}not-running{% endif %} "
53
+ {% if not lsl_started %}disabled{% endif %} >
54
+ EEG with FFT
55
+ </ button >
40
56
</ form >
41
57
</ div >
42
58
43
59
<!-- Row 2: Game, GUI, Keystroke, CSVPlotter -->
44
60
< div class ="row ">
45
61
< form action ="/run_app " method ="POST ">
46
- < button type ="submit " name ="app_name " value ="game " {% if not lsl_started %}disabled{% endif %} > Force Ball Game</ button >
47
- < button type ="submit " name ="app_name " value ="gui " {% if not lsl_started %}disabled{% endif %} > GUI of 6 Channels</ button >
48
- < button type ="submit " name ="app_name " value ="keystroke " {% if not lsl_started %}disabled{% endif %} > Keystroke Emulator</ button >
49
- < button type ="submit " name ="app_name " value ="csvplotter " {% if not lsl_started %}disabled{% endif %} > CSV Plotter</ button >
62
+ < button type ="submit " name ="app_name " value ="game "
63
+ class ="{% if 'game' in running_apps %}running{% else %}not-running{% endif %} "
64
+ {% if not lsl_started %}disabled{% endif %} >
65
+ Force Ball Game
66
+ </ button >
67
+ < button type ="submit " name ="app_name " value ="gui "
68
+ class ="{% if 'gui' in running_apps %}running{% else %}not-running{% endif %} "
69
+ {% if not lsl_started %}disabled{% endif %} >
70
+ GUI of 6 Channels
71
+ </ button >
72
+ < button type ="submit " name ="app_name " value ="keystroke "
73
+ class ="{% if 'keystroke' in running_apps %}running{% else %}not-running{% endif %} "
74
+ {% if not lsl_started %}disabled{% endif %} >
75
+ Keystroke Emulator
76
+ </ button >
77
+ < button type ="submit " name ="app_name " value ="csvplotter "
78
+ class ="{% if 'csvplotter' in running_apps %}running{% else %}not-running{% endif %} "
79
+ {% if not lsl_started %}disabled{% endif %} >
80
+ CSV Plotter
81
+ </ button >
50
82
</ form >
51
83
</ div >
52
84
</ div >
53
85
</ div >
86
+ < script > // For checking the running status of the apps
87
+ function updateAppStatus ( ) {
88
+ fetch ( '/app_status' )
89
+ . then ( response => response . json ( ) )
90
+ . then ( statuses => {
91
+ Object . keys ( statuses ) . forEach ( app => {
92
+ const button = document . querySelector ( `button[value="${ app } "]` ) ;
93
+ if ( statuses [ app ] ) {
94
+ button . classList . add ( "running" ) ;
95
+ button . classList . remove ( "not-running" ) ;
96
+ } else {
97
+ button . classList . add ( "not-running" ) ;
98
+ button . classList . remove ( "running" ) ;
99
+ }
100
+ } ) ;
101
+ } )
102
+ . catch ( error => console . error ( "Error fetching app statuses:" , error ) ) ;
103
+ }
104
+
105
+ setInterval ( updateAppStatus , 100 ) ; // 100 ms checking
106
+ document . addEventListener ( "DOMContentLoaded" , updateAppStatus ) ;
107
+ </ script >
54
108
</ body >
55
109
</ html >
0 commit comments