[FIXED] SpinNumCtrl.py - problem with the "min" attribute
Posted: Wed Jan 21, 2009 10:39 am
Build 0.3.6.1487
==================
I found another bug in the file SpinNumCtrl.py
This is my code snippet:If I open the configuration dialog, it will cause the following error message:I found one possible solution.
If this part of the code:I change as follows,the error does not occur and everything is working properly.
Pako
==================
I found another bug in the file SpinNumCtrl.py
This is my code snippet:
Code: Select all
426 periodNumCtrl = eg.SpinNumCtrl(
427 panel,
428 -1,
429 period,
430 integerWidth = 5,
431 fractionWidth = 1,
432 allowNegative = False,
433 min = 0.1,
434 increment = 0.1,
435 )Code: Select all
10:55:13 Error while configuring: Demo: Demo action
10:55:13 Traceback (most recent call last):
10:55:13 File "d:\Programs\E\EventGhost\eg\Classes\MainFrame\TreeCtrl.py", line 307, in OnLeftDoubleClick
10:55:13 eg.UndoHandler.Configure().Try(self.document)
10:55:13 File "d:\Programs\E\EventGhost\eg\Classes\UndoHandler\Configure.py", line 32, in Try
10:55:13 eg.Greenlet(self.Do).switch(item)
10:55:13 File "d:\Programs\E\EventGhost\eg\Classes\UndoHandler\Configure.py", line 57, in Do
10:55:13 newArgs = gr.switch(*item.GetArgs())
10:55:13 File "D:\Programs\E\EventGhost\plugins\Demo\__init__.py", line 434, in Configure
10:55:13 increment = 0.1,
10:55:13 File "D:\Programs\E\EventGhost\eg\Classes\SpinNumCtrl.py", line 85, in __init__
10:55:13 numCtrl.SetParameters(**newArgs) # to avoid bug in NumCtrl
10:55:13 File "wx\lib\masked\numctrl.pyc", line 871, in SetParameters
10:55:13 File "wx\lib\masked\numctrl.pyc", line 1585, in _toGUI
10:55:13 ValueError: value 0 is below minimum value of controlIf this part of the code:
Code: Select all
67 if "min" in kwargs:
68 if kwargs["min"] < 0:
69 newArgs["allowNegative"] = True
70
71 newArgs.update(kwargs)
72 wx.Window.__init__(self, parent, id, pos, size, 0)
73 self.SetThemeEnabled(True)
74 numCtrl = masked.NumCtrl(
75 self,
76 -1,
77 0, #value,
78 pos,
79 size,
80 style,
81 validator,
82 name,
83 #**newArgs # to avoid bug in NumCtrl
84 )
85 numCtrl.SetParameters(**newArgs) # to avoid bug in NumCtrl
86 numCtrl.SetValue(value) # to avoid bug in NumCtrlCode: Select all
if "min" in kwargs:
if kwargs["min"] < 0:
newArgs["allowNegative"] = True
tmpMin = kwargs["min"]
kwargs["min"] = None
else:
tmpMin = None
newArgs.update(kwargs)
wx.Window.__init__(self, parent, id, pos, size, 0)
self.SetThemeEnabled(True)
numCtrl = masked.NumCtrl(
self,
-1,
0, #value,
pos,
size,
style,
validator,
name,
#**newArgs # to avoid bug in NumCtrl
)
numCtrl.SetParameters(**newArgs) # to avoid bug in NumCtrl
numCtrl.SetValue(value) # to avoid bug in NumCtrl
numCtrl.SetMin(tmpMin)Pako