2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
import string
|
|
|
|
import sys
|
|
|
|
import traceback
|
|
|
|
|
|
|
|
import wx
|
2004-04-19 19:24:37 -04:00
|
|
|
from wx.lib import masked
|
|
|
|
|
2003-10-01 20:58:06 -04:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class TestPanel( wx.Panel ):
|
2003-10-01 20:58:06 -04:00
|
|
|
def __init__( self, parent, log ):
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__( self, parent, -1 )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.log = log
|
2003-12-08 20:23:28 -05:00
|
|
|
panel = wx.Panel( self, -1 )
|
2003-10-01 20:58:06 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
header = wx.StaticText(panel, -1, """\
|
2004-04-19 19:24:37 -04:00
|
|
|
This shows the various options for masked.NumCtrl.
|
2003-10-01 20:58:06 -04:00
|
|
|
The controls at the top reconfigure the resulting control at the bottom.
|
|
|
|
""")
|
|
|
|
header.SetForegroundColour( "Blue" )
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
intlabel = wx.StaticText( panel, -1, "Integer width:" )
|
2004-04-19 19:24:37 -04:00
|
|
|
self.integerwidth = masked.NumCtrl(
|
2003-12-08 20:23:28 -05:00
|
|
|
panel, value=10, integerWidth=2, allowNegative=False
|
|
|
|
)
|
|
|
|
|
|
|
|
fraclabel = wx.StaticText( panel, -1, "Fraction width:" )
|
2004-04-19 19:24:37 -04:00
|
|
|
self.fractionwidth = masked.NumCtrl(
|
|
|
|
panel, value=0, integerWidth=2, allowNegative=False
|
2003-12-08 20:23:28 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
groupcharlabel = wx.StaticText( panel,-1, "Grouping char:" )
|
2004-04-19 19:24:37 -04:00
|
|
|
self.groupchar = masked.TextCtrl(
|
2006-06-10 18:13:54 -04:00
|
|
|
panel, -1, value=',', mask='*', includeChars = ' ', excludeChars = '-()0123456789',
|
|
|
|
formatcodes='F', emptyInvalid=False, validRequired=True
|
2003-12-08 20:23:28 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
decimalcharlabel = wx.StaticText( panel,-1, "Decimal char:" )
|
2004-04-19 19:24:37 -04:00
|
|
|
self.decimalchar = masked.TextCtrl(
|
2003-12-08 20:23:28 -05:00
|
|
|
panel, -1, value='.', mask='&', excludeChars = '-()',
|
|
|
|
formatcodes='F', emptyInvalid=True, validRequired=True
|
|
|
|
)
|
|
|
|
|
|
|
|
self.set_min = wx.CheckBox( panel, -1, "Set minimum value:" )
|
2004-04-19 19:24:37 -04:00
|
|
|
# Create this masked.NumCtrl using factory, to show how:
|
|
|
|
self.min = masked.Ctrl( panel, integerWidth=5, fractionWidth=2, controlType=masked.controlTypes.NUMBER )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.min.Enable( False )
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.set_max = wx.CheckBox( panel, -1, "Set maximum value:" )
|
2004-04-19 19:24:37 -04:00
|
|
|
self.max = masked.NumCtrl( panel, integerWidth=5, fractionWidth=2 )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.max.Enable( False )
|
|
|
|
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.limit_target = wx.CheckBox( panel, -1, "Limit control" )
|
|
|
|
self.allow_none = wx.CheckBox( panel, -1, "Allow empty control" )
|
|
|
|
self.group_digits = wx.CheckBox( panel, -1, "Group digits" )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.group_digits.SetValue( True )
|
2003-12-08 20:23:28 -05:00
|
|
|
self.allow_negative = wx.CheckBox( panel, -1, "Allow negative values" )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.allow_negative.SetValue( True )
|
2003-12-08 20:23:28 -05:00
|
|
|
self.use_parens = wx.CheckBox( panel, -1, "Use parentheses" )
|
|
|
|
self.select_on_entry = wx.CheckBox( panel, -1, "Select on entry" )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.select_on_entry.SetValue( True )
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
label = wx.StaticText( panel, -1, "Resulting numeric control:" )
|
2003-10-01 20:58:06 -04:00
|
|
|
font = label.GetFont()
|
2003-12-08 20:23:28 -05:00
|
|
|
font.SetWeight(wx.BOLD)
|
2003-10-01 20:58:06 -04:00
|
|
|
label.SetFont(font)
|
|
|
|
|
2004-04-19 19:24:37 -04:00
|
|
|
self.target_ctl = masked.NumCtrl( panel, -1, name="target control" )
|
2003-10-01 20:58:06 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
label_numselect = wx.StaticText( panel, -1, """\
|
2003-10-01 20:58:06 -04:00
|
|
|
Programmatically set the above
|
|
|
|
value entry ctrl:""")
|
2003-12-08 20:23:28 -05:00
|
|
|
self.numselect = wx.ComboBox(panel, -1, choices = [ '0', '111', '222.22', '-3', '54321.666666666', '-1353.978',
|
2003-10-01 20:58:06 -04:00
|
|
|
'1234567', '-1234567', '123456789', '-123456789.1',
|
|
|
|
'1234567890.', '-9876543210.9' ])
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
grid1 = wx.FlexGridSizer( 0, 4, 0, 0 )
|
|
|
|
grid1.Add( intlabel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
|
2004-04-22 18:57:01 -04:00
|
|
|
grid1.Add( self.integerwidth, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
grid1.Add( groupcharlabel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
|
2004-04-22 18:57:01 -04:00
|
|
|
grid1.Add( self.groupchar, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
grid1.Add( fraclabel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
2004-04-22 18:57:01 -04:00
|
|
|
grid1.Add( self.fractionwidth, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
grid1.Add( decimalcharlabel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
|
2004-04-22 18:57:01 -04:00
|
|
|
grid1.Add( self.decimalchar, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
grid1.Add( self.set_min, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
|
|
|
grid1.Add( self.min, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
|
|
|
grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
|
|
|
|
grid1.Add( self.set_max, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
|
|
|
grid1.Add( self.max, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
|
|
|
grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
|
|
|
|
|
|
|
|
grid1.Add( self.limit_target, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
|
|
|
grid1.Add( self.allow_none, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
|
|
|
hbox1 = wx.BoxSizer( wx.HORIZONTAL )
|
|
|
|
hbox1.Add( (17,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
hbox1.Add( self.group_digits, 0, wx.ALIGN_LEFT|wx.LEFT, 5 )
|
|
|
|
grid1.Add( hbox1, 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
|
|
|
|
grid1.Add( self.allow_negative, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
|
|
|
grid1.Add( self.use_parens, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
|
|
|
hbox2 = wx.BoxSizer( wx.HORIZONTAL )
|
|
|
|
hbox2.Add( (17,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
hbox2.Add( self.select_on_entry, 0, wx.ALIGN_LEFT|wx.LEFT, 5 )
|
|
|
|
grid1.Add( hbox2, 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
|
|
|
|
|
|
|
|
grid2 = wx.FlexGridSizer( 0, 2, 0, 0 )
|
|
|
|
grid2.Add( label, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
|
|
|
grid2.Add( self.target_ctl, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
|
|
|
grid2.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
grid2.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
grid2.Add( label_numselect, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
|
|
|
grid2.Add( self.numselect, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
|
|
|
grid2.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
|
|
|
grid2.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5)
|
2003-10-01 20:58:06 -04:00
|
|
|
grid2.AddGrowableCol(1)
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.outer_box = wx.BoxSizer( wx.VERTICAL )
|
|
|
|
self.outer_box.Add(header, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 20)
|
|
|
|
self.outer_box.Add( grid1, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.BOTTOM|wx.RIGHT, 20 )
|
|
|
|
self.outer_box.Add( grid2, 0, wx.ALIGN_LEFT|wx.ALL, 20 )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.grid2 = grid2
|
|
|
|
|
|
|
|
panel.SetAutoLayout( True )
|
|
|
|
panel.SetSizer( self.outer_box )
|
|
|
|
self.outer_box.Fit( panel )
|
|
|
|
panel.Move( (50,10) )
|
|
|
|
self.panel = panel
|
|
|
|
|
2004-04-19 19:24:37 -04:00
|
|
|
self.Bind(masked.EVT_NUM, self.OnSetIntWidth, self.integerwidth )
|
|
|
|
self.Bind(masked.EVT_NUM, self.OnSetFractionWidth, self.fractionwidth )
|
2003-12-08 20:23:28 -05:00
|
|
|
self.Bind(wx.EVT_TEXT, self.OnSetGroupChar, self.groupchar )
|
|
|
|
self.Bind(wx.EVT_TEXT, self.OnSetDecimalChar, self.decimalchar )
|
2003-10-01 20:58:06 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetMin, self.set_min )
|
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetMax, self.set_max )
|
2004-04-19 19:24:37 -04:00
|
|
|
self.Bind(masked.EVT_NUM, self.SetTargetMinMax, self.min )
|
|
|
|
self.Bind(masked.EVT_NUM, self.SetTargetMinMax, self.max )
|
2003-10-01 20:58:06 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.SetTargetMinMax, self.limit_target )
|
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetAllowNone, self.allow_none )
|
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetGroupDigits, self.group_digits )
|
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetAllowNegative, self.allow_negative )
|
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetUseParens, self.use_parens )
|
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnSetSelectOnEntry, self.select_on_entry )
|
2003-10-01 20:58:06 -04:00
|
|
|
|
2004-04-19 19:24:37 -04:00
|
|
|
self.Bind(masked.EVT_NUM, self.OnTargetChange, self.target_ctl )
|
2003-12-08 20:23:28 -05:00
|
|
|
self.Bind(wx.EVT_COMBOBOX, self.OnNumberSelect, self.numselect )
|
2003-10-01 20:58:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
def OnSetIntWidth(self, event ):
|
|
|
|
width = self.integerwidth.GetValue()
|
2003-12-08 20:23:28 -05:00
|
|
|
|
2003-10-01 20:58:06 -04:00
|
|
|
if width < 1:
|
|
|
|
self.log.write("integer width must be positive\n")
|
2003-12-08 20:23:28 -05:00
|
|
|
self.integerwidth.SetForegroundColour(wx.RED)
|
2003-10-01 20:58:06 -04:00
|
|
|
else:
|
2003-12-08 20:23:28 -05:00
|
|
|
self.integerwidth.SetForegroundColour(wx.BLACK)
|
2003-10-01 20:58:06 -04:00
|
|
|
self.log.write("setting integer width to %d\n" % width)
|
|
|
|
self.target_ctl.SetParameters( integerWidth = width)
|
|
|
|
# Now resize and fit the dialog as appropriate:
|
|
|
|
self.grid2.SetItemMinSize(self.target_ctl, self.target_ctl.GetSize())
|
|
|
|
self.outer_box.Fit( self.panel )
|
|
|
|
self.outer_box.SetSizeHints( self.panel )
|
|
|
|
|
|
|
|
|
|
|
|
def OnSetFractionWidth(self, event ):
|
|
|
|
width = self.fractionwidth.GetValue()
|
|
|
|
self.log.write("setting fraction width to %d\n" % width)
|
|
|
|
self.target_ctl.SetParameters( fractionWidth = width)
|
|
|
|
# Now resize and fit the dialog as appropriate:
|
|
|
|
self.grid2.SetItemMinSize(self.target_ctl, self.target_ctl.GetSize())
|
|
|
|
self.outer_box.Fit( self.panel )
|
|
|
|
self.outer_box.SetSizeHints( self.panel )
|
|
|
|
|
|
|
|
|
|
|
|
def OnSetGroupChar( self, event ):
|
|
|
|
char = self.groupchar.GetValue()
|
|
|
|
if self.target_ctl.GetDecimalChar() == char:
|
|
|
|
self.log.write("group and decimal chars must be different\n")
|
2003-12-08 20:23:28 -05:00
|
|
|
self.groupchar.SetForegroundColour(wx.RED)
|
2003-10-01 20:58:06 -04:00
|
|
|
else:
|
2003-12-08 20:23:28 -05:00
|
|
|
self.groupchar.SetForegroundColour(wx.BLACK)
|
2003-10-01 20:58:06 -04:00
|
|
|
self.log.write("setting group char to %s\n" % char)
|
|
|
|
self.target_ctl.SetGroupChar( char )
|
|
|
|
|
|
|
|
def OnSetDecimalChar( self, event ):
|
|
|
|
char = self.decimalchar.GetValue()
|
|
|
|
if self.target_ctl.GetGroupChar() == char:
|
|
|
|
self.log.write("group and decimal chars must be different\n")
|
2003-12-08 20:23:28 -05:00
|
|
|
self.decimalchar.SetForegroundColour(wx.RED)
|
2003-10-01 20:58:06 -04:00
|
|
|
else:
|
2003-12-08 20:23:28 -05:00
|
|
|
self.decimalchar.SetForegroundColour(wx.BLACK)
|
2003-10-01 20:58:06 -04:00
|
|
|
self.log.write("setting decimal char to %s\n" % char)
|
|
|
|
self.target_ctl.SetDecimalChar( char )
|
|
|
|
|
|
|
|
|
|
|
|
def OnSetMin( self, event ):
|
|
|
|
self.min.Enable( self.set_min.GetValue() )
|
|
|
|
self.SetTargetMinMax()
|
|
|
|
|
|
|
|
def OnSetMax( self, event ):
|
|
|
|
self.max.Enable( self.set_max.GetValue() )
|
|
|
|
self.SetTargetMinMax()
|
|
|
|
|
|
|
|
|
|
|
|
def SetTargetMinMax( self, event=None ):
|
|
|
|
min = max = None
|
|
|
|
self.target_ctl.SetLimited( self.limit_target.GetValue() )
|
|
|
|
|
|
|
|
if self.set_min.GetValue():
|
|
|
|
min = self.min.GetValue()
|
|
|
|
if self.set_max.GetValue():
|
|
|
|
max = self.max.GetValue()
|
|
|
|
|
|
|
|
cur_min, cur_max = self.target_ctl.GetBounds()
|
|
|
|
|
|
|
|
if min != cur_min and not self.target_ctl.SetMin( min ):
|
|
|
|
if self.target_ctl.GetMax() is None and cur_max > min:
|
|
|
|
self.log.write( "min (%d) won't fit in control -- bound not set\n" % min )
|
|
|
|
else:
|
|
|
|
self.log.write( "min (%d) > current max (%d) -- bound not set\n" % ( min, self.target_ctl.GetMax() ) )
|
2003-12-08 20:23:28 -05:00
|
|
|
self.min.SetParameters( signedForegroundColour=wx.RED, foregroundColour=wx.RED )
|
2003-10-01 20:58:06 -04:00
|
|
|
else:
|
2003-12-08 20:23:28 -05:00
|
|
|
self.min.SetParameters( signedForegroundColour=wx.BLACK, foregroundColour=wx.BLACK )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.min.Refresh()
|
|
|
|
|
|
|
|
if max != cur_max and not self.target_ctl.SetMax( max ):
|
|
|
|
if self.target_ctl.GetMax() is None and cur_min < max:
|
|
|
|
self.log.write( "max (%d) won't fit in control -- bound not set\n" % max )
|
|
|
|
else:
|
|
|
|
self.log.write( "max (%d) < current min (%d) -- bound not set\n" % ( max, self.target_ctl.GetMin() ) )
|
2003-12-08 20:23:28 -05:00
|
|
|
self.max.SetParameters( signedForegroundColour=wx.RED, foregroundColour=wx.RED )
|
2003-10-01 20:58:06 -04:00
|
|
|
else:
|
2003-12-08 20:23:28 -05:00
|
|
|
self.max.SetParameters( signedForegroundColour=wx.BLACK, foregroundColour=wx.BLACK )
|
2003-10-01 20:58:06 -04:00
|
|
|
self.max.Refresh()
|
|
|
|
|
|
|
|
if min != cur_min or max != cur_max:
|
|
|
|
new_min, new_max = self.target_ctl.GetBounds()
|
|
|
|
self.log.write( "current min, max: (%s, %s)\n" % ( str(new_min), str(new_max) ) )
|
|
|
|
|
|
|
|
|
|
|
|
def OnSetAllowNone( self, event ):
|
|
|
|
self.target_ctl.SetAllowNone( self.allow_none.GetValue() )
|
|
|
|
|
|
|
|
|
|
|
|
def OnSetGroupDigits( self, event ):
|
|
|
|
self.target_ctl.SetGroupDigits( self.group_digits.GetValue() )
|
|
|
|
# Now resize and fit the dialog as appropriate:
|
|
|
|
self.grid2.SetItemMinSize(self.target_ctl, self.target_ctl.GetSize())
|
|
|
|
self.outer_box.Fit( self.panel )
|
|
|
|
self.outer_box.SetSizeHints( self.panel )
|
|
|
|
|
|
|
|
|
|
|
|
def OnSetAllowNegative( self, event ):
|
|
|
|
if self.allow_negative.GetValue():
|
|
|
|
self.use_parens.Enable(True)
|
|
|
|
self.target_ctl.SetParameters(allowNegative=True,
|
|
|
|
useParensForNegatives = self.use_parens.GetValue())
|
|
|
|
else:
|
|
|
|
self.target_ctl.SetAllowNegative(False)
|
|
|
|
# Now resize and fit the dialog as appropriate:
|
|
|
|
self.grid2.SetItemMinSize(self.target_ctl, self.target_ctl.GetSize())
|
|
|
|
self.outer_box.Fit( self.panel )
|
|
|
|
self.outer_box.SetSizeHints( self.panel )
|
|
|
|
|
|
|
|
|
|
|
|
def OnSetUseParens( self, event ):
|
|
|
|
self.target_ctl.SetUseParensForNegatives( self.use_parens.GetValue() )
|
|
|
|
# Now resize and fit the dialog as appropriate:
|
|
|
|
self.grid2.SetItemMinSize(self.target_ctl, self.target_ctl.GetSize())
|
|
|
|
self.outer_box.Fit( self.panel )
|
|
|
|
self.outer_box.SetSizeHints( self.panel )
|
|
|
|
|
|
|
|
|
|
|
|
def OnSetSelectOnEntry( self, event ):
|
|
|
|
self.target_ctl.SetSelectOnEntry( self.select_on_entry.GetValue() )
|
|
|
|
|
|
|
|
|
|
|
|
def OnTargetChange( self, event ):
|
|
|
|
ctl = event.GetEventObject()
|
|
|
|
value = ctl.GetValue()
|
|
|
|
ib_str = [ " (out of bounds)", "" ]
|
|
|
|
self.log.write( "value = %s (%s)%s\n" % ( repr(value), repr(type(value)), ib_str[ ctl.IsInBounds(value) ] ) )
|
|
|
|
|
|
|
|
|
|
|
|
def OnNumberSelect( self, event ):
|
|
|
|
value = event.GetString()
|
|
|
|
if value:
|
|
|
|
if value.find('.') != -1:
|
|
|
|
numvalue = float(value)
|
|
|
|
else:
|
|
|
|
numvalue = long(value)
|
|
|
|
else:
|
|
|
|
numvalue = value # try to clear the value again
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.target_ctl.SetValue(numvalue)
|
|
|
|
except:
|
|
|
|
type, value, tb = sys.exc_info()
|
|
|
|
for line in traceback.format_exception_only(type, value):
|
|
|
|
self.log.write(line)
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest( frame, nb, log ):
|
|
|
|
win = TestPanel( nb, log )
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
2004-04-19 19:24:37 -04:00
|
|
|
import wx.lib.masked.numctrl as mnum
|
2004-10-11 18:13:18 -04:00
|
|
|
overview = """<html>
|
|
|
|
<PRE><FONT SIZE=-1>
|
|
|
|
""" + mnum.__doc__ + """
|
|
|
|
</FONT></PRE>"""
|
2003-10-01 20:58:06 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-04 19:06:33 -05:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|