MaskedEditCtrl Linux dumps with error

Stefano Bartaletti s.bartaletti at dyemagic.com
Mon Feb 18 05:52:10 PST 2008


I have a NumCtrl set up with integerWidth=9, fractionWidth=0, 
allowNegative=False
If I enter a value, TAB and SHIFT-TAB, press Del, enter a new value, I get 
this trace (I've changed line 3192 for little more trace)

Traceback (most recent call last):
  
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py", 
line 3108, in _OnChar
    newfield = self._FindField(newpos)
  
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/lib/masked/maskededit.py", 
line 3192, in _FindField
    raise IndexError('position %s out of range of control (%s)' % (str(pos), 
str(self._masklength)))
IndexError: position 12 out of range of control (11)

- If I simply enter a new value overwriting the previous, all is ok.
- It works fine with a NumCtrl with decimals
- Works fine on Windows (tested same version)

Strangely enough, the same operation succeeds with Demo files.
This is the code I used:

class cachedEditCtrl(masked.NumCtrl):
    def __init__(self, parent, valoreIniziale=None, **kwargs):
        self.valoreIniziale = valoreIniziale
        masked.NumCtrl.__init__(self, parent, wx.ID_ANY, **kwargs)
    
    def IsChanged(self):
        return self.valoreIniziale is not None and self.GetValue() != 
self.valoreIniziale or False
    
class EditQuantitaDecimali(cachedEditCtrl):
    def __init__(self, parent, valIniziale=None, integerWidth=9, 
fractionWidth=2, allowNegative=False):
        cachedEditCtrl.__init__(self, parent, valIniziale, 
integerWidth=integerWidth, fractionWidth=fractionWidth, 
allowNegative=allowNegative)

class EditQuantita(cachedEditCtrl):
    def __init__(self, parent, valoreIniziale=None, integerWidth=9, 
fractionWidth=0, allowNegative=False):
        cachedEditCtrl.__init__(self, parent, valoreIniziale, 
integerWidth=integerWidth, allowNegative=allowNegative)

What is wrong?

Talking about decimal part, on Linux I have to press Del and clear it 
otherwise it won't let me write and I get a -beep- from the PC speaker (in 
Demo also)

Running on Ubuntu Gutsy, wx 2.8.7.1, python 2.5.1

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23 




More information about the wxpython-users mailing list