parameters: (self, mask, **reset_args)
docstring: This function sets flags for automatic styling options.  It is
          called whenever a control or field-level parameter is set/changed.
  
          This routine does the bulk of the interdependent parameter processing, determining
          the field extents of the mask if changed, resetting parameters as appropriate,
          determining the overall template value for the control, etc.
  
          reset_args is supplied if called from control's .SetCtrlParameters()
          routine, and indicates which if any parameters which can be
          overridden by individual fields have been reset by request for the
          whole control.
docstring_summary: This function sets flags for automatic styling options.  It is
          called whenever a control or field-level parameter is set/changed.
docstring_tokens: This function sets flags for automatic styling options . It is called whenever a control or field - level parameter is set / changed .
function: def _configure(self, mask, **reset_args):
          """
          This function sets flags for automatic styling options.  It is
          called whenever a control or field-level parameter is set/changed.
  
          This routine does the bulk of the interdependent parameter processing, determining
          the field extents of the mask if changed, resetting parameters as appropriate,
          determining the overall template value for the control, etc.
  
          reset_args is supplied if called from control's .SetCtrlParameters()
          routine, and indicates which if any parameters which can be
          overridden by individual fields have been reset by request for the
          whole control.
  
          """
  ##        dbg(suspend=1)
  ##        dbg('MaskedEditMixin::_configure("%s")' % mask, indent=1)
  
          # Preprocess specified mask to expand {n} syntax, handle escaped
          # mask characters, etc and build the resulting positionally keyed
          # dictionary for which positions are mask vs. template characters:
          self._mask, self._ismasked, self._explicit_field_boundaries = self._processMask(mask)
          self._masklength = len(self._mask)
  ####        dbg('processed mask:', self._mask)
  
          # Preserve original mask specified, for subsequent reprocessing
          # if parameters change.
  ##        dbg('mask: "%s"' % self._mask, 'previous mask: "%s"' % self._previous_mask)
          self._previous_mask = mask    # save unexpanded mask for next time
              # Set expanded mask and extent of field -1 to width of entire control:
          self._ctrl_constraints._SetParameters(mask = self._mask, extent=(0,self._masklength))
  
          # Go parse mask to determine where each field is, construct field
          # instances as necessary, configure them with those extents, and
          # build lookup table mapping each position for control to its corresponding
          # field.
  ####        dbg('calculating field extents')
  
          self._calcFieldExtents()
  
  
          # Go process defaultValues and fillchars to construct the overall
          # template, and adjust the current value as necessary:
          reset_fillchar = reset_args.has_key('fillChar') and reset_args['fillChar']
          reset_default = reset_args.has_key('defaultValue') and reset_args['defaultValue']
  
  ####        dbg('calculating template')
          self._calcTemplate(reset_fillchar, reset_default)
  
          # Propagate control-level formatting and character constraints to each
          # field if they don't already have them; if only one field, propagate
          # control-level validation constraints to field as well:
  ####        dbg('propagating constraints')
          self._propagateConstraints(**reset_args)
  
  
          if self._isFloat and self._fields[0]._groupChar == self._decimalChar:
              raise AttributeError('groupChar (%s) and decimalChar (%s) must be distinct.' %
                                   (self._fields[0]._groupChar, self._decimalChar) )
  
  ####        dbg('fields:', indent=1)
  ##        for i in [-1] + self._field_indices:
  ####            dbg('field %d:' % i, self._fields[i].__dict__)
  ####        dbg(indent=0)
  
          # Set up special parameters for numeric control, if appropriate:
          if self._signOk:
              self._signpos = 0   # assume it starts here, but it will move around on floats
              signkeys = ['-', '+', ' ']
              if self._useParens:
                  signkeys += ['(', ')']
              for key in signkeys:
                  keycode = ord(key)
                  if not self._keyhandlers.has_key(keycode):
                      self._SetKeyHandler(key, self._OnChangeSign)
          elif self._isInt or self._isFloat:
              signkeys = ['-', '+', ' ', '(', ')']
              for key in signkeys:
                  keycode = ord(key)
                  if self._keyhandlers.has_key(keycode) and self._keyhandlers[keycode] == self._OnChangeSign:
                      self._SetKeyHandler(key, None)
  
  
  
          if self._isFloat or self._isInt:
              if self.controlInitialized:
                  value = self._GetValue()
  ####                dbg('value: "%s"' % value, 'len(value):', len(value),
  ##                    'len(self._ctrl_constraints._mask):',len(self._ctrl_constraints._mask))
                  if len(value) < len(self._ctrl_constraints._mask):
                      newvalue = value
                      if self._useParens and len(newvalue) < len(self._ctrl_constraints._mask) and newvalue.find('(') == -1:
                          newvalue += ' '
                      if self._signOk and len(newvalue) < len(self._ctrl_constraints._mask) and newvalue.find(')') == -1:
                          newvalue = ' ' + newvalue
                      if len(newvalue) < len(self._ctrl_constraints._mask):
                          if self._ctrl_constraints._alignRight:
                              newvalue = newvalue.rjust(len(self._ctrl_constraints._mask))
                          else:
                              newvalue = newvalue.ljust(len(self._ctrl_constraints._mask))
  ##                    dbg('old value: "%s"' % value)
  ##                    dbg('new value: "%s"' % newvalue)
                      try:
                          self._ChangeValue(newvalue)
                      except Exception, e:
  ##                        dbg('exception raised:', e, 'resetting to initial value')
                          self._SetInitialValue()
  
                  elif len(value) > len(self._ctrl_constraints._mask):
                      newvalue = value
                      if not self._useParens and newvalue[-1] == ' ':
                          newvalue = newvalue[:-1]
                      if not self._signOk and len(newvalue) > len(self._ctrl_constraints._mask):
                          newvalue = newvalue[1:]
                      if not self._signOk:
                          newvalue, signpos, right_signpos = self._getSignedValue(newvalue)
  
  ##                    dbg('old value: "%s"' % value)
  ##                    dbg('new value: "%s"' % newvalue)
                      try:
                          self._ChangeValue(newvalue)
                      except Exception, e:
  ##                        dbg('exception raised:', e, 'resetting to initial value')
                          self._SetInitialValue()
                  elif not self._signOk and ('(' in value or '-' in value):
                      newvalue, signpos, right_signpos = self._getSignedValue(value)
  ##                    dbg('old value: "%s"' % value)
  ##                    dbg('new value: "%s"' % newvalue)
                      try:
                          self._ChangeValue(newvalue)
                      except e:
  ##                        dbg('exception raised:', e, 'resetting to initial value')
                          self._SetInitialValue()
  
              # Replace up/down arrow default handling:
              # make down act like tab, up act like shift-tab:
  
  ####            dbg('Registering numeric navigation and control handlers (if not already set)')
              if not self._keyhandlers.has_key(wx.WXK_DOWN):
                  self._SetKeycodeHandler(wx.WXK_DOWN, self._OnChangeField)
              if not self._keyhandlers.has_key(wx.WXK_NUMPAD_DOWN):
                  self._SetKeycodeHandler(wx.WXK_DOWN, self._OnChangeField)
              if not self._keyhandlers.has_key(wx.WXK_UP):
                  self._SetKeycodeHandler(wx.WXK_UP, self._OnUpNumeric)  # (adds "shift" to up arrow, and calls _OnChangeField)
              if not self._keyhandlers.has_key(wx.WXK_NUMPAD_UP):
                  self._SetKeycodeHandler(wx.WXK_UP, self._OnUpNumeric)  # (adds "shift" to up arrow, and calls _OnChangeField)
  
              # On ., truncate contents right of cursor to decimal point (if any)
              # leaves cursor after decimal point if floating point, otherwise at 0.
              if not self._keyhandlers.has_key(ord(self._decimalChar)) or self._keyhandlers[ord(self._decimalChar)] != self._OnDecimalPoint:
                  self._SetKeyHandler(self._decimalChar, self._OnDecimalPoint)
      
              if not self._keyhandlers.has_key(ord(self._shiftDecimalChar)) or self._keyhandlers[ord(self._shiftDecimalChar)] != self._OnChangeField:
                  self._SetKeyHandler(self._shiftDecimalChar, self._OnChangeField)   # (Shift-'.' == '>' on US keyboards)
  
              # Allow selective insert of groupchar in numbers:
              if not self._keyhandlers.has_key(ord(self._fields[0]._groupChar)) or self._keyhandlers[ord(self._fields[0]._groupChar)] != self._OnGroupChar:
                  self._SetKeyHandler(self._fields[0]._groupChar, self._OnGroupChar)
function_tokens: def _configure ( self , mask , * * reset_args ) : ##        dbg(suspend=1) ##        dbg('MaskedEditMixin::_configure("%s")' % mask, indent=1) # Preprocess specified mask to expand {n} syntax, handle escaped # mask characters, etc and build the resulting positionally keyed # dictionary for which positions are mask vs. template characters: self . _mask , self . _ismasked , self . _explicit_field_boundaries = self . _processMask ( mask ) self . _masklength = len ( self . _mask ) ####        dbg('processed mask:', self._mask) # Preserve original mask specified, for subsequent reprocessing # if parameters change. ##        dbg('mask: "%s"' % self._mask, 'previous mask: "%s"' % self._previous_mask) self . _previous_mask = mask # save unexpanded mask for next time # Set expanded mask and extent of field -1 to width of entire control: self . _ctrl_constraints . _SetParameters ( mask = self . _mask , extent = ( 0 , self . _masklength ) ) # Go parse mask to determine where each field is, construct field # instances as necessary, configure them with those extents, and # build lookup table mapping each position for control to its corresponding # field. ####        dbg('calculating field extents') self . _calcFieldExtents ( ) # Go process defaultValues and fillchars to construct the overall # template, and adjust the current value as necessary: reset_fillchar = reset_args . has_key ( 'fillChar' ) and reset_args [ 'fillChar' ] reset_default = reset_args . has_key ( 'defaultValue' ) and reset_args [ 'defaultValue' ] ####        dbg('calculating template') self . _calcTemplate ( reset_fillchar , reset_default ) # Propagate control-level formatting and character constraints to each # field if they don't already have them; if only one field, propagate # control-level validation constraints to field as well: ####        dbg('propagating constraints') self . _propagateConstraints ( * * reset_args ) if self . _isFloat and self . _fields [ 0 ] . _groupChar == self . _decimalChar : raise AttributeError ( 'groupChar (%s) and decimalChar (%s) must be distinct.' % ( self . _fields [ 0 ] . _groupChar , self . _decimalChar ) ) ####        dbg('fields:', indent=1) ##        for i in [-1] + self._field_indices: ####            dbg('field %d:' % i, self._fields[i].__dict__) ####        dbg(indent=0) # Set up special parameters for numeric control, if appropriate: if self . _signOk : self . _signpos = 0 # assume it starts here, but it will move around on floats signkeys = [ '-' , '+' , ' ' ] if self . _useParens : signkeys += [ '(' , ')' ] for key in signkeys : keycode = ord ( key ) if not self . _keyhandlers . has_key ( keycode ) : self . _SetKeyHandler ( key , self . _OnChangeSign ) elif self . _isInt or self . _isFloat : signkeys = [ '-' , '+' , ' ' , '(' , ')' ] for key in signkeys : keycode = ord ( key ) if self . _keyhandlers . has_key ( keycode ) and self . _keyhandlers [ keycode ] == self . _OnChangeSign : self . _SetKeyHandler ( key , None ) if self . _isFloat or self . _isInt : if self . controlInitialized : value = self . _GetValue ( ) ####                dbg('value: "%s"' % value, 'len(value):', len(value), ##                    'len(self._ctrl_constraints._mask):',len(self._ctrl_constraints._mask)) if len ( value ) < len ( self . _ctrl_constraints . _mask ) : newvalue = value if self . _useParens and len ( newvalue ) < len ( self . _ctrl_constraints . _mask ) and newvalue . find ( '(' ) == - 1 : newvalue += ' ' if self . _signOk and len ( newvalue ) < len ( self . _ctrl_constraints . _mask ) and newvalue . find ( ')' ) == - 1 : newvalue = ' ' + newvalue if len ( newvalue ) < len ( self . _ctrl_constraints . _mask ) : if self . _ctrl_constraints . _alignRight : newvalue = newvalue . rjust ( len ( self . _ctrl_constraints . _mask ) ) else : newvalue = newvalue . ljust ( len ( self . _ctrl_constraints . _mask ) ) ##                    dbg('old value: "%s"' % value) ##                    dbg('new value: "%s"' % newvalue) try : self . _ChangeValue ( newvalue ) except Exception , e : ##                        dbg('exception raised:', e, 'resetting to initial value') self . _SetInitialValue ( ) elif len ( value ) > len ( self . _ctrl_constraints . _mask ) : newvalue = value if not self . _useParens and newvalue [ - 1 ] == ' ' : newvalue = newvalue [ : - 1 ] if not self . _signOk and len ( newvalue ) > len ( self . _ctrl_constraints . _mask ) : newvalue = newvalue [ 1 : ] if not self . _signOk : newvalue , signpos , right_signpos = self . _getSignedValue ( newvalue ) ##                    dbg('old value: "%s"' % value) ##                    dbg('new value: "%s"' % newvalue) try : self . _ChangeValue ( newvalue ) except Exception , e : ##                        dbg('exception raised:', e, 'resetting to initial value') self . _SetInitialValue ( ) elif not self . _signOk and ( '(' in value or '-' in value ) : newvalue , signpos , right_signpos = self . _getSignedValue ( value ) ##                    dbg('old value: "%s"' % value) ##                    dbg('new value: "%s"' % newvalue) try : self . _ChangeValue ( newvalue ) except e : ##                        dbg('exception raised:', e, 'resetting to initial value') self . _SetInitialValue ( ) # Replace up/down arrow default handling: # make down act like tab, up act like shift-tab: ####            dbg('Registering numeric navigation and control handlers (if not already set)') if not self . _keyhandlers . has_key ( wx . WXK_DOWN ) : self . _SetKeycodeHandler ( wx . WXK_DOWN , self . _OnChangeField ) if not self . _keyhandlers . has_key ( wx . WXK_NUMPAD_DOWN ) : self . _SetKeycodeHandler ( wx . WXK_DOWN , self . _OnChangeField ) if not self . _keyhandlers . has_key ( wx . WXK_UP ) : self . _SetKeycodeHandler ( wx . WXK_UP , self . _OnUpNumeric ) # (adds "shift" to up arrow, and calls _OnChangeField) if not self . _keyhandlers . has_key ( wx . WXK_NUMPAD_UP ) : self . _SetKeycodeHandler ( wx . WXK_UP , self . _OnUpNumeric ) # (adds "shift" to up arrow, and calls _OnChangeField) # On ., truncate contents right of cursor to decimal point (if any) # leaves cursor after decimal point if floating point, otherwise at 0. if not self . _keyhandlers . has_key ( ord ( self . _decimalChar ) ) or self . _keyhandlers [ ord ( self . _decimalChar ) ] != self . _OnDecimalPoint : self . _SetKeyHandler ( self . _decimalChar , self . _OnDecimalPoint ) if not self . _keyhandlers . has_key ( ord ( self . _shiftDecimalChar ) ) or self . _keyhandlers [ ord ( self . _shiftDecimalChar ) ] != self . _OnChangeField : self . _SetKeyHandler ( self . _shiftDecimalChar , self . _OnChangeField ) # (Shift-'.' == '>' on US keyboards) # Allow selective insert of groupchar in numbers: if not self . _keyhandlers . has_key ( ord ( self . _fields [ 0 ] . _groupChar ) ) or self . _keyhandlers [ ord ( self . _fields [ 0 ] . _groupChar ) ] != self . _OnGroupChar : self . _SetKeyHandler ( self . _fields [ 0 ] . _groupChar , self . _OnGroupChar )