Esempio n. 1
0
def monoFormatParser(usrStr):
    """
    >>> monoFormatParser('pcia')
    'productColumnIndexActive'
    """
    # only allow one-dimensional outputs
    ref = tableMonoFormatRef
    usrStr = drawer.selectionParse(usrStr, ref)
    return usrStr # may be None
Esempio n. 2
0
def audioFormatParser(usrStr):
    """provide backward compat to older names"""
    ref = {
        'aif'    : ['aif', 'aiff', 'a'],
        'wav'    : ['wav', 'wave', 'w'],
        'sd2'    : ['sd2', 'sd', 'ircam', 'i'], # assign ircam to sd2
            }
    usrStr = drawer.selectionParse(usrStr, ref)
    return usrStr # may be None
Esempio n. 3
0
 def _typeFormatParser(self, usrStr):
     "decode control choice strings"
     ref = {
         'stringQuote' : ['sq',],
         'string'          : ['str', 's'],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 4
0
 def _selectLevelMonophonicParser(self, usrStr):
     "decode control choice strings"
     ref = {
         'event' : ['e'],
         'set' : ['s'],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 5
0
 def _selectRetrogradeParser(self, usrStr):
     "decode control choice strings"
     ref = {
         'off' : ['off', '0'],
         'timeInverse' : ['ti', 'tinvers'],
         'eventInverse' : ['ei', 'retro'],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 6
0
def caFormatParser(usrStr):
    """
    >>> caFormatParser('tot')
    't'
    """
    ref = {
        's' : ['s', 'standard'],
        't' : ['t', 'tot', 'totalistic'],
        'c' : ['c', 'continuous'],
        'f' : ['f', 'float'],
            }
    usrStr = drawer.selectionParse(usrStr, ref)
    return usrStr # may be Non
Esempio n. 7
0
 def _sieveFormatParser(self, usrStr):
     "decode control choice strings"
     ref = {
         'integer' : ['i', 'int'],
         'width' : ['w', 'wid'],
         'binary' : ['b', 'bin'],
         'unit' : ['u', 'uni'],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr        
Esempio n. 8
0
 def _selectLevelFrameParser(self, usrStr):
     """
     >>> a = Parameter([])
     >>> a._selectLevelFrameParser('f')
     'frame'
     """
     ref = {
         'event' : ['e', '1'],
         'frame' : ['f', '0'],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, "bad frame level control. enter %s." % selStr
     return usrStr # may be None
Esempio n. 9
0
    def _loopControlParser(self, usrStr):
        """determine if a value referes to loop (1) or single (0)

        >>> a = Parameter([])
        >>> a._loopControlParser(0)
        'single'
        """
        ref = {
            'loop' : ['l', '1'],
            'single' : ['s', '0'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, "loop control is either %s." % selStr
        return usrStr # may be None
Esempio n. 10
0
    def _loopControlParser(self, usrStr):
        """determine if a value referes to loop (1) or single (0)

        >>> a = Parameter([])
        >>> a._loopControlParser(0)
        'single'
        """
        ref = {
            'loop': ['l', '1'],
            'single': ['s', '0'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, "loop control is either %s." % selStr
        return usrStr  # may be None
Esempio n. 11
0
    def _onOffParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._onOffParser(1)
        'on'
        """
        ref = {
            'on': ['1'],
            'off': ['0'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr
Esempio n. 12
0
    def _scaleSwitchParser(self, usrStr):
        """determine if a value refers to absolute or proportional values         

        >>> a = Parameter([])
        >>> a._scaleSwitchParser('p')
        'proportional'
        """
        ref = {
            'absolute': ['a', '1'],
            'proportional': ['p', '0'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, "bad step control. enter %s." % selStr
        return usrStr  # may be None
Esempio n. 13
0
    def _onOffParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._onOffParser(1)
        'on'
        """
        ref = {
            'on' : ['1'],
            'off' : ['0'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr
Esempio n. 14
0
    def _articulationParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._articulationParser('a')
        'attack'
        """
        ref = {
            'attack' : ['a'],
            'sustain' : ['s'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr
Esempio n. 15
0
    def _articulationParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._articulationParser('a')
        'attack'
        """
        ref = {
            'attack': ['a'],
            'sustain': ['s'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr
Esempio n. 16
0
    def _selectTimeRefParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._selectTimeRefParser('tt')
        'textureTime'
        """
        ref = {
            'textureTime': ['tt'],
            'cloneTime': ['ct'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr
Esempio n. 17
0
 def _thresholdMatchParser(self, usrStr):
     """
     >>> a = Parameter([])
     >>> a._thresholdMatchParser('u')
     'upper'
     """
     ref = {
         'lower' : ['l'],
         'upper' : ['u'],
         'match' : ['m'],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 18
0
    def _selectTimeRefParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._selectTimeRefParser('tt')
        'textureTime'
        """
        ref = {
            'textureTime' : ['tt'],
            'cloneTime' : ['ct'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr
Esempio n. 19
0
    def _scaleSwitchParser(self, usrStr):
        """determine if a value refers to absolute or proportional values         

        >>> a = Parameter([])
        >>> a._scaleSwitchParser('p')
        'proportional'
        """
        ref = {
            'absolute' : ['a', '1'],
            'proportional' : ['p', '0'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, "bad step control. enter %s." % selStr
        return usrStr # may be None
Esempio n. 20
0
 def _thresholdMatchParser(self, usrStr):
     """
     >>> a = Parameter([])
     >>> a._thresholdMatchParser('u')
     'upper'
     """
     ref = {
         'lower': ['l'],
         'upper': ['u'],
         'match': ['m'],
     }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 21
0
    def _stepControlParser(self, usrStr):
        """determine if a value refers to step (event) control (1) or
        real-time control (0)

        >>> a = Parameter([])
        >>> a._stepControlParser('e')
        'event'
        """
        ref = {
            'event' : ['e', '1'],
            'time' : ['t', '0'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, "bad step control. enter %s." % selStr
        return usrStr # may be None
Esempio n. 22
0
 def _valueSelectBiParser(self, usrStr):
     """xy selection
     >>> a = Parameter([])
     >>> a._valueSelectBiParser('xy')
     'xy'
     """
     ref = { # automatically uses keys as case insensitive values
         'x' : [],
         'y' : [],
         'xy' : [],
         'yx' : [],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 23
0
 def _anchorParser(self, usrStr):
     """
     >>> a = Parameter([])
     >>> a._anchorParser('a')
     'average'
     """
     ref = {
         'lower' : ['l'],
         'upper' : ['u'],
         'average' : ['a'],
         'median' : ['m'],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 24
0
    def _boundaryParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._boundaryParser('w')
        'wrap'
        """
        ref = {
            'limit' : [ 'l'],
            'wrap' : ['w'],
            'reflect' : ['r'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)      
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, "bad boundary method. enter %s." % selStr         
        return usrStr # may be None
Esempio n. 25
0
def libraryParser(usrStr):
    """decode feedback models

    >>> libraryParser('t')
    'thermostat'
    >>> libraryParser('cc')
    'climateControl'
    """
    ref = {
        'climateControl': ['cc', 'climage'],
        'thermostat': ['t', 'temp'],
    }
    usrStr = drawer.selectionParse(usrStr, ref)
    if usrStr == None:
        selStr = drawer.selectionParseKeyLabel(ref)
        raise FeedbackError('bad user string name: %s.' % selStr)
    return usrStr
Esempio n. 26
0
    def _boundaryParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._boundaryParser('w')
        'wrap'
        """
        ref = {
            'limit': ['l'],
            'wrap': ['w'],
            'reflect': ['r'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, "bad boundary method. enter %s." % selStr
        return usrStr  # may be None
Esempio n. 27
0
 def _valueSelectBiParser(self, usrStr):
     """xy selection
     >>> a = Parameter([])
     >>> a._valueSelectBiParser('xy')
     'xy'
     """
     ref = { # automatically uses keys as case insensitive values
         'x' : [],
         'y' : [],
         'xy' : [],
         'yx' : [],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 28
0
    def _stepControlParser(self, usrStr):
        """determine if a value refers to step (event) control (1) or
        real-time control (0)

        >>> a = Parameter([])
        >>> a._stepControlParser('e')
        'event'
        """
        ref = {
            'event': ['e', '1'],
            'time': ['t', '0'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, "bad step control. enter %s." % selStr
        return usrStr  # may be None
Esempio n. 29
0
def libraryParser(usrStr):
    """decode feedback models

    >>> libraryParser('t')
    'thermostat'
    >>> libraryParser('cc')
    'climateControl'
    """
    ref = {
        'climateControl' : ['cc', 'climage'],
        'thermostat' : ['t', 'temp'],
            }
    usrStr = drawer.selectionParse(usrStr, ref)
    if usrStr == None:
        selStr = drawer.selectionParseKeyLabel(ref)
        raise FeedbackError('bad user string name: %s.' % selStr)
    return usrStr
Esempio n. 30
0
 def _anchorParser(self, usrStr):
     """
     >>> a = Parameter([])
     >>> a._anchorParser('a')
     'average'
     """
     ref = {
         'lower': ['l'],
         'upper': ['u'],
         'average': ['a'],
         'median': ['m'],
     }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 31
0
    def _selectLevelPolyphonicParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._selectLevelPolyphonicParser('e')
        'event'    
        """
        ref = {
            'event': ['e'],
            'set': ['s'],
            'voice': ['v'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr
Esempio n. 32
0
def caInitParser(usrStr):
    """
    >>> caInitParser('center')
    'center'
    >>> caInitParser('junk') == None
    True
    """
    usrNum, junk = drawer.strExtractNum(usrStr)
    if drawer.isNum(usrStr) or (len(usrNum) == len(usrStr)
                                or drawer.isList(usrStr)):
        return usrStr  # not a string, a data obj
    # only parse if a string
    ref = {
        'center': ['c', 'center'],
        'random': ['r', 'random'],
    }
    usrStr = drawer.selectionParse(usrStr, ref)
    return usrStr  # may be Non
Esempio n. 33
0
def caInitParser(usrStr):
    """
    >>> caInitParser('center')
    'center'
    >>> caInitParser('junk') == None
    True
    """
    usrNum, junk = drawer.strExtractNum(usrStr)
    if drawer.isNum(usrStr) or (len(usrNum) == len(usrStr) or 
        drawer.isList(usrStr)):
        return usrStr # not a string, a data obj
    # only parse if a string
    ref = {
        'center' : ['c', 'center'],
        'random' : ['r', 'random'],
            }
    usrStr = drawer.selectionParse(usrStr, ref)
    return usrStr # may be Non
Esempio n. 34
0
    def _directionParser(self, usrStr):
        """decode direction strings; this used to have values preceded
        by 'linear; keep for backwards compat

        >>> a = Parameter([])
        >>> a._directionParser('ud')
        'upDown'
        """
        ref = {
            'upDown': ['ud', 'lud', 'linearupdown', '0'],
            'downUp': ['du', 'ldu', 'lineardownup', '1'],
            'up': ['u', 'lu', 'linearup', '2'],
            'down': ['d', 'ld', 'lineardown', '3'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad direction name: enter %s.' % selStr
        return usrStr
Esempio n. 35
0
    def _directionParser(self, usrStr):
        """decode direction strings; this used to have values preceded
        by 'linear; keep for backwards compat

        >>> a = Parameter([])
        >>> a._directionParser('ud')
        'upDown'
        """
        ref = {
            'upDown' : ['ud', 'lud', 'linearupdown', '0'],
            'downUp' : ['du', 'ldu', 'lineardownup', '1'],
            'up'        : ['u', 'lu', 'linearup', '2'],
            'down'  : ['d', 'ld', 'lineardown', '3'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad direction name: enter %s.' % selStr
        return usrStr
Esempio n. 36
0
    def _comparisonParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._comparisonParser('lt')
        'lessThan'    
        """
        ref = {
            'equal': ['e', '='],
            'greaterThan': ['gt', 'g', 'greater', '>'],
            'greaterThanOrEqual': ['gtoe', '>='],
            'lessThan': ['lt', 'l', 'less', '<'],
            'lessThanOrEqual': ['ltoe', '<='],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr
Esempio n. 37
0
    def _comparisonParser(self, usrStr):
        """decode control choice strings

        >>> a = Parameter([])
        >>> a._comparisonParser('lt')
        'lessThan'    
        """
        ref = {
            'equal' : ['e', '='],
            'greaterThan' : ['gt', 'g', 'greater', '>'],
            'greaterThanOrEqual' : ['gtoe', '>='],
            'lessThan' : ['lt', 'l', 'less', '<'],
            'lessThanOrEqual' : ['ltoe', '<='],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
        return usrStr        
Esempio n. 38
0
def temperamentNameParser(usrStr):
    # allows for backward compatibility with old names
    ref = {
        'TwelveEqual': ['12equal', '12', 'twelveequal', 'te'],
        'Pythagorean': ['12pythagorean', 'pythagorean', 'p'],
        'Just': ['12just', 'just', 'j'],
        'MeanTone': ['12meantone', 'meantone', 'mean', 'mt'],
        'Split24Upper': ['24toneupper', '24splitupper', 'split24upper', 'su'],
        'Split24Lower': ['24tonelower', '24splitlower', 'split24lower', 'sl'],
        'Interleave24Even':
        ['24toneupper', '24interleaveeven', 'interleave24even', 'ie'],
        'Interleave24Odd':
        ['24tonelower', '24interleaveodd', 'interleave24odd', 'io'],
        'NoiseLight': ['12lightnoise', '12noiselight', 'noiselight', 'nl'],
        'NoiseMedium': ['12noisemedium', 'noisemedium', 'nm'],
        'NoiseHeavy': ['12heavynoise', '12noiseheavy', 'noiseheavy', 'nh'],
    }

    usrStr = drawer.selectionParse(usrStr, ref)
    return usrStr  # may be Non
Esempio n. 39
0
 def _loadAutoConstantStr(self, arg, ref, lib='genPmtrObjs'):
     """accept a number, a list parameter object, or a string from 
     within a dfeind string group"""
     #         ref = {'0' : ['tn', 't', 't n' '0'],
     #                 }
     if drawer.isNum(arg):
         pmtrArgs = ('c', arg)
     elif drawer.isStr(arg):
         post = drawer.selectionParse(arg, ref, 0)  # autosearch off
         if post == None:
             raise error.ParameterObjectSyntaxError, 'no such preset name known.'
         pmtrArgs = ('c', post)  # a constant pmtr obj
     else:  # its a list to create a ParameterObject
         pmtrArgs = arg
     # create a ParameterObject
     from athenaCL.libATH.libPmtr import parameter
     try:
         obj = parameter.factory(pmtrArgs, lib)
     except error.ParameterObjectSyntaxError, msg:
         raise error.ParameterObjectSyntaxError, 'failed sub-parameter: %s' % msg
Esempio n. 40
0
    def _selectorParser(self, usrStr):
        """decode control choice strings; exception on error

        >>> a = Parameter([])
        >>> a._selectorParser('rp')
        'randomPermutate'
        """
        ref = {
            'randomChoice' : [ 'rc', '0'],
            'randomWalk' : ['rw'],
            'randomPermutate' : ['rp'],
            'orderedCyclic' : ['oc', '1'],
            'orderedCyclicRetrograde' : ['ocr',],
            'orderedOscillate' : ['oo'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError, 'bad selectionString: enter %s.' % selStr
        return usrStr
Esempio n. 41
0
    def _selectorParser(self, usrStr):
        """decode control choice strings; exception on error

        >>> a = Parameter([])
        >>> a._selectorParser('rp')
        'randomPermutate'
        """
        ref = {
            'randomChoice' : [ 'rc', '0'],
            'randomWalk' : ['rw'],
            'randomPermutate' : ['rp'],
            'orderedCyclic' : ['oc', '1'],
            'orderedCyclicRetrograde' : ['ocr',],
            'orderedOscillate' : ['oo'],
                }
        usrStr = drawer.selectionParse(usrStr, ref)
        if usrStr == None:
            selStr = drawer.selectionParseKeyLabel(ref)
            raise error.ParameterObjectSyntaxError('bad selectionString: enter %s.' % selStr)
        return usrStr
Esempio n. 42
0
    def _loadAutoConstantStr(self, arg, ref, lib='genPmtrObjs'):
        """accept a number, a list parameter object, or a string from 
        within a dfeind string group"""
#         ref = {'0' : ['tn', 't', 't n' '0'],
#                 }
        if drawer.isNum(arg):
            pmtrArgs = ('c', arg)
        elif drawer.isStr(arg):
            post = drawer.selectionParse(arg, ref, 0) # autosearch off
            if post == None:
                raise error.ParameterObjectSyntaxError, 'no such preset name known.'
            pmtrArgs = ('c', post) # a constant pmtr obj
        else: # its a list to create a ParameterObject
            pmtrArgs = arg
        # create a ParameterObject
        from athenaCL.libATH.libPmtr import parameter
        try:
            obj = parameter.factory(pmtrArgs, lib)
        except error.ParameterObjectSyntaxError, msg:
            raise error.ParameterObjectSyntaxError, 'failed sub-parameter: %s' % msg
Esempio n. 43
0
def temperamentNameParser(usrStr):
    # allows for backward compatibility with old names
    ref = {
        'TwelveEqual' : ['12equal', '12', 'twelveequal', 'te'],
        'Pythagorean' : ['12pythagorean', 'pythagorean', 'p'],
        'Just'  : ['12just', 'just', 'j'],
        'MeanTone'  : ['12meantone', 'meantone', 'mean', 'mt'],
        'Split24Upper'   : ['24toneupper', '24splitupper', 'split24upper', 'su'],
        'Split24Lower'   : ['24tonelower', '24splitlower', 'split24lower', 'sl'],
        'Interleave24Even' : ['24toneupper', '24interleaveeven', 
                                     'interleave24even', 'ie'],
        'Interleave24Odd'    : ['24tonelower', '24interleaveodd', 
                                     'interleave24odd', 'io'],
        'NoiseLight'  : ['12lightnoise', '12noiselight', 'noiselight', 'nl'],
        'NoiseMedium'   : ['12noisemedium', 'noisemedium', 'nm'],
        'NoiseHeavy'  : ['12heavynoise', '12noiseheavy', 'noiseheavy', 'nh'],
            }
            
    usrStr = drawer.selectionParse(usrStr, ref)
    return usrStr # may be Non
Esempio n. 44
0
    def _keyParser(self, usrStr):
        if drawer.isNum(usrStr) or drawer.isList(usrStr):
            return usrStr  # not a string, a data obj
        # only parse if a string

        # may need to add: 'd' for dimension
        # 'z' for z axis?
        ref = {
            'f': ['f', 'format', 'form', 'type'],
            'k': ['k', 'colors'],
            'r': ['r', 'radius'],
            'i': ['i', 'init', 'initial'],
            'x': ['x', 'size'],
            'y': ['y', 'steps', 'gen'],
            'w': ['w', 'width'],
            'c': ['c', 'center'],
            's': ['s', 'skip'],
        }
        usrStr = drawer.selectionParse(usrStr, ref)
        return usrStr  # may be None
Esempio n. 45
0
    def _keyParser(self, usrStr):
        if drawer.isNum(usrStr) or drawer.isList(usrStr):
            return usrStr # not a string, a data obj
        # only parse if a string
        
        # may need to add: 'd' for dimension
        # 'z' for z axis?
        ref = {
            'f' : ['f', 'format', 'form', 'type'],
            'k' : ['k', 'colors'],
            'r' : ['r', 'radius'],
            'i' : ['i', 'init', 'initial'],
            'x' : ['x', 'size'],
            'y' : ['y', 'steps', 'gen'],
            'w' : ['w', 'width'],
            'c' : ['c', 'center'],
            's' : ['s', 'skip'],

                }
        usrStr = drawer.selectionParse(usrStr, ref)
        return usrStr # may be None
Esempio n. 46
0
 def _valueSelectTriParser(self, usrStr):
     'xyz selection'
     ref = { # automatically uses keys as case insensitive values
         'x' : [],
         'y' : [],
         'z' : [],
         'xy' : [],
         'xz' : [],
         'yx' : [],
         'yz' : [],
         'zx' : [],
         'zy' : [],
         'xyz' : [],
         'xzy' : [],
         'yxz' : [],
         'yzx' : [],
         'zxy' : [],
         'zyx' : [],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr
Esempio n. 47
0
 def _valueSelectTriParser(self, usrStr):
     'xyz selection'
     ref = { # automatically uses keys as case insensitive values
         'x' : [],
         'y' : [],
         'z' : [],
         'xy' : [],
         'xz' : [],
         'yx' : [],
         'yz' : [],
         'zx' : [],
         'zy' : [],
         'xyz' : [],
         'xzy' : [],
         'yxz' : [],
         'yzx' : [],
         'zxy' : [],
         'zyx' : [],
             }
     usrStr = drawer.selectionParse(usrStr, ref)
     if usrStr == None:
         selStr = drawer.selectionParseKeyLabel(ref)
         raise error.ParameterObjectSyntaxError, 'bad control value: enter %s.' % selStr
     return usrStr