Example #1
0
    def __init__(self, main_window, info={}):
        """
		desc:
			Constructor.

		arguments:
			main_window:	The main-window object.

		keywords:
			info:			A dictionary with extension properties that have
							been read from info.[json|txt].
		"""

        debug.msg(u'creating %s' % self.name())
        self._ = translation_context(self.name(), category=u'extension')
        self.info = info
        self.setup(main_window)
        self.register_ui_files()
        self.create_action()
        self.register_config()
Example #2
0
	def __init__(self, main_window, info={}):

		"""
		desc:
			Constructor.

		arguments:
			main_window:	The main-window object.

		keywords:
			info:			A dictionary with extension properties that have
							been read from info.[json|txt].
		"""

		debug.msg(u'creating %s' % self.name())
		self._ = translation_context(self.name(), category=u'extension')
		self.info = info
		self.setup(main_window)
		self.register_ui_files()
		self.create_action()
		self.register_config()
Example #3
0
from libopensesame.py3compat import *
from qtpy import QtGui, QtCore, QtWidgets
from libqtopensesame.misc.base_component import base_component
from libqtopensesame.misc.config import cfg
from libqtopensesame.items import experiment
from libopensesame import debug, metadata
from libopensesame.exceptions import osexception
import libopensesame.experiment
import libopensesame.plugins
import libopensesame.misc
import os
import sys
import warnings
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'qtopensesame', category=u'core')

class qtopensesame(QtWidgets.QMainWindow, base_component):

	"""The main class of the OpenSesame GUI"""

	def __init__(self, app, parent=None):

		"""
		Constructor. This does very little, except prepare the app to be shown
		as rapidly as possible. The actual GUI initialization is handled by
		resume_init().

		Arguments:
		app -- the QApplication
Example #4
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libopensesame import plugins
from qtpy import QtWidgets, QtGui
from libqtopensesame.misc.translate import translation_context

_ = translation_context(u"tree_append_menu", category=u"core")


class append_existing_action(base_subcomponent, QtWidgets.QAction):

    """
	desc:
		An action for appending existing items, either as linked or unlinked
		copies.
	"""

    def __init__(self, append_menu, menu, item_name):

        """
		desc:
			Constructor.
Example #5
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import os
import sys
from libopensesame import misc, metadata
from libqtopensesame.extensions import BaseExtension
from libqtopensesame.misc.translate import translation_context
from libqtopensesame.misc import template_info
_ = translation_context(u'RapunzelWelcome', category=u'extension')


class RapunzelWelcome(BaseExtension):
    @BaseExtension.as_thread(wait=500)
    def event_startup(self):

        # Don't show the startup tab if any pinned files have been restored
        if self.extension_manager.provide('ide_restored_pins'):
            return
        with safe_open(self.ext_resource(u'rapunzel_welcome.md')) as fd:
            md = fd.read()
        self.tabwidget.open_markdown(md,
                                     title=_(u'Get started!'),
                                     icon=u'help-about')
        self._widget = self.tabwidget.currentWidget()
Example #6
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame.exceptions import osexception
from libopensesame import item, widgets
from libqtopensesame.items.qtautoplugin import qtautoplugin
try:
	from libqtopensesame.misc.translate import translation_context
	_ = translation_context(u'form_base', category=u'plugin')
except ImportError:
	pass

class form_base(item.item):

	"""A generic form plug-in"""

	initial_view = u'script'

	def __init__(self, name, experiment, script=None, item_type=u'form_base',
		description=u'A generic form plug-in'):

		"""
		Constructor
Example #7
0
"""

from libopensesame.py3compat import *
import os
import tempfile
import webbrowser
from qtpy.QtWidgets import QFileDialog
from qtpy.QtCore import QRegExp
from qtpy.QtGui import QRegExpValidator, QIcon
from libqtopensesame.widgets.base_widget import base_widget
from libopensesame.osexpfile import osexpwriter
from osweb import export, __version__
from libqtopensesame.misc.translate import translation_context
from libqtopensesame.misc.config import cfg

_ = translation_context(u'oswebext', category=u'extension')

MEGABYTE = 1024**2


class oswebext_widget(base_widget):
    """
	desc:
		Controls for interacting with OSWeb
	"""
    def __init__(self, main_window, oswebext):
        """
		desc:
			Constructor.

		arguments:
Example #8
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libopensesame import plugins
from qtpy import QtWidgets, QtGui
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'tree_append_menu', category=u'core')


class append_existing_action(base_subcomponent, QtWidgets.QAction):
    """
	desc:
		An action for appending existing items, either as linked or unlinked
		copies.
	"""
    def __init__(self, append_menu, menu, item_name):
        """
		desc:
			Constructor.

		arguments:
			append_menu:
Example #9
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame.exceptions import osexception
from libopensesame.item_store import item_store
from libopensesame import plugins
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'qtitem_store', category=u'core')

class qtitem_store(item_store):

	"""
	desc:
		The GUI counterpart of the item store, which also distributes item
		changes etc.
	"""

	def __init__(self, experiment):

		"""
		desc:
			Constructor.
Example #10
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame import debug, metadata
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.misc.config import cfg
from qtpy import QtGui, QtWidgets, QtCore
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'tab_widget', category=u'core')

class tab_widget(base_subcomponent, QtWidgets.QTabWidget):

	"""A custom tab widget with some extra functionality"""

	def __init__(self, parent=None):

		"""
		Constructor

		Keywords arguments:
		parent -- the parent QWidget
		"""

		QtWidgets.QTabWidget.__init__(self, parent)
# Python3 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from qtpy import QtWidgets, QtCore, QtGui

import QNotifications

from libopensesame import debug
from libopensesame.exceptions import osexception
from libopensesame.py3compat import *
from libqtopensesame.extensions import base_extension
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'notifications', category=u'extension')

__author__ = u"Daniel Schreij"
__license__ = u"GPLv3"

import os

class notifications(base_extension):
	### OpenSesame events
	timeout = 5000
	def event_startup(self):
		self.notfication_area = QNotifications.QNotificationArea(self.tabwidget)
		self.notfication_area.setEntryEffect(u'fadeIn', 200)
		self.notfication_area.setExitEffect(u'fadeOut', 200)
	
	def event_save_experiment(self, path):
Example #12
0
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import os
from libqtopensesame.items.sequence import sequence
from libqtopensesame.items.qtplugin import qtplugin
from libopensesame.sequence import sequence as sequence_runtime
from libqtopensesame.widgets.tree_item_item import tree_item_item
from libqtopensesame.validators import duration_validator
from oscoroutines import coroutines, items_adapter, tree_overview_adapter
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'coroutines', category=u'plugins')


class qtcoroutines(coroutines, sequence):

	"""
	desc:
		The coroutines plugin GUI.
	"""

	description = _(u'Run items simultaneously')

	def __init__(self, name, experiment, string=None):

		"""See item."""
Example #13
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'template', category=u'core')

if py3:
	templates = [
		(u'templates/default-py3.osexp', _(u'Default template')),
		(u'templates/extended_template-py3.osexp', _(u'Extended template')),
		(u'templates/form_template.osexp',
			_(u'Questionnaire template')),
		(u'templates/android_template.osexp', _(u'Android template')),
		]
else:
	templates = [
		(u'templates/default.osexp', _(u'Default template')),
		(u'templates/extended_template.osexp', _(u'Extended template')),
		(u'templates/form_template.osexp',
			_(u'Questionnaire template')),
Example #14
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtWidgets
from libopensesame import debug
from libqtopensesame.extensions import base_extension
from libqtopensesame.misc.config import cfg
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'update_checker', category=u'extension')

class update_checker(base_extension):

	def activate(self):

		self.check_for_updates()

	def event_startup(self):

		self.check_for_updates(always=False)

	def check_for_updates(self, always=True):

		if py3:
			from urllib.request import urlopen
Example #15
0
You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame import debug, misc
from libqtopensesame.misc.config import cfg
from libqtopensesame.widgets.base_widget import base_widget
from libqtopensesame._input.popup_menu import popup_menu
from libqtopensesame._input.confirmation import confirmation
from qtpy import QtCore, QtWidgets
import os
import os.path
from libqtopensesame.misc.translate import translation_context

_ = translation_context(u"pool_widget", category=u"core")


class pool_widget(base_widget):

    """
	desc:
		The file-pool widget.
	"""

    def __init__(self, main_window):

        """
		desc:
			Constructor.
Example #16
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import os
import sys
from libopensesame import misc, metadata
from libqtopensesame.extensions import base_extension
from libqtopensesame.misc.translate import translation_context
from libqtopensesame.misc import template_info
_ = translation_context(u'get_started', category=u'extension')


class get_started(base_extension):
    """
	desc:
		Shows the get-started tab and opens an experiment on startup, if one was
		passed on the command line.
	"""
    def activate(self):
        """
		desc:
			Is called when the extension is activated through the menu/ toolbar
			action.
		"""
Example #17
0
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import random
import re
import sys
from libopensesame import debug, misc
from libopensesame.inline_script import inline_script as inline_script_runtime
from libqtopensesame.items.qtplugin import qtplugin
from libqtopensesame.misc.config import cfg
from libqtopensesame.widgets.tree_inline_script_item import \
	tree_inline_script_item
from qtpy import QtCore, QtWidgets
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'inline_script', category=u'item')

class inline_script(inline_script_runtime, qtplugin):

	"""The inline_script GUI controls"""

	description = _(u'Executes Python code'	)
	help_url = u'manual/python/about'

	def __init__(self, name, experiment, string=None):

		"""See item."""

		inline_script_runtime.__init__(self, name, experiment, string)
		qtplugin.__init__(self)
Example #18
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtGui, QtWidgets
from libqtopensesame.misc.config import cfg
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.widgets.tree_append_menu import tree_append_menu
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'item_context_menu', category=u'core')


class item_context_menu(base_subcomponent, QtWidgets.QMenu):

	"""
	desc:
		Provides a basic context menu for an item.
	"""

	def __init__(self, main_window, treeitem):

		"""
		desc:
			Constructor.
Example #19
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame.keyboard_response import keyboard_response as \
	keyboard_response_runtime
from libqtopensesame.validators import timeout_validator
from libqtopensesame.items.qtplugin import qtplugin
from openexp.keyboard import keyboard
from qtpy import QtCore, QtWidgets
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'keyboard_response', category=u'item')

class keyboard_response(keyboard_response_runtime, qtplugin):

	"""keyboard_response item GUI"""

	description = _(u'Collects keyboard responses')
	help_url = u'manual/response/keyboard'
	lazy_init = True

	def __init__(self, name, experiment, string=None):

		"""
		Constructor

		Arguments:
Example #20
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame.exceptions import osexception
from libqtopensesame.extensions import base_extension
from libopensesame import misc
import time
import os
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'after_experiment', category=u'extension')


class after_experiment(base_extension):
    """
	desc:
		Shows notifications after an experiment has finished.
	"""
    def event_end_experiment(self, ret_val):
        """
		desc:
			Handles the end of an experiment.

		arguments:
			ret_val:
				desc:	An Exception, or None if no exception occurred.
Example #21
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import platform
from qtpy import QtCore
from libqtopensesame.widgets.base_widget import base_widget
from libopensesame import plugins, misc
from libqtopensesame.misc.markdown_parser import markdown_parser
import os.path
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'webbrowser', category=u'core')

import os
if os.environ[u'QT_API'] == u'pyqt':
	from PyQt4.QtWebKit import QWebView as WebView
	from PyQt4.QtWebKit import QWebPage as WebPage
else:
	# QtWebKit is dropped in favour of QtWebEngine from Qt 5.6 on
	try:
		from PyQt5.QtWebKitWidgets import QWebView as WebView
		from PyQt5.QtWebKitWidgets import QWebPage as WebPage
	except ImportError as e:
		from PyQt5.QtWebEngineWidgets import QWebEngineView as WebView
		from PyQt5.QtWebEngineWidgets import QWebEnginePage as WebPage

# These urls are viewed internally in the browser component. All other urls are
Example #22
0
"""

from libopensesame.py3compat import *
import os
import multiprocessing
from queue import Empty
import psutil
from qtpy.QtCore import Qt, QTimer
from qtpy.QtWidgets import QDockWidget
from datamatrix import DataMatrix
from qdatamatrix import QDataMatrix
from libqtopensesame.misc.config import cfg
from libopensesame.oslogging import oslogger
from libqtopensesame.extensions import BaseExtension
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'SubprocessManager', category=u'extension')

PARACHUTE_STOP = -1
PARACHUTE_HEARTBEAT = -2
PARACHUTE_HEARTBEAT_INTERVAL = 5


def parachute(queue, main_pid):
    """This function runs as a subprocess and receives the PIDs off all
    subprocesses. Whether the main process is alive is kept track of with a
    heartbeat. If no heartbeat comes in, then all subprocesses are killed to
    make sure that no runaway processes are left on shutdown.
    """

    oslogger.start('parachute')
    pids = [main_pid]
Example #23
0
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.

IMPORTANT NOTE: The parallel plug-in is not reliable, and will be replaced
by the coroutines plugin.
"""

from libopensesame.py3compat import *

import os.path
import threading
from libopensesame import sequence, debug
from libqtopensesame.items import sequence as qtsequence
from libqtopensesame.items import qtplugin
try:
	from libqtopensesame.misc.translate import translation_context
	_ = translation_context(u'parallel', category=u'plugin')
except ImportError:
	pass

class parallel_process(threading.Thread):

	"""A wrapper for a single process"""

	def __init__(self, item):

		"""
		Constructor

		Arguments:
		item -- the item to run
		"""
Example #24
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import libopensesame.experiment
import libopensesame.plugins
from libqtopensesame.misc.qtitem_store import qtitem_store
from libqtopensesame.misc.qtsyntax import qtsyntax
from qtpy import QtCore, QtWidgets, QtGui
import os
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'experiment', category=u'item')

class experiment(libopensesame.experiment.experiment):

	"""Contains various GUI controls for the experiment"""

	def __init__(self, main_window, name, string=None, pool_folder=None,
		experiment_path=None, resources={}):

		"""
		desc:
			Constructor. The experiment is created automatically be OpenSesame
			and you will generally not need to create it yourself.

		arguments:
			main_window:
Example #25
0
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtGui, QtWidgets
from collections import OrderedDict
from libopensesame import debug, plugins
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.misc.config import cfg
from libqtopensesame.widgets.toolbar_items_label import toolbar_items_label
from libqtopensesame.widgets.toolbar_items_item import toolbar_items_item
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'toolbar_items', category=u'core')


class toolbar_items(base_subcomponent, QtWidgets.QToolBar):
    """
	desc:
		The item toolbar, which allows you to insert items into the experiment
		through drag and drop.
	"""
    def __init__(self, parent):
        """
		desc:
			Constructor.

		arguments:
			parent:
Example #26
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import re
from libopensesame.oslogging import oslogger
from libqtopensesame.extensions import BaseExtension
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'SymbolSelector', category=u'extension')

PYTHON_SYMBOLS = r'^[ \t]*(?P<type>def|class)[ \t]+(?P<name>\w+)'
R_SYMBOLS = r'^[ \t]*(?P<name>[\w.]+)[ \t]*<-[ \t]*function'
MARKDOWN_HEADINGS = r'^#+[ \t]*(?P<name>.+)$'
MARKDOWN_HR = r'^---[ \t]*\n[ \t\n]*(?P<name>.{1,50})'


class SymbolSelector(BaseExtension):

    preferences_ui = 'extensions.SymbolSelector.preferences'

    def activate(self):

        self.main_window.set_busy(True)
        editor = self.extension_manager.provide(u'ide_current_editor')
Example #27
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtWidgets
from libqtopensesame.widgets.tree_item_item import tree_item_item
from libqtopensesame.widgets.tree_inline_script_phase_item import \
 tree_inline_script_phase_item
from libqtopensesame.widgets.tree_inline_script_symbol_item import \
 tree_inline_script_symbol_item
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'tree_inline_script_item', category=u'core')


class tree_inline_script_item(tree_item_item):
    """
	desc:
		Corresponds to an inline-script widget in the overview area.
	"""
    def __init__(self,
                 item,
                 extra_info=None,
                 parent_item=None,
                 index=None,
                 symbols=True):
        """
		desc:
Example #28
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtWidgets, QtGui
from libopensesame import debug
from libqtopensesame.widgets.base_widget import base_widget
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'color_edit', category=u'core')

class color_edit(base_widget):

	"""
	desc:
		A colorpicker widget that emulates a QLineEdit.
	"""

	textChanged = QtCore.Signal('QString')
	textEdited = QtCore.Signal('QString')

	def __init__(self, main_window):

		"""
		desc:
(at your option) any later version.

OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame import debug
from libqtopensesame.widgets.header_widget import header_widget
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'general_header_widget', category=u'core')

class general_header_widget(header_widget):

	"""
	desc:
		The widget containing the clickable title and description of the
		experiment.
	"""

	def __init__(self, general_tab, main_window):

		"""
		desc:
			Constructor.
Example #30
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame import debug, metadata
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.misc import config
from qtpy import QtGui, QtWidgets, QtCore
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'tab_widget', category=u'core')


class tab_widget(base_subcomponent, QtWidgets.QTabWidget):
    """A custom tab widget with some extra functionality"""
    def __init__(self, parent=None):
        """
		Constructor

		Keywords arguments:
		parent -- the parent QWidget
		"""

        QtWidgets.QTabWidget.__init__(self, parent)
        base_subcomponent.setup(self, parent)
        try:
Example #31
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libqtopensesame.extensions import base_extension, suspend_events
from qtpy.QtWidgets import QMenu, QToolBar
from undo_stack import undo_stack
import difflib
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'undo_manager', category=u'extension')


class undo_manager(base_extension):
    """
	desc:
		An extension that implements undo/ redo.
	"""
    def event_startup(self):
        """
		desc:
			Initializes the extension on startup.
		"""

        self.undo_action = self.qaction(u'edit-undo',
                                        _(u'Undo'),
Example #32
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtWidgets
from libqtopensesame.widgets.tree_base_item import tree_base_item
from libqtopensesame.items.qtstructure_item import qtstructure_item
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'tree_item_item', category=u'core')


class tree_item_item(tree_base_item):
    """
	desc:
		Corresponds to an item widget in the overview area.
	"""
    def __init__(self, item, extra_info=None, parent_item=None, index=None):
        """
		desc:
			Constructor.

		arguments:
			item:
				desc:	An item.
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtWidgets
from libqtopensesame.widgets.tree_base_item import tree_base_item
from libqtopensesame.misc import drag_and_drop
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'tree_unused_items_item', category=u'core')

class tree_unused_items_item(tree_base_item):

	"""
	desc:
		Corresponds to the unused-items widget in the overview area.
	"""

	def __init__(self, main_window):

		"""
		desc:
			Constructor.

		arguments:
Example #34
0
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import os
from libqtopensesame.misc.config import cfg
from libqtopensesame.extensions import BaseExtension
from libopensesame.oslogging import oslogger
from qtpy.QtWidgets import QDockWidget, QShortcut
from qtpy.QtCore import Qt
from qtpy.QtGui import QKeySequence
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'JupyterConsole', category=u'extension')


class JupyterConsole(BaseExtension):
    
    preferences_ui = 'extensions.JupyterConsole.preferences'

    @BaseExtension.as_thread(wait=500)
    def event_startup(self):

        from jupyter_tabwidget import ConsoleTabWidget

        self.set_busy(True)
        self._jupyter_console = ConsoleTabWidget(self.main_window)
        self._dock_widget = QDockWidget(u'Console', self.main_window)
        self._dock_widget.setObjectName(u'JupyterConsole')
Example #35
0
(at your option) any later version.

OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtWidgets
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'confirmation', category=u'core')

class confirmation(QtWidgets.QMessageBox, base_subcomponent):

	"""
	desc:
		A simple yes/ no/ cancel confirmation dialog.
	"""

	def __init__(self, main_window, msg, title=None, allow_cancel=False,
		default=u'no'):

		"""
		desc:
			Constructor.
Example #36
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame.exceptions import osexception
from libopensesame.item_store import item_store
from libopensesame import plugins
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'qtitem_store', category=u'core')


class qtitem_store(item_store):
    """
	desc:
		The GUI counterpart of the item store, which also distributes item
		changes etc.
	"""
    def __init__(self, experiment):
        """
		desc:
			Constructor.

		arguments:
			main_window:
Example #37
0
try:
    from collections import OrderedDict
except ImportError:
    OrderDict = dict
from libopensesame import metadata
from libopensesame.oslogging import oslogger
from libqtopensesame.extensions import BaseExtension
from libqtopensesame.misc.config import cfg
from qtpy.QtCore import Qt, QTimer
from qtpy.QtWidgets import QFileDialog, QMessageBox, QPushButton, QApplication
from opensesame_ide import FolderBrowserDockWidget, MenuBar
from libqtopensesame.misc.translate import translation_context
from pyqode.core import widgets, panels
from pyqode.core.api.utils import TextHelper
from pyqode_extras.widgets import FallbackCodeEdit
_ = translation_context(u'OpenSesameIDE', category=u'extension')


def with_editor_and_cursor(fnc):
    def inner(self, *args, **kwargs):

        editor = self._current_editor()
        if editor is None:
            return
        if takes_args:
            return fnc(self, editor, editor.textCursor(), *args, **kwargs)
        return fnc(self, editor, editor.textCursor())

    takes_args = len(inspect.getargspec(fnc).args) > 3
    return inner
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtWidgets
from libopensesame.exceptions import osexception
from libqtopensesame.items.experiment import experiment
from libqtopensesame.widgets.base_widget import base_widget
from libqtopensesame.misc.config import cfg
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'general_script_editor', category=u'core')

class general_script_editor(base_widget):

	"""
	desc:
		The general script editor.
	"""

	def __init__(self, main_window):

		"""
		desc:
			Constructor.

		arguments:
Example #39
0
(at your option) any later version.

OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtWidgets
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'item_view_button', category=u'core')

class item_view_button(base_subcomponent, QtWidgets.QPushButton):

	"""
	desc:
		The view button in the top-right of the edit controls.
	"""

	def __init__(self, item):

		"""
		desc:
			Constructor.

		arguments:
Example #40
0
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame.logger import logger as logger_runtime
from libqtopensesame.items.qtplugin import qtplugin
from libqtopensesame.widgets.logger_widget import logger_widget
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'logger', category=u'item')


class logger(logger_runtime, qtplugin):
    """
	desc:
		GUI controls for the logger item.
	"""

    description = _(u'Logs experimental data')
    help_url = u'manual/logging'

    def __init__(self, name, experiment, string=None):
        """See item."""

        logger_runtime.__init__(self, name, experiment, string)
Example #41
0
You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libqtopensesame.misc.config import cfg
from datamatrix import DataMatrix
from qdatamatrix import QDataMatrix
from qtpy.QtWidgets import QDockWidget, QLabel
from qtpy.QtGui import QFont
from qtpy.QtCore import Qt, QTimer
from libopensesame.oslogging import oslogger
from libqtopensesame.extensions import BaseExtension
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'WorkspaceExplorer', category=u'extension')


class WorkspaceMatrix(QDataMatrix):
    @property
    def cell_double_clicked(self):

        return self._spreadsheet.cellDoubleClicked


class WorkspaceExplorer(BaseExtension):
    @BaseExtension.as_thread(wait=2500)
    def event_startup(self):

        dm = DataMatrix(length=0)
        dm.initializing = -1
OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from variable_inspector_cell import variable_inspector_cell
from libqtopensesame.widgets.base_widget import base_widget
from libqtopensesame.misc import drag_and_drop
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'variable_inspector', category=u'extension')

class variable_inspector_widget(base_widget):

	"""
	desc:
		The variable inspector widget, which includes the table, filter button,
		etc.
	"""

	def __init__(self, main_window, ext):

		"""
		desc:
			Constructor.
#-*- coding:utf-8 -*-
"""
This file is part of the Mousetrap plug-ins for OpenSesame.
"""
from libopensesame.py3compat import *
from libopensesame import item, widgets
from libqtopensesame.items.qtautoplugin import qtautoplugin
from libopensesame.exceptions import osexception
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'mousetrap_form', category=u'plugins')

# Import class for mouse button label conversion
from libopensesame.mouse_response import mouse_response_mixin

# Import mouse-tracking form
from PyMT_form import MT_form

# Define class for mouse-tracking plugin
# Note that parts if this code are take from the code of the form_base plug-in
class mousetrap_form(item.item, mouse_response_mixin):

	"""Tracks mouse movements in custom form defined using OpenSesame script"""

	initial_view = u'controls'
	#initial_view = u'split'
	description = u'Tracks mouse movements in custom form defined using OpenSesame script'

	def reset(self):

		"""
		desc:
(at your option) any later version.

OpenSesame is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libqtopensesame.extensions import base_extension
from libqtopensesame.misc.config import cfg
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'opensesame_3_notifications', category=u'extension')

class opensesame_3_notifications(base_extension):

	"""
	desc:
		Provides tips for new users of OpenSesame 3.
	"""

	def event_os3n_dismiss_startup(self):

		"""
		desc:
			Permanently disables the startup tab.
		"""
Example #45
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame import debug
from qtpy import QtWidgets
from libqtopensesame.widgets.general_header_widget import general_header_widget
from libqtopensesame.widgets.base_widget import base_widget
from openexp._color.color import color
from openexp import backend
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'general_properties', category=u'core')


class general_properties(base_widget):
    """The QWidget for the general properties tab."""

    backend_format = u'%s [%s]'

    def __init__(self, main_window):
        """
		desc:
			Constructor.

		arguments:
			main_window:	A qtopensesame object.
		"""
Example #46
0
from libopensesame.py3compat import *
from qtpy import QtGui, QtCore, QtWidgets
from libqtopensesame.misc.base_component import base_component
from libqtopensesame.misc.config import cfg
from libqtopensesame.items import experiment
from libopensesame import debug, metadata
from libopensesame.exceptions import osexception
import libopensesame.experiment
import libopensesame.plugins
import libopensesame.misc
import os
import sys
import warnings
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'qtopensesame', category=u'core')


class qtopensesame(QtWidgets.QMainWindow, base_component):
    """The main class of the OpenSesame GUI"""
    def __init__(self, app, parent=None):
        """
		Constructor. This does very little, except prepare the app to be shown
		as rapidly as possible. The actual GUI initialization is handled by
		resume_init().

		Arguments:
		app -- the QApplication

		Keyword arguments:
		parent -- a link to the parent window
Example #47
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import os
import math
from openexp._color.color import color
from libqtopensesame.misc import drag_and_drop
from libqtopensesame.misc.config import cfg
from qtpy import QtWidgets, QtGui, QtCore
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'sketchpad', category=u'item')

class sketchpad_canvas(QtWidgets.QGraphicsScene):

	"""
	desc:
		A partial implementation of a canvas, so that sketchpad elements can
		draw to the canvas just as in runtime.
	"""

	def __init__(self, sketchpad):

		"""
		desc:
			constructor.
Example #48
0
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.

IMPORTANT NOTE: The parallel plug-in is not reliable, and will be replaced
by the coroutines plugin.
"""

from libopensesame.py3compat import *

import os.path
import threading
from libopensesame import sequence, debug
from libqtopensesame.items import sequence as qtsequence
from libqtopensesame.items import qtplugin
try:
    from libqtopensesame.misc.translate import translation_context
    _ = translation_context(u'parallel', category=u'plugin')
except ImportError:
    pass


class parallel_process(threading.Thread):
    """A wrapper for a single process"""
    def __init__(self, item):
        """
		Constructor

		Arguments:
		item -- the item to run
		"""

        threading.Thread.__init__(self)
Example #49
0
from qtpy import QtWidgets
from libopensesame import debug
from libopensesame import metadata
from libopensesame import misc
from libqtopensesame.extensions import base_extension
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.misc.config import cfg
from libopensesame.py3compat import *
if py3:
	from urllib.request import urlopen
else:
	from urllib2 import urlopen
import yaml
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'help', category=u'extension')

class action_page(QtWidgets.QAction, base_subcomponent):

	"""
	desc:
		A menu entry for a single help page.
	"""

	def __init__(self, main_window, title, link, menu):

		"""
		desc:
			Constructor.

		arguments:
Example #50
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

import os
from qtpy import QtWidgets
from libqtopensesame.misc.config import cfg
from libopensesame import debug
from libopensesame.exceptions import osexception
from libopensesame.experiment import experiment
from libopensesame.py3compat import *
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'base_runner', category=u'core')

class base_runner(object):

	"""
	A runner implements a specific way to execute an OpenSesame experiment from
	within the GUI. The base_runner is an abstract runner that is inherited by
	actual runners.
	"""

	valid_logfile_extensions = u'.csv', u'.txt', u'.dat', u'.log'
	default_logfile_extension = u'.csv'

	def __init__(self, main_window):

		"""
Example #51
0
You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qdatamatrix import QDataMatrix
from pseudorandom import EnforceFailed
from libopensesame.loop import loop as loop_runtime
from libopensesame.exceptions import osexception
from libqtopensesame.items.qtitem import qtitem
from libqtopensesame.items.qtstructure_item import qtstructure_item
from libqtopensesame.widgets.loop_widget import loop_widget
from libqtopensesame.widgets.tree_item_item import tree_item_item
from libqtopensesame.misc.translate import translation_context
import math
_ = translation_context(u'loop', category=u'item')

class loop(qtstructure_item, qtitem, loop_runtime):

	"""The GUI for the loop item"""

	description = _(u'Repeatedly runs another item')

	def __init__(self, name, experiment, string=None):

		"""See qtitem."""

		self.lock_cycles = False
		loop_runtime.__init__(self, name, experiment, string)
		qtitem.__init__(self)
Example #52
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtWidgets
from libopensesame import debug
from libqtopensesame.extensions import base_extension
from libqtopensesame.misc.config import cfg
from libqtopensesame.misc.translate import translation_context

_ = translation_context(u'update_checker', category=u'extension')


class update_checker(base_extension):
    def activate(self):

        self.check_for_updates()

    def event_startup(self):

        self.check_for_updates(always=False)

    def check_for_updates(self, always=True):

        if py3:
            from urllib.request import urlopen
Example #53
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from libopensesame import debug
from libopensesame.inline_script import inline_script as inline_script_runtime
from libqtopensesame.items.qtplugin import qtplugin
from libqtopensesame.misc.config import cfg
from libqtopensesame.widgets.tree_inline_script_item import \
 tree_inline_script_item
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'inline_script', category=u'item')


class inline_script(inline_script_runtime, qtplugin):
    """The inline_script GUI controls"""

    description = _(u'Executes Python code')
    help_url = u'manual/python/about'

    def __init__(self, name, experiment, string=None):
        """See item."""

        inline_script_runtime.__init__(self, name, experiment, string)
        qtplugin.__init__(self)

    def apply_edit_changes(self):
Example #54
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import os
import re
from qtpy.QtWidgets import QFileDialog
from libqtopensesame.extensions import BaseExtension
from libqtopensesame.misc.config import cfg
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'JupyterNotebook', category=u'extension')

MARKDOWN_CELL = u'# <markdowncell>\n"""\n{}\n"""\n# </markdowncell>\n'
CODE_CELL = u'# <codecell>\n{}\n# </codecell>\n'
# Matches <codecell> ... </codecell> and <markdowncell> ... </markdowncell>
NOTEBOOK_PATTERN = r'^#[ \t]*<(?P<cell_type>code|markdown)cell>[ \t]*\n(?P<source>.*?)\n^#[ \t]*</(code|markdown)cell>'
# Matches # %% .. # %%
SPYDER_PATTERN = r'((#[ \t]*%%[ \t]*\n)|\A)(?P<source>.*?)(\n|\Z)((?=#[ \t]*%%[ \t]*\n)|\Z)'
# To check whether there any Spyder cells in there
SPYDER_HAS_CELLS = r'#[ \t]*%%[ \t]*\n'


class JupyterNotebook(BaseExtension):

    preferences_ui = 'extensions.JupyterNotebook.preferences'
Example #55
0
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
from qtpy import QtCore, QtGui, QtWidgets
from collections import OrderedDict
from libopensesame import debug, plugins
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.misc.config import cfg
from libqtopensesame.widgets.toolbar_items_label import toolbar_items_label
from libqtopensesame.widgets.toolbar_items_item import toolbar_items_item
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'toolbar_items', category=u'core')

class toolbar_items(base_subcomponent, QtWidgets.QToolBar):

	"""
	desc:
		The item toolbar, which allows you to insert items into the experiment
		through drag and drop.
	"""

	def __init__(self, parent):

		"""
		desc:
			Constructor.
Example #56
0
#-*- coding:utf-8 -*-
"""
This file is part of the Mousetrap plug-ins for OpenSesame.
"""
from libopensesame.py3compat import *
from libopensesame import item
from libqtopensesame.items.qtautoplugin import qtautoplugin
from libopensesame.exceptions import osexception
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'mousetrap_response', category=u'plugins')

# Import class for mouse button label conversion
from libopensesame.mouse_response import mouse_response_mixin

# Import mouse-tracking response
from PyMT_response import MT_response


# Define class for mouse-tracking plugin
class mousetrap_response(item.item, mouse_response_mixin):

    initial_view = u'controls'
    description = u'Tracks mouse movements'

    def reset(self):
        """
		desc:
			Initialize plug-in.
		"""

        # Set default values for variables
Example #57
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OpenSesame.  If not, see <http://www.gnu.org/licenses/>.
"""

from libopensesame.py3compat import *
import sys
from qtpy import QtWidgets, QtCore
from libopensesame import plugins
from libopensesame.exceptions import osexception
from libqtopensesame.misc.base_subcomponent import base_subcomponent
from libqtopensesame.misc.translate import translation_context
_ = translation_context(u'extension_manager', category=u'core')

def suspend_events(fnc):

	"""
	desc:
		A decorator that causes all the extension manager to be suspended while
		the function is executed.
	"""

	def inner(self, *args, **kwdict):

		self.extension_manager.suspend()
		retval = fnc(self, *args, **kwdict)
		self.extension_manager.resume()
		return retval