Skip to content

Commit 1ebdc75

Browse files
committed
Fixed Start Button
I would like to have the status.config background change colors depending on the state (for a visual aid), but my attempt (update_state listener) didn't work. How would you do this Lucas?
1 parent c76e875 commit 1ebdc75

File tree

1 file changed

+46
-16
lines changed

1 file changed

+46
-16
lines changed

drivers/flight_gui.py

+46-16
Original file line numberDiff line numberDiff line change
@@ -136,24 +136,30 @@ def check_stop(time, status):
136136
else:
137137
countdown.config(text=" T-01:00:00")
138138
start_abort_button.config(text="Start", bg='lime green')
139-
elif status == 'TERMINAL_COUNT':
140-
status.config(bg='#e6d925')
141-
elif status == 'POWERED_ASCENT':
142-
status.config(bg='#e04122')
143-
144-
elif status == 'UNPOWERED_ASCENT':
145-
status.config(bg='#bd857b')
146-
elif status == 'FREEFALL':
147-
status.config(bg='#760e99')
148-
elif status == 'DROGUE_DESCENT':
149-
status.config(bg='#8b65ba')
150-
elif status == 'MAIN_DESCENT':
151-
status.config(bg='#402aa1')
152-
153-
elif status == 'LANDED':
154-
status.config(bg='#4395d9')
139+
#I figured it out... having the below code included caused the unresponsiveness :(
140+
141+
#elif status == 'TERMINAL_COUNT':
142+
# status.config(bg='#e6d925') #status.config is bad specifically!!!!
143+
#elif status == 'POWERED_ASCENT':
144+
# status.config(bg='#e04122')
145+
146+
#elif status == 'UNPOWERED_ASCENT':
147+
# status.config(bg='#bd857b')
148+
#elif status == 'FREEFALL':
149+
# status.config(bg='#760e99')
150+
#elif status == 'DROGUE_DESCENT':
151+
# status.config(bg='#8b65ba')
152+
#elif status == 'MAIN_DESCENT':
153+
# status.config(bg='#402aa1')
154+
#elif status == 'LANDED':
155+
# status.config(bg='#4395d9')
156+
155157
else:
156158
start_abort_button.config(text="Abort", bg='red')
159+
#if status == 'TERMINAL_COUNT':
160+
# running = True
161+
#qqq= 10 #causes issues also
162+
157163

158164
def update_time(abs_time, relative_time):
159165
if not running:
@@ -165,6 +171,25 @@ def update_time(abs_time, relative_time):
165171
text = " T{}{:02}:{:02}:{:02}".format(sign, mins, secs, cs)
166172
countdown.config(text=text, fg = "green" if relative_time > 0 else "red")
167173

174+
#def update_state(time, status):
175+
# if status== 'STAND_BY':
176+
# status.config(bg='#e6d925')
177+
# if status == 'POWERED_ASCENT':
178+
# status.config(bg='#e04122')
179+
# if status == 'UNPOWERED_ASCENT':
180+
# status.config(bg='#bd857b')
181+
# if status == 'FREEFALL':
182+
# status.config(bg='#760e99')
183+
# if status == 'DROGUE_DESCENT':
184+
# status.config(bg='#8b65ba')
185+
# if status == 'MAIN_DESCENT':
186+
# status.config(bg='#402aa1')
187+
# if status == 'LANDED':
188+
# status.config(bg='#4395d9')
189+
190+
191+
192+
168193
def state_name(name):
169194
lower_name = name[0] + name[1:].lower()
170195
return lower_name.replace("_", " ")
@@ -266,9 +291,14 @@ def state_name(name):
266291
status = Label(runFrame, text=" Stand by", width=16, font=("Helvetica", 10), bg= '#c9c1be')
267292
status.pack(side=TOP)
268293

294+
295+
296+
297+
269298
# Listeners
270299
app.dispatcher.add_listener('status', lambda time, val: status.config(text=" " + state_name(val)))
271300
app.dispatcher.add_listener('status', check_stop)
301+
#app.dispatcher.add_listener('status', update_state)
272302
app.dispatcher.add_listener('run_time', update_time)
273303
app.dispatcher.add_listener('ss', lambda time, val: sensorStatus.config(text="All sensors functional" if val else "Sensor error encountered",
274304
fg='green' if val else 'red'))

0 commit comments

Comments
 (0)