Performance Improvements

This update makes two separate changes to improve performance:

1. Only running gui code in the main thread

This required some minor restructuring, the file dialogs are now initialized outside of QtDispatcher and various delays had to be added to prevent random segfaults. Its unknown why.

2. Added the machinery to student objects to run the tests asynchronously

There are two new methods on student objects (async_tests and wait_tests.) Async_tests clears an event flag and calls the dotests method on a new thread. Wait_tests waits for the event flag to be set. Only one line had to be changed in QtDispatcher, it had to be changed from calling dotests to calling async_tests.