Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2ff10d91 authored by Florent Bouchez Tichadou's avatar Florent Bouchez Tichadou
Browse files

'start' in console will make the view change back to game if not already the current view.

parent 7433e5fd
No related branches found
No related tags found
1 merge request!71'start' in console will make the view change back to game if not already the current view.
......@@ -1222,8 +1222,10 @@ class GameView(EmptyView):
f"Try going manually in {self.level.source_level_dir}\n"
"and fix the problem or do a `git reset --hard init' there"
)
self.load_view("end_game")
# TODO: do something like self.level.send_level_control('exit')
# maybe ?
self.level = None
self.load_view("end_game")
return
# raise RuntimeError("Level thread died unexpectedly")
......@@ -1494,6 +1496,13 @@ class GameView(EmptyView):
self.adjust_buttons()
return
if action == "show_game":
if self.window._current_view == self:
return
else:
self.load_view("game")
return
raise NotImplementedError
def gdb_command_update(self, cmd):
......
......@@ -291,6 +291,14 @@ class LevelArcade(AbstractLevel, Thread):
)
while True:
# Check if the window view is on game_view, can happen if we are on
# the exit screen and start is typed in the console instead of
# clicking the 'replay' button
self.send_out_queue({
'topic': "gui_change",
'action': "show_game",
})
self.do_start()
start_time_level = time.time()
......@@ -418,13 +426,21 @@ class LevelArcade(AbstractLevel, Thread):
print(
"Program has ended. Click 'Replay' in the interface to restart it, or type 'start' here."
)
lvl.debug(f"Getting payload in thread {self}")
# TODO: allow some commands?
# if self.tracker:
# ret = self.execute_gdb_command(payload)
# print(f"Return value: {ret}")
elif payload_type == 'control' and payload['command'] == 'restart':
self.update_number_restarts()
break
elif payload_type == 'control':
if payload["command"] == "exit":
lvl.debug(f"Exiting from waiting loop after level run in {self}")
return
if payload['command'] == 'restart':
self.update_number_restarts()
break
lvl.debug(f"Control payload received while level is finished: {payload}")
else:
lvl.debug(f"Payload received while level is finished: {payload}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment