chrisknepper / Fractionauts

An educational game for the XOPC that teaches fraction operations with rockets.
Other
8 stars 7 forks source link

Closing bug on OLPC #65

Closed lcb931023 closed 10 years ago

lcb931023 commented 10 years ago

"Your nominated activity, Fractionauts, has been reviewed by a Sugar Labs Activities editor who decided to retain it in the sandbox.

Review Information: Reviewer: Walter Bender Comments: Nice activity, but we should try to figure out what is stomping on self.game and fix it."

The game crashes on exit. We'll have to fix this to get the game on activities.sugarlabs.org. Go go go!

Nolski commented 10 years ago

A quick look at this makes me think pygame.quit() isn't being called? It looks like once the thread is complete at https://github.com/chrisknepper/xo-fractions-game/blob/master/Main.py#L125 the program just finishes and nothing really officially closes it.

lcb931023 commented 10 years ago

So, the program runs without relying on SugarGame's structures. When the program starts it creates a python game loop, and when the exit is clicked, the pygame is properly closed, but the activity isn't.

I'm trying to see if we can close the activity when exit is clicked. In the worst case, it's tested that we can have the pygame close, and give user a grey screen with the activity toolbar, and the user closes the activity themselves. Not desirable, but not a bug.

Nolski commented 10 years ago

Any chance something like sys.exit(0) would close it? Just throw it right after pygame.quit()?

lcb931023 commented 10 years ago

That still doesn't close the activity :(

Maybe this will serve: http://wiki.laptop.org/go/Pygame_wrapper

It also seems that if you let Sugar create something, like a toolbar, it will be responsive and close itself as I command; And without something to do, it stucks at loading even if the game is already running / ran, and won't respond to self.destroy

lcb931023 commented 10 years ago

Ah wait, it makes sense - sys.exit(0) actually stops the activity, but the "loading activity" action is done by the machine. That's why it lingers on

Nolski commented 10 years ago

Hmm... Well I'm not quite sure what the application layer that pygame is running on... GTK? I quickly pulled down the TamTamJam activity source code and they call gtk.main_quit().

lcb931023 commented 10 years ago

It is done! Much simpler than I thought.