Skip to content

Commit 3331a5f

Browse files
committed
UI enhanced, pop-up appears if try to open same app again, if one app open then that button is disabled
1 parent fecef68 commit 3331a5f

File tree

3 files changed

+87
-36
lines changed

3 files changed

+87
-36
lines changed

app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def run_app():
4444

4545
# Check if the app is already running
4646
if app_name in app_processes and app_processes[app_name].poll() is None:
47-
return jsonify({"status": f"{app_name} is already running"})
47+
return render_template("index.html", lsl_started=True, lsl_status="Running", lsl_color="green", message=f"{app_name} is already Running")
4848

4949
try:
5050
# Start the app subprocess
@@ -54,9 +54,9 @@ def run_app():
5454
process = subprocess.Popen(["python", f"{app_name}.py"])
5555

5656
app_processes[app_name] = process
57-
return render_template("index.html", lsl_started=True, lsl_status="Running", lsl_color="green")
57+
return render_template("index.html", lsl_started=True, lsl_status="Running", lsl_color="green", message=None)
5858
except Exception as e:
59-
return jsonify({"status": f"Error starting {app_name}: {e}"})
59+
return render_template("index.html", lsl_started=True, lsl_status="Running", lsl_color="green", message=f"Error starting {app_name}: {e}")
6060

6161
@app.route("/stop_lsl", methods=['POST'])
6262
def stop_lsl():

static/style.css

Lines changed: 77 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,67 +11,115 @@ body {
1111
}
1212

1313
.header h1 {
14-
font-size: 2em;
14+
font-size: 2.5em;
1515
margin-bottom: 20px;
16+
color: #333;
1617
}
1718

18-
.controls button, .app-button {
19-
padding: 10px 20px;
19+
.controls button {
20+
padding: 15px 30px;
2021
margin: 10px;
21-
font-size: 16px;
22+
font-size: 18px;
2223
cursor: pointer;
2324
border: none;
24-
border-radius: 5px;
25-
background-color: #4CAF50;
26-
color: white;
25+
border-radius: 25px; /* Rounded shape */
26+
background-color: #d1a56c; /* Beige color */
27+
color: #333; /* Dark text */
28+
transition: transform 0.3s ease, background-color 0.3s ease;
2729
}
2830

29-
.controls button:hover, .app-button:hover {
30-
background-color: #45a049;
31+
.controls button:hover {
32+
background-color: hsl(34, 47%, 40%); /* Dark beige on hover */
3133
}
3234

3335
button:disabled {
3436
background-color: #cccccc;
3537
cursor: not-allowed;
3638
}
3739

38-
/* LSL buttons styles */
39-
#start_lsl_button, #stop_lsl_button {
40-
width: auto;
41-
margin: 10px;
42-
}
43-
4440
/* App button layout */
4541
.app-buttons {
46-
display: flex;
47-
flex-direction: column;
48-
align-items: center;
4942
margin-top: 20px;
5043
}
5144

52-
/* Row layout for app buttons */
5345
.row {
5446
display: flex;
5547
justify-content: center;
5648
flex-wrap: wrap;
57-
margin-bottom: 15px;
49+
margin-bottom: 20px;
50+
}
51+
52+
.app-buttons form {
53+
display: flex;
54+
justify-content: space-between;
55+
flex-wrap: wrap;
56+
gap: 15px; /* Spacing between buttons */
5857
}
5958

60-
.app-button {
61-
width: 200px; /* Set fixed width for all app buttons */
59+
/* App button styles */
60+
.app-buttons button {
61+
width: 200px;
62+
height: 80px;
6263
margin: 10px;
64+
font-size: 20px; /* Larger font size */
65+
font-weight: bold;
66+
text-transform: uppercase; /* Stylish text */
67+
border-radius: 25px; /* Rounded edges */
68+
border: none;
69+
color: white; /* Font color */
70+
cursor: pointer;
71+
background-color:#9ba59c; /* gray color */
72+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
73+
transition: transform 0.3s, background-color 0.3s;
6374
}
6475

65-
/* Status section */
66-
.status {
67-
margin-top: 20px;
68-
font-size: 18px;
76+
/* Hover effect for app buttons */
77+
.app-buttons button:hover {
78+
background-color: #656d67; /* Darker shade on hover */
79+
transform: scale(1.1);
80+
opacity: 0.9;
6981
}
7082

71-
.status h3 {
72-
color: #333;
83+
/* Button active (on click) effect */
84+
.app-buttons button:active {
85+
transform: scale(1.05);
86+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
87+
}
88+
89+
button:disabled {
90+
cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><text x="0" y="16" font-size="16">🚫</text></svg>'), not-allowed;
91+
}
92+
93+
.popup {
94+
position: fixed;
95+
top: 50%;
96+
left: 50%;
97+
transform: translate(-50%, -50%);
98+
background-color: rgba(255, 255, 255, 0.9);
99+
border: 2px solid #333;
100+
padding: 20px;
101+
border-radius: 10px;
102+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
103+
z-index: 1000;
104+
text-align: center;
105+
animation: fade-out 3s forwards;
73106
}
74107

75-
#lsl_status {
108+
.popup p {
109+
font-size: 18px;
76110
font-weight: bold;
111+
color: #333;
112+
}
113+
114+
@keyframes fade-out {
115+
0% {
116+
opacity: 1;
117+
}
118+
80% {
119+
opacity: 1;
120+
}
121+
100% {
122+
opacity: 0;
123+
visibility: hidden;
124+
}
77125
}

templates/index.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
<div class="header">
1212
<h1>Chords-Python</h1>
1313
</div>
14+
15+
<!-- Pop-up message -->
16+
{% if message %}
17+
<div class="popup fade-out">
18+
<p>{{ message }}</p>
19+
</div>
20+
{% endif %}
1421

1522
<div class="controls">
1623
{% if not lsl_started %}
@@ -22,10 +29,6 @@ <h1>Chords-Python</h1>
2229
{% endif %}
2330
</div>
2431

25-
<!-- <div class="status">
26-
<h3>LSL Status: <span id="lsl_status" style="color:{{ lsl_color }};">{{ lsl_status }}</span></h3>
27-
</div> -->
28-
2932
<div class="app-buttons">
3033
<!-- Row 1: ECG, EMG, EOG, EEG -->
3134
<div class="row">

0 commit comments

Comments
 (0)