Package gui :: Package analyses :: Package elements :: Module float_element :: Class Float_ctrl
[hide private]
[frames] | no frames]

Class Float_ctrl

source code

The analysis specific floating point number control.

This consists of two elements: wx.StaticText and wx.TextCtrl.

Instance Methods [hide private]
 
__init__(self, box, parent, text='', default='', tooltip=None, editable=True, width_text=200, width_button=80, spacer=0)
Create a text selection element for the frame.
source code
 
Enable(self, enable=True)
Enable or disable the element for user input.
source code
int
GetValue(self)
Set the value of the control.
source code
 
SetValue(self, value)
Set the value of the control.
source code
 
end_input(self, event)
Restore the cursor position at the end if needed.
source code
 
pre_input(self, event)
Catch all key presses to store the original value and position and freeze the element.
source code
 
post_input(self, event)
Check that the user input is a float when the text changes, restoring the value if not.
source code
Method Details [hide private]

__init__(self, box, parent, text='', default='', tooltip=None, editable=True, width_text=200, width_button=80, spacer=0)
(Constructor)

source code 

Create a text selection element for the frame.

This consists of a horizontal layout with a static text element, a text control, and an optional button.

Parameters:
  • box (wx.BoxSizer instance) - The box element to pack the structure file selection GUI element into.
  • parent (wx object) - The parent GUI element.
  • text (str) - The static text.
  • default (str) - The default text of the control.
  • tooltip (str) - The tooltip which appears on hovering over the text or input field.
  • editable (bool) - A flag specifying if the control is editable or not.
  • width_text (int) - The width of the text element.
  • width_button (int) - The width of the standard button used in the other elements.
  • spacer (int) - The horizontal spacing between the elements.

Enable(self, enable=True)

source code 

Enable or disable the element for user input.

Parameters:
  • enable (bool) - The flag specifying if the element should be enabled or disabled.

GetValue(self)

source code 

Set the value of the control.

Returns: int
The value of the text control.

SetValue(self, value)

source code 

Set the value of the control.

Parameters:
  • value (text) - The value to set the text control to.

end_input(self, event)

source code 

Restore the cursor position at the end if needed.

This does not work so well as multiple wx.EVT_KEY_DOWN events can occur for a single wx.EVT_TEXT.

Parameters:
  • event (wx event) - The wx event.

pre_input(self, event)

source code 

Catch all key presses to store the original value and position and freeze the element.

Parameters:
  • event (wx event) - The wx event.

post_input(self, event)

source code 

Check that the user input is a float when the text changes, restoring the value if not.

Parameters:
  • event (wx event) - The wx event.