Example #1
0
    def run_experiment(self, dummy=None, fullscreen=True, quick=False):
        """
		Runs the current experiment.

		Keyword arguments:
		dummy 		--	A dummy argument that is passed by signaler.
						(default=None)
		fullscreen	--	A boolean to indicate whether the window should be
						fullscreen. (default=True)
		quick		--	A boolean to indicate whether default should be used for
						the log-file and subject number. Mostly useful while
						testing the experiment. (default=False)
		"""

        from libqtopensesame.widgets import pyterm

        self.extension_manager.fire(u'run_experiment', fullscreen=fullscreen)
        # Disable the entire Window, so that we can't interact with OpenSesame.
        # TODO: This should be more elegant, so that we selectively disable
        # parts of the GUI.
        if sys.platform != 'darwin':
            self.setDisabled(True)
        # Reroute the standard output to the debug window
        buf = pyterm.output_buffer(self.ui.edit_stdout)
        sys.stdout = buf
        # Launch the runner!
        if cfg.runner == u'multiprocess':
            from libqtopensesame.runners import multiprocess_runner as runner

            # Multiprocessing dus not work if opensesame is packaged as an app
            # under OSX. For now just display a warning message and do nothing
            # For the same reason, inOSX the default runner is set to inprocess
            # for now in misc.config
            if sys.platform == "darwin" and getattr(sys, 'frozen', None):
                self.experiment.notify(
                    u"Multiprocessing does not work in the OSX app version yet. \
							 Please change the runner to 'inprocess' in the preferences panel")
        elif cfg.runner == u'inprocess':
            from libqtopensesame.runners import inprocess_runner as runner
        elif cfg.runner == u'external':
            from libqtopensesame.runners import external_runner as runner
        debug.msg(u'using %s runner' % runner)
        _runner = runner(self)
        _runner.run(quick=quick,
                    fullscreen=fullscreen,
                    auto_response=self.experiment.auto_response)
        self.ui.edit_stdout.pyterm.set_workspace_globals(
            _runner.workspace_globals())
        # Undo the standard output rerouting
        sys.stdout = sys.__stdout__
        self.ui.edit_stdout.show_prompt()
        # Re-enable the GUI.
        if sys.platform != 'darwin':
            self.setDisabled(False)
        self.extension_manager.fire(u'end_experiment')
Example #2
0
    def print_debug_window(self, msg):
        """
		Prints a message to the debug window.

		Arguments:
		msg		--	An object to print to the debug window.
		"""

        from libqtopensesame.widgets import pyterm
        out = pyterm.output_buffer(self.ui.edit_stdout)
        out.write(self.experiment.unistr(msg))
Example #3
0
	def run_experiment(self, dummy=None, fullscreen=True, quick=False):

		"""
		Runs the current experiment.

		Keyword arguments:
		dummy 		--	A dummy argument that is passed by signaler.
						(default=None)
		fullscreen	--	A boolean to indicate whether the window should be
						fullscreen. (default=True)
		quick		--	A boolean to indicate whether default should be used for
						the log-file and subject number. Mostly useful while
						testing the experiment. (default=False)
		"""

		from libqtopensesame.widgets import pyterm

		self.extension_manager.fire(u'run_experiment', fullscreen=fullscreen)
		# Disable the entire Window, so that we can't interact with OpenSesame.
		# TODO: This should be more elegant, so that we selectively disable
		# parts of the GUI.
		if sys.platform != 'darwin':
			self.setDisabled(True)
		# Reroute the standard output to the debug window
		buf = pyterm.output_buffer(self.ui.edit_stdout)
		sys.stdout = buf
		# Launch the runner!
		if cfg.runner == u'multiprocess':
			from libqtopensesame.runners import multiprocess_runner as runner

			# Multiprocessing dus not work if opensesame is packaged as an app
			# under OSX. For now just display a warning message and do nothing
			# For the same reason, inOSX the default runner is set to inprocess 
			# for now in misc.config
			if sys.platform == "darwin" and getattr(sys, 'frozen', None):
				self.experiment.notify(u"Multiprocessing does not work in the OSX app version yet. \
							 Please change the runner to 'inprocess' in the preferences panel")
		elif cfg.runner == u'inprocess':
			from libqtopensesame.runners import inprocess_runner as runner
		elif cfg.runner == u'external':
			from libqtopensesame.runners import external_runner as runner
		debug.msg(u'using %s runner' % runner)
		_runner = runner(self)
		_runner.run(quick=quick, fullscreen=fullscreen,
			auto_response=self.experiment.auto_response)
		self.ui.edit_stdout.pyterm.set_workspace_globals(
			_runner.workspace_globals())
		# Undo the standard output rerouting
		sys.stdout = sys.__stdout__
		self.ui.edit_stdout.show_prompt()
		# Re-enable the GUI.
		if sys.platform != 'darwin':
			self.setDisabled(False)
		self.extension_manager.fire(u'end_experiment')
Example #4
0
	def print_debug_window(self, msg):

		"""
		Prints a message to the debug window.

		Arguments:
		msg		--	An object to print to the debug window.
		"""

		from libqtopensesame.widgets import pyterm
		out = pyterm.output_buffer(self.ui.edit_stdout)
		out.write(self.experiment.unistr(msg))
Example #5
0
	def run_experiment(self, dummy=None, fullscreen=True, quick=False):

		"""
		Runs the current experiment.

		Keyword arguments:
		dummy 		--	A dummy argument that is passed by signaler.
						(default=None)
		fullscreen	--	A boolean to indicate whether the window should be
						fullscreen. (default=True)
		quick		--	A boolean to indicate whether default should be used for
						the log-file and subject number. Mostly useful while
						testing the experiment. (default=False)
		"""

		from libqtopensesame.widgets import pyterm

		self.extension_manager.fire(u'run_experiment', fullscreen=fullscreen)
		# Disable the entire Window, so that we can't interact with OpenSesame.
		# TODO: This should be more elegant, so that we selectively disable
		# parts of the GUI.
		if sys.platform != 'darwin':
			self.setDisabled(True)
		# Reroute the standard output to the debug window
		buf = pyterm.output_buffer(self.ui.edit_stdout)
		sys.stdout = buf
		# Launch the runner!
		if cfg.runner == u'multiprocess':
			from libqtopensesame.runners import multiprocess_runner as runner
		elif cfg.runner == u'inprocess':
			from libqtopensesame.runners import inprocess_runner as runner
		elif cfg.runner == u'external':
			from libqtopensesame.runners import external_runner as runner
		debug.msg(u'using %s runner' % runner)
		_runner = runner(self)
		_runner.run(quick=quick, fullscreen=fullscreen,
			auto_response=self.experiment.auto_response)
		self.ui.edit_stdout.pyterm.set_workspace_globals(
			_runner.workspace_globals())
		# Undo the standard output rerouting
		sys.stdout = sys.__stdout__
		self.ui.edit_stdout.show_prompt()
		# Re-enable the GUI.
		if sys.platform != 'darwin':
			self.setDisabled(False)
		self.extension_manager.fire(u'end_experiment')