Skip to content

Commit d0b3e3d

Browse files
committed
If lsl not started then button won't be active., Colour of header and lsl button changes.
1 parent 70b8350 commit d0b3e3d

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

app.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@ def start_lsl():
2727
try:
2828
# Start the LSL stream as a subprocess
2929
if sys.platform == "win32":
30-
lsl_process = subprocess.Popen(["python", "chords.py", "--lsl"], creationflags=subprocess.CREATE_NO_WINDOW)
31-
else:
32-
lsl_process = subprocess.Popen(["python", "chords.py", "--lsl"])
33-
34-
if lsl_process.poll() is None:
35-
return render_template("index.html", lsl_started=True, lsl_status="Running", lsl_color="green")
30+
lsl_process = subprocess.Popen(["python", "chords.py", "--lsl"],stdout=subprocess.PIPE,stderr=subprocess.PIPE, creationflags=subprocess.CREATE_NO_WINDOW)
3631
else:
32+
lsl_process = subprocess.Popen(["python", "chords.py", "--lsl"],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
33+
output = lsl_process.stderr.readline().decode().strip() # Read the initial stderr line
34+
35+
print(output)
36+
if output == "No":
3737
return render_template("index.html", lsl_started=False, lsl_status="Failed to Start", lsl_color="red")
38+
else:
39+
return render_template("index.html", lsl_started=True, lsl_status="Running", lsl_color="green")
40+
except subprocess.TimeoutExpired:
41+
return render_template(
42+
"index.html", lsl_started=False, lsl_status="Timeout Error", lsl_color="red"
43+
)
3844
except Exception as e:
3945
return render_template("index.html", lsl_started=False, lsl_status=f"Error: {e}", lsl_color="red")
4046

static/style.css

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ body {
1111
}
1212

1313
.header h1 {
14-
font-size: 2.5em;
15-
margin-bottom: 20px;
16-
color: #333;
14+
font-size: 48px;
15+
font-weight: bold;
16+
background: linear-gradient(to right, #ec4899, #a855f7, #3b82f6); /* Background gradient */
17+
-webkit-background-clip: text; /* Vendor-prefixed for WebKit-based browsers */
18+
background-clip: text; /* Standard property */
19+
-webkit-text-fill-color: transparent; /* Makes the text transparent */
1720
}
1821

1922
.subtitle {
@@ -34,13 +37,13 @@ body {
3437
cursor: pointer;
3538
border: none;
3639
border-radius: 10px;
37-
background: #333;
40+
background: linear-gradient(to right, #ec4899, #a855f7, #3b82f6);
3841
color: #fffffe;
3942
transition: transform 0.3s ease, background-color 0.3s ease;
4043
}
4144

4245
button:disabled {
43-
background-color: rgb(105, 206, 105);
46+
background: rgb(105, 206, 105);
4447
cursor: not-allowed;
4548
}
4649

0 commit comments

Comments
 (0)