def main(): # get the configuration parameters kwargs = get_kwargs() # get the screen screen = Screen.deserialize(kwargs.get('screen', {})) # launch the server server = MySocketServer(host=kwargs['host'], port=kwargs['port'], threaded=True, auto_stop=True, name=screen.name) # launch application app = QtWidgets.QApplication([]) # create the StimDisplay object screen = Screen.deserialize(kwargs.get('screen', {})) stim_display = StimDisplay(screen=screen, server=server, app=app) # register functions server.register_function(stim_display.set_fly_trajectory) server.register_function(stim_display.load_stim) server.register_function(stim_display.start_stim) server.register_function(stim_display.stop_stim) server.register_function(stim_display.save_rendered_movie) server.register_function(stim_display.start_corner_square) server.register_function(stim_display.stop_corner_square) server.register_function(stim_display.white_corner_square) server.register_function(stim_display.black_corner_square) server.register_function(stim_display.set_corner_square) server.register_function(stim_display.show_corner_square) server.register_function(stim_display.hide_corner_square) server.register_function(stim_display.set_idle_background) server.register_function(stim_display.set_global_fly_pos) server.register_function(stim_display.set_global_theta_offset) server.register_function(stim_display.set_global_phi_offset) # display the stimulus if screen.fullscreen: stim_display.showFullScreen() else: stim_display.show() #################################### # Run QApplication #################################### # Use Ctrl+C to exit. # ref: https://stackoverflow.com/questions/2300401/qapplication-how-to-shutdown-gracefully-on-ctrl-c signal.signal(signal.SIGINT, signal.SIG_DFL) sys.exit(app.exec_())
def main(): # get the startup arguments kwargs = get_kwargs() # get list of screens screens = kwargs['screens'] if screens is None: screens = [] screens = [Screen.deserialize(screen) for screen in screens] # run the server run_stim_server(host=kwargs['host'], port=kwargs['port'], auto_stop=kwargs['auto_stop'], screens=screens)