def _reprView(self, extData={}): """privide standard TIv display""" headList = [] headList.append('TC: %s, TI: %s\n' % (self.name, self.nameParent)) tStrAbs = typeset.timeRangeAsStr(self.timeRangeAbs) headList.append('%s%s: %s, duration: %s\n' % (lang.TAB, lang.MUTELABEL, self._getMuteStr(), tStrAbs)) entryLines = [] for p in ('time', 'sus', 'acc'): if p not in self.pmtrActive: continue attr, label = self.decodePmtrName(p) entryLines.append([label, self.pmtrObjDict[attr].repr()]) for p in ('fieldQ', 'octQ', 'ampQ', 'panQ'): if p not in self.pmtrActive: continue attr, label = self.decodePmtrName(p) entryLines.append([label, self.pmtrObjDict[attr].repr()]) if self.auxNo == 0: entryLines.append([self.decodePmtrName('x')[1], 'none']) else: entryLines.append([self.decodePmtrName('x')[1], '']) for i, auxLabel in basePmtr.auxLabel(self.auxNo, 1): valueStr = self.pmtrObjDict[auxLabel].repr() entryLines.append([(lang.TAB + 'x%i'% i), valueStr]) if self.clonePmtrNo == 0: entryLines.append([self.decodePmtrName('s')[1], 'none']) else: entryLines.append([self.decodePmtrName('s')[1], '']) for i, textLabel in basePmtr.cloneLabel(self.clonePmtrNo, 1): valueStr = self.pmtrObjDict[textLabel].repr() entryLines.append([(lang.TAB + 's%i'% i), valueStr]) return headList, entryLines
def _reprView(self, extData={}): """privide standard TIv display""" headList = [] headList.append('TC: %s, TI: %s\n' % (self.name, self.nameParent)) tStrAbs = typeset.timeRangeAsStr(self.timeRangeAbs) headList.append( '%s%s: %s, duration: %s\n' % (lang.TAB, lang.MUTELABEL, self._getMuteStr(), tStrAbs)) entryLines = [] for p in ('time', 'sus', 'acc'): if p not in self.pmtrActive: continue attr, label = self.decodePmtrName(p) entryLines.append([label, self.pmtrObjDict[attr].repr()]) for p in ('fieldQ', 'octQ', 'ampQ', 'panQ'): if p not in self.pmtrActive: continue attr, label = self.decodePmtrName(p) entryLines.append([label, self.pmtrObjDict[attr].repr()]) if self.auxNo == 0: entryLines.append([self.decodePmtrName('x')[1], 'none']) else: entryLines.append([self.decodePmtrName('x')[1], '']) for i, auxLabel in basePmtr.auxLabel(self.auxNo, 1): valueStr = self.pmtrObjDict[auxLabel].repr() entryLines.append([(lang.TAB + 'x%i' % i), valueStr]) if self.clonePmtrNo == 0: entryLines.append([self.decodePmtrName('s')[1], 'none']) else: entryLines.append([self.decodePmtrName('s')[1], '']) for i, textLabel in basePmtr.cloneLabel(self.clonePmtrNo, 1): valueStr = self.pmtrObjDict[textLabel].repr() entryLines.append([(lang.TAB + 's%i' % i), valueStr]) return headList, entryLines
def editPmtrObj(self, pmtrName, pmtrValue, refDict, esObj=None, refresh=1): """refresh: turn off score generation clearing a clone may be good; texture should not be cleared clearing the esObj of a clone causes a problem when trying to using the TCmap comamnd; for now, do not clear score self.clearScore() # dont store all this data, but pmtrs updated """ p = pmtrName newData = pmtrValue if (p in self.pmtrCommon and p not in self.pmtrActive): return None, 'no %s parameter in TC %s.' % (p, self.name) elif (p in ('time', 'sus', 'acc', 'ampQ', 'panQ', 'fieldQ', 'octQ',) or p[:4]=='auxQ' or p[:6]=='cloneQ'): if p[:4] == 'auxQ': if p not in basePmtr.auxLabel(self.auxNo): return 0, 'no such auxiliary label' if p[:6] == 'cloneQ': if p not in basePmtr.cloneLabel(self.clonePmtrNo): return 0, 'no such clone label' attrName = 'pmtrQDict' oldData = self.pmtrQDict # attrReference newData = copy.deepcopy(self.pmtrQDict) # copy old dict newData[p] = pmtrValue else: return 0, 'incorrect parameter label access.' setattr(self, attrName, newData) # make change try: # try to refresh objects editPhase = 'object creation:' ok, msg = self.updatePmtrObj(p, refDict) if not ok: self._editRestore(attrName, p, oldData, refDict) return ok, msg if refresh and esObj != None: # test w/ an esObj editPhase = 'score creation:' ok = self.score(esObj, refDict) if not ok: self._editRestore(attrName, p, oldData, refDict) return ok, 'score creation returned an error.' except error.ParameterObjectSyntaxError as msg: # standard init errors from pmtr obj msg = '%s %s' % (editPhase, msg) ok = 0 except IndexError as msg: msg = '%s incorrect number of arguments. %s.' % (editPhase, msg) ok = 0 except TypeError as msg: msg = '%s incorrect data-type in arguments. %s' % (editPhase, msg) ok = 0 except UnboundLocalError as msg: msg = '%s incorrect paramater type in arguments. %s' % (editPhase, msg) ok = 0 except ValueError as msg: msg = '%s value error: an inappropriate data type used.' % editPhase ok = 0 except ZeroDivisionError: msg = '%s zero division error: zero cannot be a divisor.' % editPhase ok = 0 if not ok: self._editRestore(attrName, p, oldData, refDict) return ok, msg return 1, '' # success
def _updateClonePmtrDefaults(self): """this only supplies names, which wil load defaults""" for i, cloneLabel in basePmtr.cloneLabel(self.clonePmtrNo, 1): # add arg list default if missing to pmtrQdict if not cloneLabel in self.pmtrQDict.keys(): args = [self.clonePmtrNames[i],] dummyObj = parameter.factory(args, 'clonePmtrObjs', self.refDict) self.pmtrQDict[cloneLabel] = dummyObj.getArgs()
def _updateClonePmtrDefaults(self): """this only supplies names, which wil load defaults""" for i, cloneLabel in basePmtr.cloneLabel(self.clonePmtrNo, 1): # add arg list default if missing to pmtrQdict if not cloneLabel in list(self.pmtrQDict.keys()): args = [self.clonePmtrNames[i],] dummyObj = parameter.factory(args, 'clonePmtrObjs', self.refDict) self.pmtrQDict[cloneLabel] = dummyObj.getArgs()
def _reprDocStatic(self, extData={}): """privide a partial documentation view for TIdoc display aux doc string will come form the texture place before entrLines from here """ entryLines = [] if self.clonePmtrNo == 0: entryLines.append([self.decodePmtrName('s')[1], 'none']) else: entryLines.append([self.decodePmtrName('s')[1], '']) for i, textLabel in basePmtr.cloneLabel(self.clonePmtrNo, 1): valueStr = self.pmtrObjDict[textLabel].reprDoc('argsMax') #valueStr = self.getCloneStaticArgsLabel(textLabel) entryLines.append([(lang.TAB + 's%i'% i), valueStr]) return entryLines
def _reprDocStatic(self, extData={}): """privide a partial documentation view for TIdoc display aux doc string will come form the texture place before entrLines from here """ entryLines = [] if self.clonePmtrNo == 0: entryLines.append([self.decodePmtrName('s')[1], 'none']) else: entryLines.append([self.decodePmtrName('s')[1], '']) for i, textLabel in basePmtr.cloneLabel(self.clonePmtrNo, 1): valueStr = self.pmtrObjDict[textLabel].reprDoc('argsMax') #valueStr = self.getCloneStaticArgsLabel(textLabel) entryLines.append([(lang.TAB + 's%i' % i), valueStr]) return entryLines
def editPmtrObj(self, pmtrName, pmtrValue, refDict, esObj=None, refresh=1): """refresh: turn off score generation clearing a clone may be good; texture should not be cleared clearing the esObj of a clone causes a problem when trying to using the TCmap comamnd; for now, do not clear score self.clearScore() # dont store all this data, but pmtrs updated """ p = pmtrName newData = pmtrValue if (p in self.pmtrCommon and p not in self.pmtrActive): return None, 'no %s parameter in TC %s.' % (p, self.name) elif (p in ('time', 'sus', 'acc', 'ampQ', 'panQ', 'fieldQ', 'octQ',) or p[:4]=='auxQ' or p[:6]=='cloneQ'): if p[:4] == 'auxQ': if p not in basePmtr.auxLabel(self.auxNo): return 0, 'no such auxiliary label' if p[:6] == 'cloneQ': if p not in basePmtr.cloneLabel(self.clonePmtrNo): return 0, 'no such clone label' attrName = 'pmtrQDict' oldData = self.pmtrQDict # attrReference newData = copy.deepcopy(self.pmtrQDict) # copy old dict newData[p] = pmtrValue else: return 0, 'incorrect parameter label access.' setattr(self, attrName, newData) # make change try: # try to refresh objects editPhase = 'object creation:' ok, msg = self.updatePmtrObj(p, refDict) if not ok: self._editRestore(attrName, p, oldData, refDict) return ok, msg if refresh and esObj != None: # test w/ an esObj editPhase = 'score creation:' ok = self.score(esObj, refDict) if not ok: self._editRestore(attrName, p, oldData, refDict) return ok, 'score creation returned an error.' except error.ParameterObjectSyntaxError, msg: # standard init errors from pmtr obj msg = '%s %s' % (editPhase, msg) ok = 0
def __init__(self, name=None, nameParent=None): self.name = name # get data from texture self.nameParent = nameParent # may be none self.pmtrQDict = {} self.pmtrObjDict = {} self.mute = 0 # mute boolean # this is now down with a cloneStatic parameterObject #self.timeRef = 'tt' # time reference, either texture or clone self.timeRangeAbs = None # absolute, calculated time rangec # used to store data pased to parameter objects self.refDict = {} # not yet used self.pmtrCommon = basePmtr.cCOMMONQ self.pmtrActive = self.pmtrCommon # default is all common are active # as textures, thes are defined in each module self.clonePmtrNames = ['timeReferenceSource', 'retrogradeMethodToggle'] self.clonePmtrNo = len(self.clonePmtrNames) self.cloneLabels = basePmtr.cloneLabel(self.clonePmtrNo) self.auxNo = 0 # set w/ load method self.auxFmt = None # set w/ load method