Mercurial > code > home > repos > light9
diff bin/curvecalc @ 274:9bf9685f5aae
curvecalc exprs can return a whole Submaster now
subterms will be ignored -- we only use the Submaster in this case
author | David McClosky <dmcc@bigasterisk.com> |
---|---|
date | Fri, 17 Jun 2005 17:59:37 +0000 |
parents | 9de7bbf50267 |
children | e7630a2072bd |
line wrap: on
line diff
--- a/bin/curvecalc Fri Jun 17 17:52:38 2005 +0000 +++ b/bin/curvecalc Fri Jun 17 17:59:37 2005 +0000 @@ -124,10 +124,16 @@ class Subterm: """one Submaster and its Subexpr""" - def __init__(self,submaster,subexpr): - make_attributes_from_args('submaster','subexpr') - def scaled(self,t): - return self.submaster * self.subexpr.eval(t) + def __init__(self, submaster, subexpr): + make_attributes_from_args('submaster', 'subexpr') + def scaled(self, t): + subexpr_eval = self.subexpr.eval(t) + if isinstance(subexpr_eval, Submaster.Submaster): + # if the expression returns a submaster, just return it + return subexpr_eval + else: + # otherwise, return our submaster multiplied by the value returned + return self.submaster * subexpr_eval class Subtermview(tk.Frame): def __init__(self,master,st,**kw):