diff --git a/psychopy/visual/basevisual.py b/psychopy/visual/basevisual.py index ce5fbc1aa01..009aaa15e17 100644 --- a/psychopy/visual/basevisual.py +++ b/psychopy/visual/basevisual.py @@ -1,6 +1,6 @@ #!/usr/bin/env python2 -'''A base class that is subclassed to produce specific visual stimuli''' +'''Provides class BaseVisualStim; subclass it to produce specific visual stimuli''' # Part of the PsychoPy library # Copyright (C) 2014 Jonathan Peirce @@ -28,10 +28,10 @@ from psychopy.constants import NOT_STARTED, STARTED, STOPPED """ -There are three 'levels' of base visual stim classes: +There are three base visual stim classes: + - BaseVisualStim: current / preferred visual methods, inherits from MinimalStim and LegacyBaseVisualStim - MinimalStim: non-visual house-keeping code common to all visual stim (name, autoLog, etc) - - LegacyBaseVisualStim: extends Minimal, adds deprecated visual methods (eg, setRGB) - - BaseVisualStim: extends Legacy, adds current / preferred visual methods + - LegacyBaseVisualStim: deprecated visual methods (eg, setRGB) """ class MinimalStim(object): @@ -153,10 +153,10 @@ def setAutoLog(self, value=True): self.autoLog = value -class LegacyBaseVisualStim(MinimalStim): +class LegacyBaseVisualStim(object): """Class to hold deprecated visual methods and attributes. - Intended only for use as a base class for BaseVisualStim, to maintain + Intended only for use as a mixin class for BaseVisualStim, to maintain backwards compatibility while reducing clutter in class BaseVisualStim. """ def _calcSizeRendered(self): @@ -199,7 +199,7 @@ def depth(self, value): self.__dict__['depth'] = value -class BaseVisualStim(LegacyBaseVisualStim): +class BaseVisualStim(MinimalStim, LegacyBaseVisualStim): """A template for a visual stimulus class. Actual visual stim like GratingStim, TextStim etc... are based on this. @@ -212,7 +212,7 @@ def __init__(self, win, units=None, name='', autoLog=True): self._verticesBase = [[0.5,-0.5],[-0.5,-0.5],[-0.5,0.5],[0.5,0.5]] #sqr self._rotationMatrix = [[1.,0.],[0.,1.]] #no rotation as a default # self.autoLog is set at end of MinimalStim.__init__ - LegacyBaseVisualStim.__init__(self, name=name, autoLog=autoLog) + super(BaseVisualStim, self).__init__(name=name, autoLog=autoLog) if self.autoLog: logging.warning("%s is calling BaseVisualStim.__init__() with autolog=True. Set autoLog to True only at the end of __init__())" \ %(self.__class__.__name__)) @@ -538,9 +538,8 @@ def setColor(self, color, colorSpace=None, operation='', log=True): log=log) def _set(self, attrib, val, op='', log=True): """ - Deprecated. Use methods specific to the parameter you want to set - - e.g. :: + Use this method when you want to be able to suppress logging (e.g., in + tests). Typically better to use methods specific to the parameter, e.g. :: stim.pos = [3,2.5] stim.ori = 45