Mercurial > code > home > repos > light9
changeset 753:8b2417058fe0
patch weird gtk memory-clearing issue
Ignore-this: 6d77f8a885ab51adf8287d68383eb039
author | drewp@bigasterisk.com |
---|---|
date | Fri, 15 Jun 2012 22:06:07 +0000 |
parents | 20d6884478bc |
children | 3444b2b425cf |
files | light9/curvecalc/subtermview.py |
diffstat | 1 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/curvecalc/subtermview.py Fri Jun 15 20:50:20 2012 +0000 +++ b/light9/curvecalc/subtermview.py Fri Jun 15 22:06:07 2012 +0000 @@ -5,6 +5,10 @@ from light9.namespaces import L9 from light9.curvecalc.subterm import Subterm, Subexpr +# inspired by http://www.daa.com.au/pipermail/pygtk/2008-August/015772.html +# keeping a ref to the __dict__ of the object stops it from getting zeroed +keep = [] + class Subexprview(object): def __init__(self, se): self.subexpr = se @@ -22,11 +26,15 @@ self.expr_changed() self.entryBuffer.connect("deleted-text", self.entry_changed) self.entryBuffer.connect("inserted-text", self.entry_changed) - dispatcher.connect(self.expr_changed,"expr_changed", + dispatcher.connect(self.expr_changed, "expr_changed", sender=self.subexpr) - dispatcher.connect(lambda exc: self.error.set_text(str(exc)), - "expr_error",sender=self.subexpr,weak=0) + dispatcher.connect(self.exprError, "expr_error", sender=self.subexpr) + print "made", id(self), self.__dict__ + keep.append(self.__dict__) + + def exprError(self, exc): + self.error.set_text(str(exc)) def expr_changed(self): e = str(self.subexpr.expr) @@ -35,7 +43,7 @@ def entry_changed(self, *args): self.subexpr.expr = self.entryBuffer.get_text() - + class Subtermview(object): """ has .label and .exprView widgets for you to put in a table @@ -48,7 +56,6 @@ sev = Subexprview(self.subterm.subexpr) self.exprView = sev.box - def add_one_subterm(graph, subUri, curveset, subterms, master, expr=None, show=False): subname = graph.label(subUri) print "%s's label is %s" % (subUri, subname)