Workaround so only one CTRL-C is required for a new prompt in --gui=qt

Only implemented for posix systems. On Windows SIGINT kills python,
and signal.CTRL_C_EVENT doesn't do anything.
(cherry picked from commit 0cc40b18455b2e1ec63e0fef2afe7ef016150b8a)
Changed sleep in signal thread to .01 sec. Moved imports to top.
(cherry picked from commit f334300ec0ba756ab8db19198cf769c9bdd4dc0d)