ioam / paramtk

Tk interface for Param

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ParametersFrame change checking broken for empty FixedPoint

sf-issues opened this issue · comments

Converted from SourceForge issue 1864419, submitted by ceball
Submit Date: 2008-01-05 10:37 GMT

In a ParametersFrame, clearing out the value of a FixedPoint number causes an error.

This happens because the GUI automatically checks to see if a Parameter has changed, but passing an empty string to FixedPoint (for the comparison) causes an error (FixedPoint can't represent the value of an empty string).

(E.g. Edit properties of tiny.ty's projection and clear out the 'delay' field.)

Submitted by jbednar
Date: 2008-01-07 17:12 GMT

Doesn't clearing out the value of any number cause an error? The topoconsole window has a status message saying 'SyntaxError (unexpected EOF while parsing (line 0))', at least, which makes sense as it's not normally defined what number an empty string should be...

Submitted by ceball
Date: 2008-01-08 06:20 GMT

Doesn't clearing out the value of any number cause an error?

This is different. The (handled) error you see for an empty string in a number usually is to tell you that what you have typed (or what you haven't typed) won't be acceptable.

The error you get for clearing out in the fixedpoint case is an unhandled error caused by status-indicating code that tries to do a comparison to see if the value has changed.

Submitted by nobody
Date: 2008-01-09 12:01 GMT

Incidentally:

Topographica_t0>>> 1!=None
True
Topographica_t0>>> f = FixedPoint("1.0")
Topographica_t0>>> f!=None
Traceback (most recent call last):
File "", line 1, in
File "/home/ceball/topographica2/lib/python2.5/site-packages/fixedpoint.py", line 339, in cmp
xn, yn, p = _norm(self, other, FixedPoint=type(self))
File "/home/ceball/topographica2/lib/python2.5/site-packages/fixedpoint.py", line 505, in _norm
y = FixedPoint(y, x.p)
File "/home/ceball/topographica2/lib/python2.5/site-packages/fixedpoint.py", line 259, in init
raise TypeError("can't convert to FixedPoint: " + value)
TypeError: can't convert to FixedPoint: None
Topographica_t0>>>

Submitted by jbednar
Date: 2008-01-09 12:35 GMT

Maybe the way that fixed point implements comparisons tries to make everything into a number, and None is not a number, so it doesn't work.

Submitted by ceball
Date: 2008-05-06 02:58 GMT

Fixed in r8495