Mercurial > code > home > repos > light9
changeset 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 | 5a2c85174a19 |
children | c7bba03ddc36 |
files | bin/curvecalc |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
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):