psychopy 2024.2.1__py3-none-any.whl → 2024.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of psychopy might be problematic. Click here for more details.
- psychopy/.DS_Store +0 -0
- psychopy/GIT_SHA +1 -1
- psychopy/VERSION +1 -1
- psychopy/__init__.py +10 -1
- psychopy/__init__.py.orig +65 -0
- psychopy/app/{locale/ar_001/.DS_Store → .DS_Store} +0 -0
- psychopy/app/Resources/.DS_Store +0 -0
- psychopy/app/_psychopyApp.py +11 -3
- psychopy/app/appData.spec +1 -1
- psychopy/app/builder/builder.py +1 -1
- psychopy/app/builder/builder.py.orig +3932 -0
- psychopy/app/builder/dialogs/__init__.py.orig +1679 -0
- psychopy/app/builder/dialogs/paramCtrls.py +1 -1
- psychopy/app/builder/dialogs/paramCtrls.py.orig +713 -0
- psychopy/app/colorpicker/__init__.py.orig +411 -0
- psychopy/app/cortex.log +0 -0
- psychopy/app/jobs.py +8 -1
- psychopy/app/locale/ar_001/LC_MESSAGE/messages.po +2452 -1731
- psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN.mo +0 -0
- psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN.po +6127 -0
- psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN_allFlagged.mo +0 -0
- psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN_allFlagged.po +7366 -0
- psychopy/app/plugin_manager/dialog.py +9 -7
- psychopy/app/ribbon.py +2 -1
- psychopy/app/runner/runner.py +7 -5
- psychopy/clock.py +8 -4
- psychopy/core.py.orig +169 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/index.html +23 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/randomisedBlocks-legacy-browsers.js +423 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/randomisedBlocks.js +427 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/chooseBlock.xlsx +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/facesBlock.xlsx +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/housesBlock.xlsx +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face01.jpg +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face02.jpg +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face03.jpg +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house01.jpg +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house02.jpg +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house03.jpg +0 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/randomisedBlocks.py +330 -0
- psychopy/demos/builder/Design Templates/randomisedBlocks/randomisedBlocks_lastrun.py +330 -0
- psychopy/demos/builder/Feature Demos/eyetracking/eyetracking.xml +298 -0
- psychopy/demos/builder/Feature Demos/eyetracking/eyetracking.xsd +120 -0
- psychopy/demos/builder/Tools/.DS_Store +0 -0
- psychopy/demos/builder/Tools/gammaCalibration/.DS_Store +0 -0
- psychopy/demos/builder/Tools/gammaCalibration/data/_gamma_correction_visual_2022-05-18_14h18.29.439.csv +38 -0
- psychopy/demos/builder/Tools/gammaCalibration/data/_gamma_correction_visual_2022-05-18_14h18.29.439.log +3418 -0
- psychopy/demos/builder/Tools/gammaCalibration/data/_gamma_correction_visual_2022-05-18_14h18.29.439.psydat +0 -0
- psychopy/demos/builder/Tools/gammaCalibration/data/x1_gamma_correction_visual_2022-05-17_13h59.42.928.csv +2 -0
- psychopy/demos/builder/Tools/gammaCalibration/data/x1_gamma_correction_visual_2022-05-17_13h59.42.928.log +15 -0
- psychopy/demos/builder/Tools/gammaCalibration/data/x1_gamma_correction_visual_2022-05-17_13h59.42.928.psydat +0 -0
- psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual.psyexp +323 -0
- psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual.py +562 -0
- psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual_lastrun.py +562 -0
- psychopy/demos/builder/Tools/gammaCalibration/questStairs.xlsx +0 -0
- psychopy/demos/builder/Tools/gammaCalibration/readme.md +0 -0
- psychopy/demos/builder/Tools/gammaCalibration/resources/low_contrast.png +0 -0
- psychopy/demos/builder/Tools/gammaCalibration/resources/make_2nd_order_tex.py +59 -0
- psychopy/demos/builder/Tools/gammaCalibration/resources/second_order_tex.png +0 -0
- psychopy/demos/coder/.DS_Store +0 -0
- psychopy/demos/coder/experiment control/info_gamma.pickle +0 -0
- psychopy/demos/coder/iohub/.iohpid +1 -0
- psychopy/demos/coder/iohub/eyetracking/.iohpid +1 -0
- psychopy/demos/coder/iohub/wintab/.DS_Store +0 -0
- psychopy/demos/coder/stimuli/.DS_Store +0 -0
- psychopy/demos/coder/stimuli/radialGratingContracting.py +29 -0
- psychopy/experiment/_experiment.py.orig +1032 -0
- psychopy/experiment/components/.DS_Store +0 -0
- psychopy/experiment/components/_base.py +13 -4
- psychopy/experiment/components/_base.py.orig +823 -0
- psychopy/experiment/components/form/.DS_Store +0 -0
- psychopy/experiment/components/microphone/__init__.py +10 -1
- psychopy/experiment/components/microphone/__init__.py.orig +490 -0
- psychopy/experiment/components/polygon/__init__.py +21 -22
- psychopy/experiment/components/settings/__init__.py +13 -14
- psychopy/experiment/components/settings/__init__.py.orig +1337 -0
- psychopy/experiment/components/textbox/__init__.py.orig +310 -0
- psychopy/experiment/components/webcam/.DS_Store +0 -0
- psychopy/experiment/components/webcam/light/.DS_Store +0 -0
- psychopy/experiment/flow.py +10 -8
- psychopy/experiment/loops.py.orig +829 -0
- psychopy/experiment/params.py +8 -3
- psychopy/experiment/params.py.orig +408 -0
- psychopy/experiment/routine.py.orig +503 -0
- psychopy/experiment/routines/_base.py +15 -6
- psychopy/experiment/routines/counterbalance/__init__.py +1 -0
- psychopy/gui/qtgui.py +14 -7
- psychopy/gui/util.py +10 -14
- psychopy/gui/wxgui.py +10 -4
- psychopy/hardware/.DS_Store +0 -0
- psychopy/hardware/brainproducts.py.orig +680 -0
- psychopy/hardware/iolab.py.orig +238 -0
- psychopy/hardware/manager.py +1 -1
- psychopy/hardware/photodiode.py +59 -27
- psychopy/hardware/serialport.py +51 -0
- psychopy/hardware/speaker.py +4 -4
- psychopy/iohub/datastore/__init__.py.orig +443 -0
- psychopy/iohub/datastore/util.py.orig +692 -0
- psychopy/iohub/devices/mouse/darwin.py.orig +427 -0
- psychopy/iohub/devices/mouse/linux2.py.orig +198 -0
- psychopy/preferences/.DS_Store +0 -0
- psychopy/projects/pavlovia.py +10 -3
- psychopy/projects/pavlovia.py.orig +1295 -0
- psychopy/sound/backend_ptb.py +22 -5
- psychopy/sound/transcribe.py +24 -4
- psychopy/tests/.DS_Store +0 -0
- psychopy/tests/data/.DS_Store +0 -0
- psychopy/tests/data/TestCircle_fill_local.png +0 -0
- psychopy/tests/data/__test.png +0 -0
- psychopy/tests/data/aperture1_normHexbackground_local.png +0 -0
- psychopy/tests/data/aperture1_norm_local.png +0 -0
- psychopy/tests/data/aperture2_normHexbackground_local.png +0 -0
- psychopy/tests/data/beatandrcos_height_local.png +0 -0
- psychopy/tests/data/beatandrcos_normAddBlend_local.png +0 -0
- psychopy/tests/data/beatandrcos_normHexbackground_local.png +0 -0
- psychopy/tests/data/beatandrcos_norm_local.png +0 -0
- psychopy/tests/data/beatandrcos_stencil_local.png +0 -0
- psychopy/tests/data/blend_add_height_local.png +0 -0
- psychopy/tests/data/blend_add_normAddBlend_local.png +0 -0
- psychopy/tests/data/blend_add_normHexbackground_local.png +0 -0
- psychopy/tests/data/blend_add_normNoShade_local.png +0 -0
- psychopy/tests/data/blend_add_norm_local.png +0 -0
- psychopy/tests/data/blend_add_stencil_local.png +0 -0
- psychopy/tests/data/bufferimg_gabor_height_local.png +0 -0
- psychopy/tests/data/bufferimg_gabor_normAddBlend_local.png +0 -0
- psychopy/tests/data/bufferimg_gabor_normHexbackground_local.png +0 -0
- psychopy/tests/data/bufferimg_gabor_normNoShade_local.png +0 -0
- psychopy/tests/data/bufferimg_gabor_norm_local.png +0 -0
- psychopy/tests/data/bufferimg_gabor_stencil_local.png +0 -0
- psychopy/tests/data/circleHex_height_local.png +0 -0
- psychopy/tests/data/circleHex_normAddBlend_local.png +0 -0
- psychopy/tests/data/circleHex_normHexbackground_local.png +0 -0
- psychopy/tests/data/circleHex_normNoShade_local.png +0 -0
- psychopy/tests/data/circleHex_norm_local.png +0 -0
- psychopy/tests/data/circleHex_stencil_local.png +0 -0
- psychopy/tests/data/color_comparison_local.png +0 -0
- psychopy/tests/data/corrFullRandom_local.csv +16 -0
- psychopy/tests/data/corrFullRandom_local.tsv +6 -0
- psychopy/tests/data/correctScript/.DS_Store +0 -0
- psychopy/tests/data/dots_height_local.png +0 -0
- psychopy/tests/data/dots_normAddBlend_local.png +0 -0
- psychopy/tests/data/dots_normHexbackground_local.png +0 -0
- psychopy/tests/data/dots_normNoShade_local.png +0 -0
- psychopy/tests/data/dots_norm_local.png +0 -0
- psychopy/tests/data/dots_stencil_local.png +0 -0
- psychopy/tests/data/elarray1_height_local.png +0 -0
- psychopy/tests/data/elarray1_normAddBlend_local.png +0 -0
- psychopy/tests/data/elarray1_normHexbackground_local.png +0 -0
- psychopy/tests/data/elarray1_norm_local.png +0 -0
- psychopy/tests/data/elarray1_stencil_local.png +0 -0
- psychopy/tests/data/envelopeandrcos_height_local.png +0 -0
- psychopy/tests/data/envelopeandrcos_normAddBlend_local.png +0 -0
- psychopy/tests/data/envelopeandrcos_normHexbackground_local.png +0 -0
- psychopy/tests/data/envelopeandrcos_norm_local.png +0 -0
- psychopy/tests/data/envelopeandrcos_stencil_local.png +0 -0
- psychopy/tests/data/envelopepowerandrcos_height_local.png +0 -0
- psychopy/tests/data/envelopepowerandrcos_normAddBlend_local.png +0 -0
- psychopy/tests/data/envelopepowerandrcos_normHexbackground_local.png +0 -0
- psychopy/tests/data/envelopepowerandrcos_norm_local.png +0 -0
- psychopy/tests/data/envelopepowerandrcos_stencil_local.png +0 -0
- psychopy/tests/data/gabor1_height_local.png +0 -0
- psychopy/tests/data/gabor1_normAddBlend_local.png +0 -0
- psychopy/tests/data/gabor1_normHexbackground_local.png +0 -0
- psychopy/tests/data/gabor1_normNoShade_local.png +0 -0
- psychopy/tests/data/gabor1_norm_local.png +0 -0
- psychopy/tests/data/gabor1_stencil_local.png +0 -0
- psychopy/tests/data/greyscale_normHexbackground_local.png +0 -0
- psychopy/tests/data/imageAndGauss_height_local.png +0 -0
- psychopy/tests/data/imageAndGauss_normAddBlend_local.png +0 -0
- psychopy/tests/data/imageAndGauss_normHexbackground_local.png +0 -0
- psychopy/tests/data/imageAndGauss_normNoShade_local.png +0 -0
- psychopy/tests/data/imageAndGauss_norm_local.png +0 -0
- psychopy/tests/data/imageAndGauss_stencil_local.png +0 -0
- psychopy/tests/data/movFrame1_stencil_local.png +0 -0
- psychopy/tests/data/noiseAndRcos_height_local.png +0 -0
- psychopy/tests/data/noiseAndRcos_normAddBlend_local.png +0 -0
- psychopy/tests/data/noiseAndRcos_normHexbackground_local.png +0 -0
- psychopy/tests/data/noiseAndRcos_normNoShade_local.png +0 -0
- psychopy/tests/data/noiseAndRcos_norm_local.png +0 -0
- psychopy/tests/data/noiseAndRcos_stencil_local.png +0 -0
- psychopy/tests/data/noiseFiltersAndRcos_height_local.png +0 -0
- psychopy/tests/data/noiseFiltersAndRcos_normAddBlend_local.png +0 -0
- psychopy/tests/data/noiseFiltersAndRcos_normHexbackground_local.png +0 -0
- psychopy/tests/data/noiseFiltersAndRcos_normNoShade_local.png +0 -0
- psychopy/tests/data/noiseFiltersAndRcos_norm_local.png +0 -0
- psychopy/tests/data/noiseFiltersAndRcos_stencil_local.png +0 -0
- psychopy/tests/data/numpyImage_height_local.png +0 -0
- psychopy/tests/data/numpyImage_normAddBlend_local.png +0 -0
- psychopy/tests/data/numpyImage_normHexbackground_local.png +0 -0
- psychopy/tests/data/numpyImage_normNoShade_local.png +0 -0
- psychopy/tests/data/numpyImage_norm_local.png +0 -0
- psychopy/tests/data/numpyImage_stencil_local.png +0 -0
- psychopy/tests/data/shape2_1_normAddBlend_local.png +0 -0
- psychopy/tests/data/shape2_1_normHexbackground_local.png +0 -0
- psychopy/tests/data/shape2_1_normNoShade_local.png +0 -0
- psychopy/tests/data/shape2_1_norm_local.png +0 -0
- psychopy/tests/data/shape2_1_stencil_local.png +0 -0
- psychopy/tests/data/testLoopsBlocks.psyexp_local.py +328 -0
- psychopy/tests/data/text1_height_local.png +0 -0
- psychopy/tests/data/text1_normAddBlend_local.png +0 -0
- psychopy/tests/data/text1_normHexbackground_local.png +0 -0
- psychopy/tests/data/text1_norm_local.png +0 -0
- psychopy/tests/data/text1_stencil_local.png +0 -0
- psychopy/tests/data/text2_height.png +0 -0
- psychopy/tests/data/text2_normAddBlend.png +0 -0
- psychopy/tests/data/text2_normHexbackground.png +0 -0
- psychopy/tests/data/text2_stencil.png +0 -0
- psychopy/tests/data/wedge1_height_local.png +0 -0
- psychopy/tests/data/wedge1_normAddBlend_local.png +0 -0
- psychopy/tests/data/wedge1_normHexbackground_local.png +0 -0
- psychopy/tests/data/wedge1_normNoShade_local.png +0 -0
- psychopy/tests/data/wedge1_norm_local.png +0 -0
- psychopy/tests/data/wedge1_stencil_local.png +0 -0
- psychopy/tests/test_app/.DS_Store +0 -0
- psychopy/tests/test_app/test_builder/.DS_Store +0 -0
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.csv +9 -0
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.log +177 -0
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.psydat +0 -0
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.xlsx +0 -0
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.csv +9 -0
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.log +168 -0
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.psydat +0 -0
- psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.xlsx +0 -0
- psychopy/tests/test_data/.DS_Store +0 -0
- psychopy/tests/test_hardware/test_CRS_BitsSharp.py.orig +68 -0
- psychopy/tests/test_tools/test_arraytools.py +112 -0
- psychopy/tests/test_visual/test_image.py.orig +219 -0
- psychopy/tools/arraytools.py +47 -0
- psychopy/tools/versionchooser.py +1 -1
- psychopy/visual/backends/pygletbackend.py +26 -8
- psychopy/visual/basevisual.py.orig +1723 -0
- psychopy/visual/form.py.orig +1181 -0
- psychopy/visual/text.py.orig +752 -0
- psychopy/visual/textbox2/textbox2.py.orig +1315 -0
- psychopy/visual/window.py +13 -5
- psychopy/visual/windowwarp.py.orig +463 -0
- {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/METADATA +9 -9
- {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/RECORD +244 -78
- {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/WHEEL +1 -1
- {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/entry_points.txt +2 -0
- psychopy/app/locale/ar_001/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/cs_CZ/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/da_DK/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/de_DE/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/el_GR/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/en_NZ/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/en_US/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/es_CO/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/es_ES/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/es_US/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/et_EE/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/fa_IR/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/fi_FI/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/fr_FR/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/he_IL/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/hi_IN/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/hu_HU/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/it_IT/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/ja_JP/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/ko_KR/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/ms_MY/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/nl_NL/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/nn_NO/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/pl_PL/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/pt_PT/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/ro_RO/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/ru_RU/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/sv_SE/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/tr_TR/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/zh_CN/LC_MESSAGE/messages.mo +0 -0
- psychopy/app/locale/zh_TW/LC_MESSAGE/messages.mo +0 -0
- psychopy-2024.2.1.dist-info/licenses/AUTHORS.md +0 -138
- /psychopy/{app/locale/ar_001/LC_MESSAGE → demos/builder}/.DS_Store +0 -0
- /psychopy/{app/locale/es_ES/LC_MESSAGE → demos/builder/Experiments}/.DS_Store +0 -0
- /psychopy/{visual → demos/builder/Tools/gammaCalibration/data}/.DS_Store +0 -0
- {psychopy-2024.2.1.dist-info → psychopy-2024.2.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Classes for the color picker."""
|
|
3
|
+
|
|
4
|
+
# Part of the PsychoPy library
|
|
5
|
+
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019 Open Science Tools Ltd.
|
|
6
|
+
# Distributed under the terms of the GNU General Public License (GPL).
|
|
7
|
+
|
|
8
|
+
import wx
|
|
9
|
+
from .panels import ColorPresets, ColorPreview
|
|
10
|
+
from .pages import ColorPickerPageHSV, ColorPickerPageRGB
|
|
11
|
+
from psychopy.colors import Color
|
|
12
|
+
|
|
13
|
+
LAST_COLOR = Color((0, 0, 0, 1), space='rgba')
|
|
14
|
+
LAST_OUTPUT_SPACE = 0
|
|
15
|
+
|
|
16
|
+
from psychopy.localization import _translate
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class PsychoColorPicker(wx.Dialog):
|
|
20
|
+
"""Class for the color picker dialog.
|
|
21
|
+
|
|
22
|
+
This dialog is used to standardize color selection across platforms. It also
|
|
23
|
+
supports PsychoPy's RGB representation directly.
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
parent : object
|
|
28
|
+
Reference to a :class:`~wx.Frame` which owns this dialog.
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
def __init__(self, parent):
|
|
32
|
+
<<<<<<< HEAD
|
|
33
|
+
wx.Dialog.__init__(
|
|
34
|
+
self,
|
|
35
|
+
parent,
|
|
36
|
+
id=wx.ID_ANY,
|
|
37
|
+
title=u"Color Picker",
|
|
38
|
+
pos=wx.DefaultPosition,
|
|
39
|
+
size=wx.Size(640, 480),
|
|
40
|
+
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
|
|
41
|
+
|
|
42
|
+
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
|
|
43
|
+
self.SetMinSize(wx.Size(600, 480))
|
|
44
|
+
|
|
45
|
+
# current output color, should be displayed in the preview
|
|
46
|
+
global LAST_COLOR
|
|
47
|
+
self._color = LAST_COLOR.copy()
|
|
48
|
+
|
|
49
|
+
# output spaces mapped to the `cboOutputSpace` object
|
|
50
|
+
self._spaces = {
|
|
51
|
+
0: 'rgba',
|
|
52
|
+
1: 'rgb',
|
|
53
|
+
2: 'rgba1',
|
|
54
|
+
3: 'rgb1',
|
|
55
|
+
4: 'rgba255',
|
|
56
|
+
5: 'rgb255',
|
|
57
|
+
6: 'hex',
|
|
58
|
+
7: 'hsva',
|
|
59
|
+
8: 'hsv'
|
|
60
|
+
}
|
|
61
|
+
# what to show in the output selection, maps to the spaces above
|
|
62
|
+
self._outputChoices = [
|
|
63
|
+
u'PsychoPy RGBA (rgba)',
|
|
64
|
+
u'PsychoPy RGB (rgb)',
|
|
65
|
+
u'Normalized RGBA (rgba1)',
|
|
66
|
+
u'Normalized RGB (rgb1)',
|
|
67
|
+
u'8-bit RGBA (rgba255)',
|
|
68
|
+
u'8-bit RGBA (rgb255)',
|
|
69
|
+
u'Hex/HTML (hex)',
|
|
70
|
+
u'Hue-Saturation-Value-Alpha (hsva)',
|
|
71
|
+
u'Hue-Saturation-Value (hsv)'
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
# initialize the window controls
|
|
75
|
+
self._setupUI()
|
|
76
|
+
=======
|
|
77
|
+
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=_translate("Color Picker"), pos=wx.DefaultPosition,
|
|
78
|
+
style=wx.DEFAULT_DIALOG_STYLE)
|
|
79
|
+
# Set main params
|
|
80
|
+
self.color = Color((0,0,0,1), 'rgba')
|
|
81
|
+
self.sizer = wx.GridBagSizer()
|
|
82
|
+
# Add colourful top bar
|
|
83
|
+
self.preview = ColorPreview(color=self.color, parent=self)
|
|
84
|
+
self.sizer.Add(self.preview, pos=(0,0), span=wx.GBSpan(2,1), border=5, flag=wx.RIGHT | wx.EXPAND)
|
|
85
|
+
# Add notebook of controls
|
|
86
|
+
self.ctrls = aui.AuiNotebook(self, wx.ID_ANY, size=wx.Size(400, 400), agwStyle=0)
|
|
87
|
+
self.sizer.Add(self.ctrls, pos=(0,1), border=5, flag=wx.ALL)
|
|
88
|
+
self.ctrls.AddPage(ColorPage(self.ctrls, self, 'rgba'), 'RGB (-1 to 1)')
|
|
89
|
+
self.ctrls.AddPage(ColorPage(self.ctrls, self, 'rgba1'), 'RGB (0 to 1)')
|
|
90
|
+
self.ctrls.AddPage(ColorPage(self.ctrls, self, 'rgba255'), 'RGB (0 to 255)')
|
|
91
|
+
self.ctrls.AddPage(ColorPage(self.ctrls, self, 'hsva'), 'HSV')
|
|
92
|
+
self.ctrls.AddPage(ColorPage(self.ctrls, self, 'hex'), 'Hex')
|
|
93
|
+
# Add array of named colours
|
|
94
|
+
self.presets = ColorPresets(parent=self)
|
|
95
|
+
self.sizer.Add(self.presets, pos=(0,2), border=5, flag=wx.ALL)
|
|
96
|
+
# Add buttons
|
|
97
|
+
self.buttons = wx.BoxSizer(wx.HORIZONTAL)
|
|
98
|
+
self.closeButton = wx.Button(self, label=_translate("Close"))
|
|
99
|
+
self.closeButton.Bind(wx.EVT_BUTTON, self.Close)
|
|
100
|
+
self.buttons.Add(self.closeButton, border=5, flag=wx.ALL)
|
|
101
|
+
# Add insert buttons
|
|
102
|
+
# self.insertValueButton = wx.Button(self, label="Insert As Value")
|
|
103
|
+
# self.insertValueButton.Bind(wx.EVT_BUTTON, self.insertValue)
|
|
104
|
+
# self.buttons.Add(self.insertValueButton, border=5, flag=wx.ALL)
|
|
105
|
+
# self.insertObjectButton = wx.Button(self, label="Insert As Object")
|
|
106
|
+
# self.insertObjectButton.Bind(wx.EVT_BUTTON, self.insertObject)
|
|
107
|
+
# self.buttons.Add(self.insertObjectButton, border=5, flag=wx.ALL)
|
|
108
|
+
# Add copy buttons
|
|
109
|
+
self.copyValueButton = wx.Button(self, label=_translate("Copy As Value"))
|
|
110
|
+
self.copyValueButton.Bind(wx.EVT_BUTTON, self.copyValue)
|
|
111
|
+
self.buttons.Add(self.copyValueButton, border=5, flag=wx.ALL)
|
|
112
|
+
self.copyObjectButton = wx.Button(self, label=_translate("Copy As Object"))
|
|
113
|
+
self.copyObjectButton.Bind(wx.EVT_BUTTON, self.copyObject)
|
|
114
|
+
self.buttons.Add(self.copyObjectButton, border=5, flag=wx.ALL)
|
|
115
|
+
|
|
116
|
+
self.sizer.Add(self.buttons, pos=(1,1), span=wx.GBSpan(1,2), border=5, flag=wx.ALL | wx.ALIGN_RIGHT)
|
|
117
|
+
|
|
118
|
+
# Configure sizer
|
|
119
|
+
self.sizer.AddGrowableRow(0)
|
|
120
|
+
self.sizer.AddGrowableCol(1)
|
|
121
|
+
self.SetSizerAndFit(self.sizer)
|
|
122
|
+
self._applyAppTheme()
|
|
123
|
+
self._applyAppTheme(self.ctrls)
|
|
124
|
+
>>>>>>> hsogo/feature-localization
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def color(self):
|
|
128
|
+
"""Current color the user has specified. Should be reflected in the
|
|
129
|
+
preview area. Value has type :class:`psychopy.colors.Color`.
|
|
130
|
+
|
|
131
|
+
This is the primary setter for the dialog's color value. It will
|
|
132
|
+
automatically update all color space pages to reflect this color value.
|
|
133
|
+
Pages should absolutely not attempt to set other page's values directly
|
|
134
|
+
or risk blowing up the call stack.
|
|
135
|
+
|
|
136
|
+
"""
|
|
137
|
+
return self._color
|
|
138
|
+
|
|
139
|
+
@color.setter
|
|
140
|
+
def color(self, value):
|
|
141
|
+
if value is None:
|
|
142
|
+
value = Color('none', space='named')
|
|
143
|
+
|
|
144
|
+
global LAST_COLOR
|
|
145
|
+
self.pnlColorPreview.color = self._color = value
|
|
146
|
+
LAST_COLOR = self._color.copy()
|
|
147
|
+
self._updateColorSpacePage()
|
|
148
|
+
|
|
149
|
+
def _updateColorSpacePage(self):
|
|
150
|
+
"""Update the current colorspace page to reflect the current color being
|
|
151
|
+
specified by the dialog. Called only on the current page or when the
|
|
152
|
+
page has been changed. Pointless to update all pages at once.
|
|
153
|
+
|
|
154
|
+
"""
|
|
155
|
+
page = self.nbColorSpaces.GetCurrentPage()
|
|
156
|
+
|
|
157
|
+
if hasattr(page, 'updateChannels'):
|
|
158
|
+
page.updateChannels()
|
|
159
|
+
|
|
160
|
+
if hasattr(page, 'updateHex'):
|
|
161
|
+
page.updateHex()
|
|
162
|
+
|
|
163
|
+
def _addColorSpacePages(self):
|
|
164
|
+
"""Add pages for each supported color space.
|
|
165
|
+
|
|
166
|
+
In the future this will be modified to support plugging in additional
|
|
167
|
+
color spaces. Right now the pages are hard-coded in.
|
|
168
|
+
|
|
169
|
+
"""
|
|
170
|
+
self.pnlRGB = ColorPickerPageRGB(self.nbColorSpaces)
|
|
171
|
+
self.pnlHSV = ColorPickerPageHSV(self.nbColorSpaces)
|
|
172
|
+
|
|
173
|
+
self.nbColorSpaces.AddPage(self.pnlRGB, u"RGB", True)
|
|
174
|
+
self.nbColorSpaces.AddPage(self.pnlHSV, u"HSV/HSB", False)
|
|
175
|
+
|
|
176
|
+
def _setupUI(self):
|
|
177
|
+
"""Setup the UI for the color picker dialog box.
|
|
178
|
+
|
|
179
|
+
"""
|
|
180
|
+
szrMain = wx.BoxSizer(wx.VERTICAL)
|
|
181
|
+
|
|
182
|
+
# Color area panel. Shows the preview, colorspace pages and presets
|
|
183
|
+
# panels at the top portion of the dialog.
|
|
184
|
+
#
|
|
185
|
+
self.pnlColorArea = wx.Panel(
|
|
186
|
+
self,
|
|
187
|
+
wx.ID_ANY,
|
|
188
|
+
wx.DefaultPosition,
|
|
189
|
+
wx.DefaultSize,
|
|
190
|
+
wx.TAB_TRAVERSAL)
|
|
191
|
+
|
|
192
|
+
szrColorArea = wx.BoxSizer(wx.HORIZONTAL)
|
|
193
|
+
|
|
194
|
+
# color preview panel
|
|
195
|
+
self.pnlColorPreview = ColorPreview(
|
|
196
|
+
self.pnlColorArea, self._color)
|
|
197
|
+
self.pnlColorPreview.SetMinSize(wx.Size(100, -1))
|
|
198
|
+
self.pnlColorPreview.SetMaxSize(wx.Size(100, -1))
|
|
199
|
+
|
|
200
|
+
# color space notebook area
|
|
201
|
+
self.nbColorSpaces = wx.Notebook(
|
|
202
|
+
self.pnlColorArea,
|
|
203
|
+
wx.ID_ANY,
|
|
204
|
+
wx.DefaultPosition,
|
|
205
|
+
wx.DefaultSize,
|
|
206
|
+
0)
|
|
207
|
+
|
|
208
|
+
self._addColorSpacePages() # add the pages to the notebook
|
|
209
|
+
|
|
210
|
+
# preset panel
|
|
211
|
+
self.colorPresets = ColorPresets(self.pnlColorArea)
|
|
212
|
+
self.colorPresets.SetMinSize(wx.Size(140, -1))
|
|
213
|
+
self.colorPresets.SetMaxSize(wx.Size(140, -1))
|
|
214
|
+
|
|
215
|
+
szrColorArea.Add(self.pnlColorPreview, 0, wx.EXPAND | wx.ALL, 5)
|
|
216
|
+
szrColorArea.Add(
|
|
217
|
+
self.nbColorSpaces, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
|
|
218
|
+
szrColorArea.Add(self.colorPresets, 0, wx.EXPAND | wx.ALL, 5)
|
|
219
|
+
|
|
220
|
+
self.pnlColorArea.SetSizer(szrColorArea)
|
|
221
|
+
self.pnlColorArea.Layout()
|
|
222
|
+
szrColorArea.Fit(self.pnlColorArea)
|
|
223
|
+
szrMain.Add(self.pnlColorArea, 1, wx.ALL| wx.EXPAND, 5)
|
|
224
|
+
|
|
225
|
+
# line to divide the color area from the dialog controls, looks neat
|
|
226
|
+
self.stlMain = wx.StaticLine(
|
|
227
|
+
self,
|
|
228
|
+
wx.ID_ANY,
|
|
229
|
+
wx.DefaultPosition,
|
|
230
|
+
wx.DefaultSize,
|
|
231
|
+
wx.LI_HORIZONTAL)
|
|
232
|
+
|
|
233
|
+
szrMain.Add(self.stlMain, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
|
|
234
|
+
|
|
235
|
+
# Dialog controls area. Shows buttons for closing the dialog or copying
|
|
236
|
+
# colors. Also shows the output format to use when copying to the
|
|
237
|
+
# clipboard.
|
|
238
|
+
#
|
|
239
|
+
szrDlgButtonArea = wx.BoxSizer(wx.VERTICAL)
|
|
240
|
+
szrDlgCtrls = wx.FlexGridSizer(1, 5, 0, 5)
|
|
241
|
+
szrDlgCtrls.AddGrowableCol(1)
|
|
242
|
+
szrDlgCtrls.SetFlexibleDirection(wx.BOTH)
|
|
243
|
+
szrDlgCtrls.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
|
|
244
|
+
|
|
245
|
+
self.lblResult = wx.StaticText(
|
|
246
|
+
self,
|
|
247
|
+
wx.ID_ANY,
|
|
248
|
+
u"Output Space:",
|
|
249
|
+
wx.DefaultPosition,
|
|
250
|
+
wx.DefaultSize,
|
|
251
|
+
0)
|
|
252
|
+
self.lblResult.Wrap(-1)
|
|
253
|
+
|
|
254
|
+
szrDlgCtrls.Add(
|
|
255
|
+
self.lblResult,
|
|
256
|
+
0,
|
|
257
|
+
wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
|
|
258
|
+
5)
|
|
259
|
+
|
|
260
|
+
self.cboOutputSpace = wx.Choice(
|
|
261
|
+
self,
|
|
262
|
+
wx.ID_ANY,
|
|
263
|
+
wx.DefaultPosition,
|
|
264
|
+
wx.DefaultSize,
|
|
265
|
+
choices=self._outputChoices)
|
|
266
|
+
self.cboOutputSpace.SetSelection(LAST_OUTPUT_SPACE)
|
|
267
|
+
|
|
268
|
+
szrDlgCtrls.Add(self.cboOutputSpace, 1, wx.ALIGN_CENTER_VERTICAL, 5)
|
|
269
|
+
|
|
270
|
+
self.cmdCopyObject = wx.Button(
|
|
271
|
+
self, wx.ID_ANY, u"Copy as &Object", wx.DefaultPosition,
|
|
272
|
+
wx.DefaultSize, 0)
|
|
273
|
+
self.cmdCopy = wx.Button(
|
|
274
|
+
self, wx.ID_ANY, u"Copy as &Value", wx.DefaultPosition,
|
|
275
|
+
wx.DefaultSize, 0)
|
|
276
|
+
self.cmdClose = wx.Button(
|
|
277
|
+
self, wx.ID_ANY, u"&Cancel", wx.DefaultPosition, wx.DefaultSize, 0)
|
|
278
|
+
|
|
279
|
+
self.cmdCopyObject.SetToolTip(
|
|
280
|
+
u"Copy as a `psychopy.colors.Color` object.")
|
|
281
|
+
self.cmdCopy.SetToolTip(
|
|
282
|
+
u"Copy as a value (tuple).")
|
|
283
|
+
|
|
284
|
+
szrDlgCtrls.Add(self.cmdCopyObject, 0, wx.EXPAND, 5)
|
|
285
|
+
szrDlgCtrls.Add(self.cmdCopy, 0, wx.EXPAND, 5)
|
|
286
|
+
szrDlgCtrls.Add(self.cmdClose, 0, wx.EXPAND, 5)
|
|
287
|
+
|
|
288
|
+
szrDlgButtonArea.Add(szrDlgCtrls, 1, wx.ALL | wx.EXPAND, 5)
|
|
289
|
+
|
|
290
|
+
szrMain.Add(szrDlgButtonArea, 0, wx.EXPAND | wx.ALL, 5)
|
|
291
|
+
|
|
292
|
+
self.SetSizer(szrMain)
|
|
293
|
+
self.Layout()
|
|
294
|
+
|
|
295
|
+
self.Centre(wx.BOTH)
|
|
296
|
+
|
|
297
|
+
# Connect Events
|
|
298
|
+
self.nbColorSpaces.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onPageChanged)
|
|
299
|
+
self.cmdCopyObject.Bind(wx.EVT_BUTTON, self.onCopyObject)
|
|
300
|
+
self.cmdCopy.Bind(wx.EVT_BUTTON, self.onCopyValue)
|
|
301
|
+
self.cboOutputSpace.Bind(
|
|
302
|
+
wx.EVT_CHOICE, self.onOutputSpaceChanged)
|
|
303
|
+
self.cmdClose.Bind(wx.EVT_BUTTON, self.onClose)
|
|
304
|
+
|
|
305
|
+
def _copyToClipboard(self, text):
|
|
306
|
+
"""Copy text to the clipboard.
|
|
307
|
+
|
|
308
|
+
Shows an error dialog if the clipboard cannot be opened to inform the
|
|
309
|
+
user the values have not been copied.
|
|
310
|
+
|
|
311
|
+
Parameters
|
|
312
|
+
----------
|
|
313
|
+
text : str
|
|
314
|
+
Text to copy to the clipboard.
|
|
315
|
+
|
|
316
|
+
"""
|
|
317
|
+
# copy the value to the clipboard
|
|
318
|
+
if wx.TheClipboard.Open():
|
|
319
|
+
wx.TheClipboard.SetData(wx.TextDataObject(str(text)))
|
|
320
|
+
wx.TheClipboard.Close()
|
|
321
|
+
else:
|
|
322
|
+
# Raised if the clipboard fails to open, warns the user the value
|
|
323
|
+
# wasn't copied.
|
|
324
|
+
errDlg = wx.MessageDialog(
|
|
325
|
+
self,
|
|
326
|
+
'Failed to open the clipboard, output value not copied.',
|
|
327
|
+
'Clipboard Error',
|
|
328
|
+
wx.OK | wx.ICON_ERROR)
|
|
329
|
+
errDlg.ShowModal()
|
|
330
|
+
errDlg.Destroy()
|
|
331
|
+
|
|
332
|
+
def getOutputValue(self):
|
|
333
|
+
"""Get the string value using the specified output format.
|
|
334
|
+
|
|
335
|
+
Returns
|
|
336
|
+
-------
|
|
337
|
+
str
|
|
338
|
+
Color value using the current output format.
|
|
339
|
+
|
|
340
|
+
"""
|
|
341
|
+
outputSpace = self.cboOutputSpace.GetSelection()
|
|
342
|
+
dlgCol = self.GetTopLevelParent().color
|
|
343
|
+
if outputSpace == 0: # RGBA
|
|
344
|
+
colorOut = '({:.4f}, {:.4f}, {:.4f}, {:.4f})'.format(*dlgCol.rgba)
|
|
345
|
+
elif outputSpace == 1: # RGB
|
|
346
|
+
colorOut = '({:.4f}, {:.4f}, {:.4f})'.format(*dlgCol.rgb)
|
|
347
|
+
elif outputSpace == 2: # RGBA1
|
|
348
|
+
colorOut = '({:.4f}, {:.4f}, {:.4f}, {:.4f})'.format(*dlgCol.rgba1)
|
|
349
|
+
elif outputSpace == 3: # RGB1
|
|
350
|
+
colorOut = '({:.4f}, {:.4f}, {:.4f})'.format(*dlgCol.rgb1)
|
|
351
|
+
elif outputSpace == 4: # RGBA255
|
|
352
|
+
colorOut = '({:d}, {:d}, {:d}, {:d})'.format(
|
|
353
|
+
*[int(i) for i in dlgCol.rgba255])
|
|
354
|
+
elif outputSpace == 5: # RGB255
|
|
355
|
+
colorOut = '({:d}, {:d}, {:d})'.format(
|
|
356
|
+
*[int(i) for i in dlgCol.rgb255])
|
|
357
|
+
elif outputSpace == 6: # Hex
|
|
358
|
+
colorOut = "'{}'".format(dlgCol.hex)
|
|
359
|
+
elif outputSpace == 7: # HSVA
|
|
360
|
+
colorOut = '({:.4f}, {:.4f}, {:.4f}, {:.4f})'.format(*dlgCol.hsva)
|
|
361
|
+
elif outputSpace == 8: # HSV
|
|
362
|
+
colorOut = '({:.4f}, {:.4f}, {:.4f})'.format(*dlgCol.hsv)
|
|
363
|
+
else:
|
|
364
|
+
raise ValueError(
|
|
365
|
+
"Invalid output color space selection. Have you added any "
|
|
366
|
+
"more choices to `cboOutputSpace`?")
|
|
367
|
+
|
|
368
|
+
return colorOut
|
|
369
|
+
|
|
370
|
+
def onOutputSpaceChanged(self, event):
|
|
371
|
+
"""Set when the output space choicebox is changed."""
|
|
372
|
+
global LAST_OUTPUT_SPACE
|
|
373
|
+
LAST_OUTPUT_SPACE = event.GetSelection()
|
|
374
|
+
event.Skip()
|
|
375
|
+
|
|
376
|
+
def onPageChanged(self, event):
|
|
377
|
+
"""Called when the color space notebook is changed. Updates the current
|
|
378
|
+
page to show values appropriate for the current color specified by the
|
|
379
|
+
dialog.
|
|
380
|
+
|
|
381
|
+
"""
|
|
382
|
+
self._updateColorSpacePage()
|
|
383
|
+
event.Skip()
|
|
384
|
+
|
|
385
|
+
def onCopyObject(self, event):
|
|
386
|
+
"""Event to copy the color to the clipboard as a an object.
|
|
387
|
+
|
|
388
|
+
"""
|
|
389
|
+
outputSpace = self.cboOutputSpace.GetSelection()
|
|
390
|
+
toReturn = "colors.Color({}, space='{}')".format(
|
|
391
|
+
self.getOutputValue(), self._spaces[outputSpace])
|
|
392
|
+
self._copyToClipboard(toReturn)
|
|
393
|
+
self.Close()
|
|
394
|
+
event.Skip()
|
|
395
|
+
|
|
396
|
+
def onCopyValue(self, event):
|
|
397
|
+
"""Event to copy the color to the clipboard as a value.
|
|
398
|
+
|
|
399
|
+
"""
|
|
400
|
+
self._copyToClipboard(self.getOutputValue()) # copy out to clipboard
|
|
401
|
+
self.Close()
|
|
402
|
+
event.Skip()
|
|
403
|
+
|
|
404
|
+
def onClose(self, event):
|
|
405
|
+
"""Called when the cancel button is clicked."""
|
|
406
|
+
self.Close()
|
|
407
|
+
event.Skip()
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
if __name__ == "__main__":
|
|
411
|
+
pass
|
psychopy/app/cortex.log
ADDED
|
File without changes
|
psychopy/app/jobs.py
CHANGED
|
@@ -101,7 +101,14 @@ class PipeReader(Thread):
|
|
|
101
101
|
@property
|
|
102
102
|
def isAvailable(self):
|
|
103
103
|
"""Are there bytes available to be read (`bool`)?"""
|
|
104
|
-
|
|
104
|
+
if self._queue.full():
|
|
105
|
+
return True
|
|
106
|
+
elif self._overflowBuffer: # have leftover bytes
|
|
107
|
+
self._queue.put("".join(self._overflowBuffer))
|
|
108
|
+
self._overflowBuffer = [] # clear the overflow buffer
|
|
109
|
+
return True
|
|
110
|
+
else:
|
|
111
|
+
return False
|
|
105
112
|
|
|
106
113
|
def read(self):
|
|
107
114
|
"""Read all bytes enqueued by the thread coming off the pipe. This is
|