# HG changeset patch # User David McClosky # Date 2005-06-17 17:59:37 # Node ID 9bf9685f5aae56e59206a86fffd867aa720e5020 # Parent 5a2c85174a19553ec31f60d25754e852f807d87d curvecalc exprs can return a whole Submaster now subterms will be ignored -- we only use the Submaster in this case diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -124,10 +124,16 @@ class Subexprview(tk.Frame): 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):