Add home button to question screen toolbar to exit the run

Previously the only way out of an active question run was Escape to
open the pause overlay, then click Exit Run. Exposes main.gd's exit
logic publicly (_exit_run -> exit_current_run) so a house-icon button
in the question toolbar can trigger it directly.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
hz
2026-07-28 19:06:12 -05:00
co-authored by Claude Sonnet 5
parent b511d27a20
commit 05a5298ed1
2 changed files with 17 additions and 3 deletions
+2 -2
View File
@@ -896,7 +896,7 @@ func _build_app_menu() -> void:
menu_exit_button.text = "Exit Run"
menu_exit_button.custom_minimum_size = Vector2(0, 48)
UISoundService.set_button_sound(menu_exit_button, "back")
menu_exit_button.pressed.connect(_exit_run)
menu_exit_button.pressed.connect(exit_current_run)
content.add_child(menu_exit_button)
var logout := Button.new()
@@ -943,7 +943,7 @@ func _navigate_from_pause(target_screen: String) -> void:
BlockSessionService.pause_current_question_timer()
func _exit_run() -> void:
func exit_current_run() -> void:
_close_app_menu()
if current_screen_name == "ccs_player":
var ccs_player = screens.get("ccs_player")
+15 -1
View File
@@ -90,6 +90,7 @@ var text_smaller_button: Button
var text_larger_button: Button
var labs_button: Button
var calculator_button: Button
var exit_button: Button
var clear_highlight_button: Button
var flag_button: Button
var report_button: Button
@@ -317,6 +318,18 @@ func _ready() -> void:
UISoundService.set_button_sound(text_larger_button, "toggle")
text_larger_button.pressed.connect(func(): _adjust_question_text_scale(TEXT_SCALE_STEP))
exit_button = Button.new()
exit_button.name = "ExitButton"
exit_button.tooltip_text = "Return to main area"
exit_button.icon = preload("res://assets/icons/lucide/house.svg")
exit_button.custom_minimum_size = Vector2(44, 44)
exit_button.add_theme_constant_override("icon_max_width", 22)
exit_button.alignment = HORIZONTAL_ALIGNMENT_CENTER
exit_button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
exit_button.focus_mode = Control.FOCUS_NONE
UISoundService.set_button_sound(exit_button, "back")
exit_button.pressed.connect(func(): main.exit_current_run())
calculator_button = Button.new()
calculator_button.name = "CalculatorButton"
calculator_button.tooltip_text = "Open calculator"
@@ -408,6 +421,7 @@ func _ready() -> void:
# controls behind an extra click. No text labels either (their varying widths
# broke even spacing when a button hid itself) - each button's existing
# tooltip_text carries the label as hover text instead.
question_toolbar.add_child(exit_button)
question_toolbar.add_child(text_smaller_button)
question_toolbar.add_child(text_larger_button)
question_toolbar.add_child(calculator_button)
@@ -1046,7 +1060,7 @@ func _apply_question_theme() -> void:
var navigator_heading := navigator_popup.find_child("NavigatorHeading", true, false) as Label
if navigator_heading != null:
navigator_heading.add_theme_color_override("font_color", Brand.text_color(dark))
for control in [text_smaller_button, text_larger_button, calculator_button, bookmark_button, notes_button, flashcard_button, app_feedback_button]:
for control in [exit_button, text_smaller_button, text_larger_button, calculator_button, bookmark_button, notes_button, flashcard_button, app_feedback_button]:
if control == null:
continue
var active: bool = control == bookmark_button and BookmarkService.is_bookmarked(str(BlockSessionService.get_current_question().get("id", "")))