本文整理汇总了Python中psychopy.experiment.components._translate函数的典型用法代码示例。如果您正苦于以下问题:Python _translate函数的具体用法?Python _translate怎么用?Python _translate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_translate函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, exp, parentName, name='aperture', units='norm',
size=1, pos=(0, 0),
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
startEstim='', durationEstim=''):
# initialise main parameters
super(ApertureComponent, self).__init__(
exp, parentName, name=name, units=units,
pos=pos, size=size,
startType=startType, startVal=startVal,
stopType=stopType, stopVal=stopVal,
startEstim=startEstim, durationEstim=durationEstim)
self.type = 'Aperture'
self.url = "http://www.psychopy.org/builder/components/aperture.html"
# params:
# NB make some adjustments on the params defined by _visual component
self.order = ['name', 'size', 'pos'] # make sure this is at top
msg = _translate(
"How big is the aperture? (a single number for diameter)")
self.params['size'].hint = msg
# only localize hints and labels
self.params['size'].label = _translate("Size")
self.params['pos'].hint = _translate("Where is the aperture centred?")
# inherited from _visual component but not needed
del self.params['ori']
del self.params['color']
del self.params['colorSpace']
del self.params['opacity']
开发者ID:flipphillips,项目名称:psychopy,代码行数:31,代码来源:__init__.py
示例2: __init__
def __init__(self, exp, parentName, name='sound_1', sound='A', volume=1,
startType='time (s)', startVal='0.0',
stopType='duration (s)', stopVal='1.0',
startEstim='', durationEstim=''):
super(SoundComponent, self).__init__(
exp, parentName, name,
startType=startType, startVal=startVal,
stopType=stopType, stopVal=stopVal,
startEstim=startEstim, durationEstim=durationEstim)
self.type = 'Sound'
self.url = "http://www.psychopy.org/builder/components/sound.html"
self.exp.requirePsychopyLibs(['sound'])
# params
self.params['stopType'].allowedVals = ['duration (s)']
self.params['stopType'].hint = _translate('The maximum duration of a'
' sound in seconds')
hnt = _translate("When does the component end? (blank to use the "
"duration of the media)")
self.params['stopVal'].hint = hnt
hnt = _translate("A sound can be a note name (e.g. A or Bf), a number"
" to specify Hz (e.g. 440) or a filename")
self.params['sound'] = Param(
sound, valType='str', allowedTypes=[], updates='constant',
allowedUpdates=['constant', 'set every repeat'],
hint=hnt,
label=_localized['sound'])
_allowed = ['constant', 'set every repeat', 'set every frame']
self.params['volume'] = Param(
volume, valType='code', allowedTypes=[], updates='constant',
allowedUpdates=_allowed[:], # use a copy
hint=_translate("The volume (in range 0 to 1)"),
label=_localized["volume"])
开发者ID:shigeakinishina,项目名称:psychopy,代码行数:33,代码来源:__init__.py
示例3: __init__
def __init__(self, exp, parentName, name='mic_1',
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=2.0, startEstim='',
durationEstim='', stereo=False, channel=0):
super(MicrophoneComponent, self).__init__(
exp, parentName, name=name,
startType=startType, startVal=startVal,
stopType=stopType, stopVal=stopVal,
startEstim=startEstim, durationEstim=durationEstim)
self.type = 'Microphone'
self.url = "http://www.psychopy.org/builder/components/microphone.html"
self.exp.requirePsychopyLibs(['microphone'])
# params
msg = _translate(
"Record two channels (stereo) or one (mono, smaller file)")
self.params['stereo'] = Param(
stereo, valType='bool',
hint=msg,
label=_localized['stereo'])
self.params['stopType'].allowedVals = ['duration (s)']
msg = _translate(
'The duration of the recording in seconds; blank = 0 sec')
self.params['stopType'].hint = msg
msg = _translate("Enter a channel number. Default value is 0. If unsure, run 'sound.backend.get_input_devices()' to locate the system's selected device/channel.")
self.params['channel'] = Param(channel, valType='int', hint=msg, label=_localized['channel'])
开发者ID:hsogo,项目名称:psychopy,代码行数:31,代码来源:__init__.py
示例4: __init__
def __init__(self, exp, parentName, name='code',
beginExp="", beginRoutine="", eachFrame="", endRoutine="",
endExperiment=""):
super(CodeComponent, self).__init__(exp, parentName, name)
self.type = 'Code'
self.url = "http://www.psychopy.org/builder/components/code.html"
# params
# want a copy, else codeParamNames list gets mutated
self.order = ['name', 'Begin Experiment', 'Begin Routine',
'Each Frame', 'End Routine', 'End Experiment']
msg = _translate("Code at the start of the experiment (initialization"
"); right-click checks syntax")
self.params['Begin Experiment'] = Param(
beginExp, valType='extendedCode', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['Begin Experiment'])
msg = _translate("Code to be run at the start of each repeat of the "
"Routine (e.g. each trial); "
"right-click checks syntax")
self.params['Begin Routine'] = Param(
beginRoutine, valType='extendedCode', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['Begin Routine'])
msg = _translate("Code to be run on every video frame during for the"
" duration of this Routine; "
"right-click checks syntax")
self.params['Each Frame'] = Param(
eachFrame, valType='extendedCode', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['Each Frame'])
msg = _translate("Code at the end of this repeat of the Routine (e.g."
" getting/storing responses); "
"right-click checks syntax")
self.params['End Routine'] = Param(
endRoutine, valType='extendedCode', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['End Routine'])
msg = _translate("Code at the end of the entire experiment (e.g. "
"saving files, resetting computer); "
"right-click checks syntax")
self.params['End Experiment'] = Param(
endExperiment, valType='extendedCode', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['End Experiment'])
# these inherited params are harmless but might as well trim:
for p in ('startType', 'startVal', 'startEstim', 'stopVal',
'stopType', 'durationEstim'):
del self.params[p]
开发者ID:ChenTzuYin,项目名称:psychopy,代码行数:60,代码来源:__init__.py
示例5: __init__
def __init__(self, exp, parentName, name='movie', movie='',
units='from exp settings',
pos=(0, 0), size='', ori=0,
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
startEstim='', durationEstim='',
forceEndRoutine=False, backend='moviepy',
noAudio=False):
super(MovieComponent, self).__init__(
exp, parentName, name=name, units=units,
pos=pos, size=size, ori=ori,
startType=startType, startVal=startVal,
stopType=stopType, stopVal=stopVal,
startEstim=startEstim, durationEstim=durationEstim)
self.type = 'Movie'
self.url = "http://www.psychopy.org/builder/components/movie.html"
# comes immediately after name and timing params
self.order = ['forceEndRoutine']
self.targets = ['PsychoPy', 'PsychoJS']
# params
self.params['stopVal'].hint = _translate(
"When does the component end? (blank to use the duration of "
"the media)")
msg = _translate("A filename for the movie (including path)")
self.params['movie'] = Param(
movie, valType='str', allowedTypes=[],
updates='constant', allowedUpdates=['constant', 'set every repeat'],
hint=msg,
label=_localized['movie'])
msg = _translate("What underlying lib to use for loading movies")
self.params['backend'] = Param(
backend, valType='str',
allowedVals=['moviepy', 'avbin', 'opencv'],
hint=msg,
label=_localized['backend'])
# todo: msg = _translate(...)
msg = _translate("Prevent the audio stream from being loaded/processed "
"(moviepy and opencv only)")
self.params["No audio"] = Param(
noAudio, valType='bool',
hint=msg,
label=_localized['No audio'])
msg = _translate("Should the end of the movie cause the end of "
"the routine (e.g. trial)?")
self.params['forceEndRoutine'] = Param(
forceEndRoutine, valType='bool', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['forceEndRoutine'])
# these are normally added but we don't want them for a movie
del self.params['color']
del self.params['colorSpace']
开发者ID:hoechenberger,项目名称:psychopy,代码行数:59,代码来源:__init__.py
示例6: __init__
def __init__(self, exp, parentName, name='buttonBox',
store='first key',
useTimer=True, deviceNumber=0, allowedKeys="",
getReleaseTime=False, # not yet supported
forceEndRoutine=True, storeCorrect=False, correctAns="",
discardPrev=True,
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
startEstim='', durationEstim='',):
super(cedrusButtonBoxComponent, self).__init__(
exp, parentName, name=name,
allowedKeys=allowedKeys, store=store, discardPrev=discardPrev,
forceEndRoutine=forceEndRoutine, storeCorrect=storeCorrect,
correctAns=correctAns, startType=startType, startVal=startVal,
stopType=stopType, stopVal=stopVal,
startEstim=startEstim, durationEstim=durationEstim)
self.type = 'cedrusButtonBox'
self.url = "http://www.psychopy.org/builder/components/cedrusButtonBox.html"
self.exp.requirePsychopyLibs(['hardware'])
self.params['correctAns'].hint = _translate(
"What is the 'correct' response? NB, buttons are labelled 0 to "
"6 on a 7-button box. Enter 'None' (no quotes) if withholding "
"a response is correct. Might be helpful to add a correctAns "
"column and use $correctAns to compare to the key press.")
self.params['correctAns'].valType = 'code'
self.params['allowedKeys'].hint = _translate(
'Keys to be read (blank for any) or key numbers separated by '
'commas')
msg = _translate('Device number, if you have multiple devices which'
' one do you want (0, 1, 2...)')
self.params['deviceNumber'] = Param(
deviceNumber, valType='code', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['deviceNumber'], categ='Advanced')
# self.params['getReleaseTime'] = Param(getReleaseTime,
# valType='bool', allowedVals=[True, False],
# updates='constant', allowedUpdates=[],
# hint="Wait for the key to be released and store the time
# that it was held down",
# label="Get release time")
msg = _translate('According to Cedrus the response box timer has '
'a drift - use with caution!')
self.params['useBoxTimer'] = Param(
getReleaseTime, valType='bool', allowedVals=[True, False],
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['useBoxTimer'], categ='Advanced')
开发者ID:dgfitch,项目名称:psychopy,代码行数:56,代码来源:__init__.py
示例7: Copyright
"""
Part of the PsychoPy library
Copyright (C) 2018 Jonathan Peirce
Distributed under the terms of the GNU General Public License (GPL).
"""
from __future__ import absolute_import, print_function
from os import path
from psychopy.experiment.components import BaseComponent, Param, getInitVals, _translate
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'sound.png')
tooltip = _translate('Sound: play recorded files or generated sounds')
# only use _localized values for label values, nothing functional:
_localized = {'sound': _translate('Sound'), 'volume': _translate('Volume')}
class SoundComponent(BaseComponent):
"""An event class for presenting sound stimuli"""
categories = ['Stimuli']
def __init__(self, exp, parentName, name='sound_1', sound='A', volume=1,
startType='time (s)', startVal='0.0',
stopType='duration (s)', stopVal='1.0',
startEstim='', durationEstim=''):
super(SoundComponent, self).__init__(
exp, parentName, name,
开发者ID:shigeakinishina,项目名称:psychopy,代码行数:30,代码来源:__init__.py
示例8: Copyright
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2018 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import absolute_import, print_function
from os import path
from psychopy.experiment.components import BaseVisualComponent, Param, getInitVals, _translate
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'envgrating.png')
tooltip = _translate('Envelope Grating: present cyclic textures including 2nd order envelope stimuli, prebuilt or from a '
'file')
# only use _localized values for label values, nothing functional:
_localized = {'carrier': _translate('Carrier texture'),
'ori': _translate('Carrier Orientation'),
'mask': _translate('Mask'),
'sf': _translate('Carrier spatial frequency'),
'phase': _translate('Carrier phase (in cycles)'),
'contrast': _translate('Carrier contrast'),
'texture resolution': _translate('Texture resolution'),
'interpolate': _translate('Interpolate'),
'envelope': _translate('Envelope texture'),
'envsf':_translate('Envelope spatial frequency'),
'envori':_translate('Envelope orientation'),
'envphase':_translate('Envelope phase'),
'moddepth':_translate('Envelope modulation depth'),
开发者ID:ChenTzuYin,项目名称:psychopy,代码行数:32,代码来源:__init__.py
示例9: open
fullPath = os.path.join(thisFolder, relPath)
with open(fullPath, "r") as f:
txt = f.read()
return txt
# used when writing scripts and in namespace:
_numpyImports = ['sin', 'cos', 'tan', 'log', 'log10', 'pi', 'average',
'sqrt', 'std', 'deg2rad', 'rad2deg', 'linspace', 'asarray']
_numpyRandomImports = ['random', 'randint', 'normal', 'shuffle']
# this is not a standard component - it will appear on toolbar not in
# components panel
# only use _localized values for label values, nothing functional:
_localized = {'expName': _translate("Experiment name"),
'Show info dlg': _translate("Show info dialog"),
'Enable Escape': _translate("Enable Escape key"),
'Experiment info': _translate("Experiment info"),
'Data filename': _translate("Data filename"),
'Full-screen window': _translate("Full-screen window"),
'Window size (pixels)': _translate("Window size (pixels)"),
'Screen': _translate('Screen'),
'Monitor': _translate("Monitor"),
'color': _translate("Color"),
'colorSpace': _translate("Color space"),
'Units': _translate("Units"),
'blendMode': _translate("Blend mode"),
'Show mouse': _translate("Show mouse"),
'Save log file': _translate("Save log file"),
'Save wide csv file':
开发者ID:hoechenberger,项目名称:psychopy,代码行数:31,代码来源:__init__.py
示例10: Copyright
# Part of the PsychoPy library
# Copyright (C) 2015 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
# Author: Jeremy R. Gray, 2012
from __future__ import absolute_import, print_function
from os import path
from psychopy.experiment.components import BaseComponent, Param, getInitVals, _translate
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'microphone.png')
tooltip = _translate('Microphone: basic sound capture (fixed onset & '
'duration), okay for spoken words')
_localized = {'stereo': _translate('Stereo')}
class MicrophoneComponent(BaseComponent):
"""An event class for capturing short sound stimuli"""
categories = ['Responses']
def __init__(self, exp, parentName, name='mic_1',
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=2.0, startEstim='',
durationEstim='', stereo=False):
super(MicrophoneComponent, self).__init__(
exp, parentName, name=name,
startType=startType, startVal=startVal,
开发者ID:flipphillips,项目名称:psychopy,代码行数:31,代码来源:__init__.py
示例11: Copyright
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2015 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import absolute_import, print_function
from os import path
from psychopy.experiment.components import BaseComponent, Param, _translate
import re
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'mouse.png')
tooltip = _translate('Mouse: query mouse position and buttons')
# only use _localized values for label values, nothing functional:
_localized = {'saveMouseState': _translate('Save mouse state'),
'forceEndRoutineOnPress': _translate('End Routine on press'),
'timeRelativeTo': _translate('Time relative to'),
'Clickable stimuli': 'Clickable stimuli',
'Store params for clicked': 'Store params for clicked',
'New clicks only': 'New clicks only'}
class MouseComponent(BaseComponent):
"""An event class for checking the mouse location and buttons
at given timepoints
"""
categories = ['Responses']
开发者ID:jonathanoroberts,项目名称:psychopy,代码行数:31,代码来源:__init__.py
示例12: License
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import absolute_import, print_function
from builtins import str
from builtins import range
from past.builtins import basestring
from os import path
from psychopy.experiment.components import BaseComponent, Param, _translate
from psychopy.experiment import CodeGenerationException, valid_var_re
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'keyboard.png')
tooltip = _translate('Keyboard: check and record keypresses')
# only use _localized values for label values, nothing functional:
_localized = {'allowedKeys': _translate('Allowed keys'),
'discard previous': _translate('Discard previous'),
'store': _translate('Store'),
'forceEndRoutine': _translate('Force end of Routine'),
'storeCorrect': _translate('Store correct'),
'correctAns': _translate('Correct answer'),
'syncScreenRefresh': _translate('sync RT with screen')}
class KeyboardComponent(BaseComponent):
"""An event class for checking the keyboard at given timepoints"""
# an attribute of the class, determines the section in components panel
categories = ['Responses']
开发者ID:flipphillips,项目名称:psychopy,代码行数:31,代码来源:__init__.py
示例13: __init__
def __init__(self, exp, parentName,
name='slider',
labels='',
ticks="(1, 2, 3, 4, 5)",
size='(1.0, 0.1)',
pos='(0, -0.4)',
flip=False,
style=['rating'],
granularity=0,
color="LightGray",
font="HelveticaBold",
startType='time (s)', startVal='0.0',
stopType='condition', stopVal='',
startEstim='', durationEstim='',
forceEndRoutine=True,
storeRating=True, storeRatingTime=True, storeHistory=False):
super(SliderComponent, self).__init__(
exp, parentName, name,
startType=startType, startVal=startVal,
stopType=stopType, stopVal=stopVal,
startEstim=startEstim, durationEstim=durationEstim)
self.type = 'SliderComponent'
self.url = "http://www.psychopy.org/builder/components/slidercomponent.html"
self.exp.requirePsychopyLibs(['visual', 'event'])
# params
self.order = ['name',
'size', 'pos',
'ticks', 'labels', 'granularity',
'font','flip','color','styles',
]
# normal params:
# = the usual as inherited from BaseVisual plus:
self.params['ticks'] = Param(
ticks, valType='list', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat'],
hint=_translate("Tick positions (numerical) on the scale, "
"separated by commas"),
label=_localized['ticks'])
self.params['labels'] = Param(
labels, valType='list', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat'],
hint=_translate("Labels for the tick marks on the scale, "
"separated by commas"),
label=_localized['labels'])
self.params['granularity'] = Param(
granularity, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat'],
hint=_translate("Specifies the minimum step size "
"(0 for a continuous scale, 1 for integer "
"rating scale)"),
label=_translate('Granularity'))
self.params['forceEndRoutine'] = Param(
forceEndRoutine, valType='bool', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=_translate("Should setting a rating (releasing the mouse) "
"cause the end of the routine (e.g. trial)?"),
label=_localized['forceEndRoutine'])
self.params['pos'] = Param(
pos, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat',
'set every frame'],
hint=_translate("x,y position on the screen"),
label=_localized['pos'])
self.params['size'] = Param(
size, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat',
'set every frame'],
hint=_translate(
"Size on screen. e.g. (500,10) pix for horizontal,"
"(10,500) pix for vertical"),
label=_localized['size'])
# advanced params:
self.params['flip'] = Param(
flip, valType='bool',
updates='constant', allowedUpdates=[],
hint=_translate(
"By default the labels will be on the bottom or "
"left of the scale, but this can be flipped to the "
"other side."),
label=_translate('Flip'),
categ='Appearance')
self.params['color'] = Param(
color, valType='str',
updates='constant',
allowedUpdates=['constant', 'set every repeat',
'set every frame'],
hint=_translate(
"Color of the lines and labels (might be"
"overridden by the style setting)"),
label=_translate('Color'),
categ='Appearance')
self.params['font'] = Param(
#.........这里部分代码省略.........
开发者ID:mmagnuski,项目名称:psychopy,代码行数:101,代码来源:__init__.py
示例14: Copyright
# Copyright (C) 2015 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import absolute_import, print_function
from os import path
from psychopy.experiment.components import BaseVisualComponent, Param, \
getInitVals, _translate
from psychopy.visual import slider
__author__ = 'Jon Peirce'
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'slider.png')
tooltip = _translate('Slider: A simple, flexible object for getting ratings')
# only use _localized values for label values, nothing functional:
_localized = {
'categoryChoices': _translate('Category choices'),
'labels': _translate('Labels'),
'ticks': _translate('Ticks'),
'size': _translate('Size'),
'pos': _translate('Position [x,y]'),
'forceEndRoutine': _translate('Force end of Routine'),
'storeHistory': _translate('Store history'),
'storeRating': _translate('Store rating'),
'storeRatingTime': _translate('Store rating time')}
knownStyles = slider.Slider.knownStyles
开发者ID:mmagnuski,项目名称:psychopy,代码行数:30,代码来源:__init__.py
示例15: _translate
from __future__ import absolute_import, print_function
from builtins import str
from past.builtins import basestring
from os import path
from psychopy.experiment.components import Param, _translate
from psychopy.experiment.components.keyboard import KeyboardComponent
from psychopy.experiment import CodeGenerationException, valid_var_re
__author__ = 'Jon Peirce'
# abs path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'cedrusBox.png')
tooltip = _translate('Cedrus Button Box: Cedrus response boxes, using the '
'pyxid library provided by Cedrus')
# only use _localized values for label values, nothing functional:
_localized = {'deviceNumber': _translate('Device number'),
'useBoxTimer': _translate("Use box timer")}
class cedrusButtonBoxComponent(KeyboardComponent):
"""An event class for checking an Cedrus RBxxx button boxes
using XID library
This is based on keyboard component, several important differences:
- no special response class analogous to event.BuilderKeyResponse()
- enabled responses (active keys) are handled by the hardware device
More than one component in a routine will produce conflicts between
开发者ID:flipphillips,项目名称:psychopy,代码行数:32,代码来源:__init__.py
示例16: __init__
def __init__(self, exp, parentName, name='mouse',
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
startEstim='', durationEstim='',
save='final', forceEndRoutineOnPress="any click",
timeRelativeTo='routine'):
super(MouseComponent, self).__init__(
exp, parentName, name=name,
startType=startType, startVal=startVal,
stopType=stopType, stopVal=stopVal,
startEstim=startEstim, durationEstim=durationEstim)
self.type = 'Mouse'
self.url = "http://www.psychopy.org/builder/components/mouse.html"
self.exp.requirePsychopyLibs(['event'])
self.categories = ['Inputs']
self.order += [
'forceEndRoutineOnPress',
'saveMouseState', 'timeRelativeTo',
'newClicksOnly', 'clickable', 'saveParamsClickable']
# params
msg = _translate(
"How often should the mouse state (x,y,buttons) be stored? "
"On every video frame, every click or just at the end of the "
"Routine?")
self.params['saveMouseState'] = Param(
save, valType='str',
allowedVals=['final', 'on click', 'every frame', 'never'],
hint=msg,
label=_localized['saveMouseState'])
msg = _translate("Should a button press force the end of the routine"
" (e.g end the trial)?")
if forceEndRoutineOnPress is True:
forceEndRoutineOnPress = 'any click'
elif forceEndRoutineOnPress is False:
forceEndRoutineOnPress = 'never'
self.params['forceEndRoutineOnPress'] = Param(
forceEndRoutineOnPress, valType='str',
allowedVals=['never', 'any click', 'valid click'],
updates='constant',
hint=msg,
label=_localized['forceEndRoutineOnPress'])
msg = _translate("What should the values of mouse.time should be "
"relative to?")
self.params['timeRelativeTo'] = Param(
timeRelativeTo, valType='str',
allowedVals=['experiment', 'routine'],
updates='constant',
hint=msg,
label=_localized['timeRelativeTo'])
msg = _translate('If the mouse button is already down when we start'
'checking then wait for it to be released before'
'recording as a new click.'
)
self.params['newClicksOnly'] = Param(
True, valType='bool',
updates='constant',
hint=msg,
label=_localized['New clicks only'])
msg = _translate('A comma-separated list of your stimulus names that '
'can be "clicked" by the participant. '
'e.g. target, foil'
)
self.params['clickable'] = Param(
'', valType='code',
updates='constant',
hint=msg,
label=_localized['Clickable stimuli'])
msg = _translate('The params (e.g. name, text), for which you want '
'to store the current value, for the stimulus that was'
'"clicked" by the mouse. Make sure that all the '
'clickable objects have all these params.'
)
self.params['saveParamsClickable'] = Param(
'name,', valType='code',
updates='constant', allowedUpdates=[],
hint=msg,
label=_localized['Store params for clicked'])
开发者ID:jonathanoroberts,项目名称:psychopy,代码行数:85,代码来源:__init__.py
示例17: Copyright
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2018 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import absolute_import, print_function
from os import path
from psychopy.experiment.components import BaseVisualComponent, getInitVals, Param, _translate
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'movie.png')
tooltip = _translate('Movie: play movie files')
# only use _localized values for label values, nothing functional:
_localized = {'movie': _translate('Movie file'),
'forceEndRoutine': _translate('Force end of Routine'),
'backend': _translate('backend'),
'No audio': _translate('No audio')}
class MovieComponent(BaseVisualComponent):
"""An event class for presenting movie-based stimuli"""
def __init__(self, exp, parentName, name='movie', movie='',
units='from exp settings',
pos=(0, 0), size='', ori=0,
startType='time (s)', startVal=0.0,
开发者ID:hoechenberger,项目名称:psychopy,代码行数:31,代码来源:__init__.py
注:本文中的psychopy.experiment.components._translate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论