Skip to content

Commit

Permalink
RF: baseVisual change to multiple inheritance for LegacyBaseStim
Browse files Browse the repository at this point in the history
basically cosmetic / conceptual, no effect on function
  • Loading branch information
jeremygray committed Mar 24, 2014
1 parent 5e30a67 commit 6fa2cde
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions psychopy/visual/basevisual.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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.
Expand All @@ -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__))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6fa2cde

Please sign in to comment.