XRCed 1.8-0 bug

ava tomas_dvorak at mailcan.com
Wed Feb 21 04:47:15 PST 2007


Hi,
I found a bug in XRCed 1.8-0

Class ParamIntList (file param.py, line 730 something) doesn't have SetValue()
correctly overriden (for a list with items 1, 2, 3 SetValue generates '1|2|3'
instead of '[1,2,3]'. This causes problems f.e. in growablecols/rows in
flexgridsizers.

Easy solution is to add a method 
    def SetValue(self, value):
        self.freeze = True
        if not value: value = []
        self.value = value
        repr_ = '[%s]' % (','.join(str(v) for v in value))
        self.text.SetValue(repr_)  # update text ctrl
        self.freeze = False
to class ParamIntList

Method OnButtonEdit of class ParamIntList should also have a check for empty
input value just after the try: clause, like:
                if not self.text.GetValue():
                    self.value = []
                else:
                    self.value = eval(self.text.GetValue())

I'd also recommend to replace lines 642 to 645 (
        if value:
           repr_ = reduce(lambda a,b: '%s|%s' % (a,b), value)
        else:
            repr_ = ''
)
with repr_ = '|'.join(str(v) for v in value) 
which is easier to read, handles more cases correctly (always outputs string
even with nonstr items in value) and IMO is faster.

Still, XRCed is the best GUI designer :), thanks for your effort.
regards..
    Tomas Dvorak 






More information about the wxpython-dev mailing list