Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/psychopy/psychopy into rf-n…
Browse files Browse the repository at this point in the history
…o-bare-except

* 'master' of git://github.com/psychopy/psychopy:
  RF: reduce use of exec( )
  TEST: update componsTemplate for non-mutable default values
  TEST: update componsTemplate after merge upstream
  TEST: better version of the componsTemplate file
  WIP: figuring out test failure
  RF: replace mutable defaults with non-mutables
  RF: update to new-style classes

# Conflicts:
#	psychopy/data.py -- fixed by hand
  • Loading branch information
jeremygray committed Jan 26, 2016
2 parents 66b15c3 + 40c97ce commit f92ef69
Show file tree
Hide file tree
Showing 64 changed files with 2,512 additions and 1,578 deletions.
5 changes: 3 additions & 2 deletions psychopy/app/_psychopyApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, parent=None, ID=-1, app=None, title="PsychoPy2"):
self.SetMenuBar(self.menuBar)
self.Show()

class _Showgui_Hack():
class _Showgui_Hack(object):
"""Class with side-effect of restoring wx window switching/launching under wx-3.0
- might only be needed on some platforms (Mac 10.9.4 needs it for me);
Expand All @@ -64,6 +64,7 @@ class _Showgui_Hack():
- called at end of PsychoPyApp.onInit()
"""
def __init__(self):
super(_Showgui_Hack, self).__init__()
from psychopy import core
import os
# should be writable:
Expand Down Expand Up @@ -364,7 +365,7 @@ def newBuilderFrame(self, event=None, fileName=None):
self.SetTopWindow(thisFrame)
self.builderFrames.append(thisFrame)
self.allFrames.append(thisFrame)
def showBuilder(self, event=None, fileList=[]):
def showBuilder(self, event=None, fileList=()):
from psychopy.app import builder#have to reimport because it is ony local to __init__ so far
for fileName in fileList:
if os.path.isfile(fileName):
Expand Down
1 change: 1 addition & 0 deletions psychopy/app/builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ def onRemFromFavorites(self, evt=None, btn=None):
class FavoriteComponents(object):

def __init__(self, componentsPanel, threshold=20, neutral=0):
super(FavoriteComponents, self).__init__()
self.threshold=20
self.neutral=0
self.panel = componentsPanel
Expand Down
8 changes: 4 additions & 4 deletions psychopy/app/builder/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ def getComponents(folder=None, fetchIcons=True):
components[attrib].categories=['Custom']
return components

def getAllComponents(folderList=[], fetchIcons=True):
def getAllComponents(folderList=(), fetchIcons=True):
"""Get a dictionary of all available components, from the builtins as well
as all folders in the folderlist.
User-defined components will override built-ins with the same name.
"""
if type(folderList)!=list:
raise TypeError, 'folderList should be a list, not a string'
if isinstance(folderList, basestring):
raise TypeError, 'folderList should be iterable, not a string'
components=getComponents(fetchIcons=fetchIcons)#get the built-ins
for folder in folderList:
userComps=getComponents(folder)
Expand All @@ -176,7 +176,7 @@ def getAllComponents(folderList=[], fetchIcons=True):
return components


def getAllCategories(folderList=[]):
def getAllCategories(folderList=()):
allComps = getAllComponents(folderList)
allCats = ['Stimuli','Responses','Custom']
for name, thisComp in allComps.items():
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class BaseVisualComponent(BaseComponent):
"""
categories = ['Stimuli']#an attribute of the class, determines the section in the components panel
def __init__(self, exp, parentName, name='', units='from exp settings', color='$[1,1,1]',
pos=[0,0], size=[0,0], ori=0 , colorSpace='rgb', opacity=1,
pos=(0,0), size=(0,0), ori=0 , colorSpace='rgb', opacity=1,
startType='time (s)',startVal='',
stopType='duration (s)', stopVal='',
startEstim='', durationEstim=''):
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/dots.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, exp, parentName, name='dots',
direction=0.0, speed=0.1, coherence=1.0,
dotSize=2,
dotLife=3, signalDots='same', noiseDots='direction',
fieldShape='circle', fieldSize=1.0, fieldPos=[0.0,0.0],
fieldShape='circle', fieldSize=1.0, fieldPos=(0.0,0.0),
color='$[1.0,1.0,1.0]',colorSpace='rgb',
opacity=1.0,
units='from exp settings',
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/grating.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class GratingComponent(BaseVisualComponent):
"""A class for presenting grating stimuli"""
def __init__(self, exp, parentName, name='grating', image='sin', mask='None', sf='None', interpolate='linear',
units='from exp settings', color='$[1,1,1]', colorSpace='rgb',
pos=[0,0], size=[0.5,0.5], ori=0, phase=0.0, texRes='128',
pos=(0,0), size=(0.5,0.5), ori=0, phase=0.0, texRes='128',
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
startEstim='', durationEstim=''):
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ImageComponent(BaseVisualComponent):
"""An event class for presenting image-based stimuli"""
def __init__(self, exp, parentName, name='image', image='', mask='None', interpolate='linear',
units='from exp settings', color='$[1,1,1]', colorSpace='rgb',
pos=[0,0], size=[0.5,0.5], ori=0, texRes='128',
pos=(0,0), size=(0.5,0.5), ori=0, texRes='128',
flipVert=False, flipHoriz=False,
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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,
pos=(0,0), size='', ori=0,
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
startEstim='', durationEstim='',
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PatchComponent(BaseVisualComponent):
"""An event class for presenting image-based stimuli"""
def __init__(self, exp, parentName, name='patch', image='sin', mask='None', sf='None', interpolate='linear',
units='from exp settings', color='$[1,1,1]', colorSpace='rgb',
pos=[0,0], size=[0.5,0.5], ori=0, phase=0.0, texRes='128',
pos=(0,0), size=(0.5,0.5), ori=0, phase=0.0, texRes='128',
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
startEstim='', durationEstim=''):
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, exp, parentName, name='polygon', interpolate='linear',
lineColor='$[1,1,1]', lineColorSpace='rgb', lineWidth=1,
fillColor='$[1,1,1]', fillColorSpace='rgb',
nVertices=4,
pos=[0,0], size=[0.5,0.5], ori=0,
pos=(0,0), size=(0.5,0.5), ori=0,
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
startEstim='', durationEstim=''):
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

class SettingsComponent(object):
"""This component stores general info about how to run the experiment"""
def __init__(self, parentName, exp, expName='', fullScr=True, winSize=[1024,768], screen=1, monitor='testMonitor', showMouse=False,
def __init__(self, parentName, exp, expName='', fullScr=True, winSize=(1024,768), screen=1, monitor='testMonitor', showMouse=False,
saveLogFile=True, showExpInfo=True, expInfo="{'participant':'', 'session':'001'}",units='use prefs',
logging='exp', color='$[0,0,0]', colorSpace='rgb', enableEscape=True, blendMode='avg',
saveXLSXFile=False, saveCSVFile=False, saveWideCSVFile=True, savePsydatFile=True,
Expand Down
2 changes: 1 addition & 1 deletion psychopy/app/builder/components/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TextComponent(BaseVisualComponent):
def __init__(self, exp, parentName, name='text',
text=_translate('Any text\n\nincluding line breaks'), # effectively just a display-value
font='Arial',units='from exp settings', color='white', colorSpace='rgb',
pos=[0,0], letterHeight=0.1, ori=0,
pos=(0,0), letterHeight=0.1, ori=0,
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal=1.0,
flip='',
Expand Down
3 changes: 2 additions & 1 deletion psychopy/app/builder/dialogs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def __init__(self, dlg, label, param, parent, fieldName,
is only for display and can be translated or tweaked (e.g., add '$').
Component._localized.keys() are `fieldName`s, and .values() are `label`s.
"""
super(ParamCtrls, self).__init__()
self.param = param
self.dlg = dlg
self.dpi=self.dlg.dpi
Expand Down Expand Up @@ -960,7 +961,7 @@ def __init__(self,frame,title="Loop Properties",loop=None,
if self.OK:
self.params = self.getParams()
#convert endPoints from str to list
exec("self.params['endPoints'].val = %s" %self.params['endPoints'].val)
self.params['endPoints'].val = eval("%s" % self.params['endPoints'].val)
#then sort the list so the endpoints are in correct order
self.params['endPoints'].val.sort()
if loop: # editing an existing loop
Expand Down

0 comments on commit f92ef69

Please sign in to comment.