| Home | Trees | Index | Help |
|---|
| Package ocempgui :: Package widgets :: Module Editable :: Class Editable |
|
object--+ |INotifyable--+ |BaseObject--+ |object--+ | | |Sprite--+ |BaseWidget--+ | Editable
Entry
Editable () -> Editable
An abstract widget class, which can handle text input.
The Editable is an abstract class, which can handle (unicode) text
input. It supports a caret for the input cursor, undo of text input
using the ESC key and input notifications via the RETURN/ENTER key.
Text can be set directly using the 'text' attribute or the
set_text() method. By assigning the attribute or using the method,
the caret position will be reset to 0.
editable.text = 'Test'
editable.set_text (text)
The 'caret' attribute indicates the current cursor position for
input operations within the text and can be modified
programmatically by reassigning it or using the set_caret() method.
editable.caret = 5
editable.set_caret (5)
It is possible to prevent the text from editing using the
'editable' attribute or set_editable() method. If 'editable' is
False, no text input can be made and an input notification or undo
operation will not be possible.
editable.editable = False
editable.set_editable (False)
Note: Dependant on the font set in the style of the Editable, it is
possible, that certain characters are not displayed correctly. It is
strongly recommended to use a fully unicode capable font, if
non-ascii characters should be displayed.
Default action (invoked by activate()):
Give the Editable the input focus for text editing.
Mnemonic action (invoked by activate_mnemonic()):
None
Signals:
SIG_KEYDOWN - Invoked, when a key is pressed while the Editable has
the input.
SIG_INPUT - Invoked, when the input is validated or aborted using
RETURN or ESC.
Attributes:
text - The text displayed on the Editable.
editable - Indicates, whether the text can be edited or not.
caret - Caret ( | ) position on input.
caret_visible - Indicates, whether the caret is currently visible.
| Method Summary | |
|---|---|
__init__(self)
| |
E.activate () -> None | |
E.notify (...) -> None | |
E.set_caret (...) -> None | |
E.set_editable (...) -> None | |
E.set_focus (...) -> bool | |
E.set_text (...) -> None | |
E._input (...) -> bool | |
E._set_caret_visible (...) -> None | |
| Inherited from BaseWidget | |
W.activate_mnemonic (...) -> bool | |
W.check_sizes (...) -> int, int | |
W.create_style () -> WidgetStyle | |
For debugging usage only | |
W.destroy () -> None | |
W.draw () -> None | |
W.draw_bg () -> Surface | |
W.get_style () -> WidgetStyle | |
B.initclass () -> None (Class method) | |
W.lock () -> None | |
W.rect_to_client (...) -> pygame.Rect | |
W.set_depth (...) -> None | |
W.set_dirty (...) -> None | |
W.set_entered (...) -> None | |
W.set_event_area (...) -> None | |
W.set_event_manager (...) -> None | |
W.set_index (...) -> None | |
W.set_indexable (...) -> None | |
W.set_maximum_size (...) -> None | |
W.set_minimum_size (...) -> None | |
W.set_opacity (...) -> None | |
W.set_position (...) -> None | |
W.set_sensitive (...) -> None | |
W.set_size (...) -> None | |
W.set_state (...) -> None | |
W.set_style (...) -> None | |
W.set_tooltip (...) -> None | |
W.unlock () -> None | |
W.update (...) -> None | |
W._get_rect () -> pygame.Rect | |
W._get_rect_attr (...) -> var | |
W._set_rect_attr (...) -> None | |
| Inherited from BaseObject | |
B.connect_signal (...) -> EventCallback | |
B.disconnect_signal (...) -> None | |
B.emit (...) -> bool | |
B.run_signal_handlers (...) -> None | |
| Inherited from Sprite | |
| |
add(group or list of of groups, ...) add a sprite to container | |
| |
alive() -> bool check to see if the sprite is in any groups | |
groups() -> list of groups list used sprite containers | |
kill() remove this sprite from all groups | |
remove(group or list of groups, ...) remove a sprite from container | |
| |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Property Summary | |
|---|---|
caret: The caret position. | |
caret_visible: Indicates, if the caret is currently visible. | |
editable: Indicates, if the text can be edited or not. | |
text: The text to display on the Editable. | |
| Inherited from BaseWidget | |
bottom | |
bottomleft | |
bottomright | |
center | |
centerx | |
centery | |
controls: Widgets associated with the widget. | |
depth: The z-axis layer depth of the widget. | |
dirty: Indicates, whether the widget need to be redrawn. | |
entered: Indicates, whether the widget is entered. | |
eventarea: The area, which gets the events. | |
focus: The focus of the widget. | |
h | |
height | |
image: The visible surface of the widget. | |
index: The tab index position of the widget. | |
indexable: The IIndexable, the widget is attached to. | |
left | |
locked: Indicates, whether the widget is locked. | |
maxsize: The maximum size to occupy by the widget. | |
midbottom | |
midleft | |
midright | |
midtop | |
minsize: The guaranteed size of the widget. | |
opacity: The opacity of the widget. | |
position: The position of the topleft corner. | |
rect: The area occupied by the widget. | |
right | |
sensitive: The sensitivity of the widget. | |
size | |
state: The current state of the widget. | |
style: The style of the widget. | |
tooltip: The tool tip text to display for the widget. | |
top | |
topleft | |
topright | |
w | |
width | |
x | |
y | |
| Inherited from BaseObject | |
manager: The event manager to use by the object. | |
| Instance Method Details |
|---|
activate(self)E.activate () -> None Activates the Editable default action. Activates the Editable default action. This usually means giving the Editable the input focus. |
notify(self, event)E.notify (...) -> None Notifies the Editable about an event. |
set_caret(self, pos)E.set_caret (...) -> None Sets the caret to the passed position. Moves the input caret to the given position within the text. 0 is the very first position within the text (before the first character), a value equal to or greater than the length of the text will set the caret behind the last character position. Raises a TypeError, if the passed argument is not a positive integer. |
set_editable(self, editable)E.set_editable (...) -> None Enables or disables text editing of the Editable. This causes the Editable to ignore SIG_KEYDOWN events, which would modify the text of it. It also blocks input notifications and undo operations. |
set_focus(self, focus=True)E.set_focus (...) -> bool Sets the input and action focus of the Editable. Sets the input and action focus of the Editable and returns True upon success or False, if the focus could not be set. Note: This method only works as supposed using a render loop, which supports the Renderer class specification. |
set_text(self, text)E.set_text (...) -> None Sets the text of the Editable to the passed argument. Raises a TypeError if the passed argument is not a string or unicode. |
_input(self, event)E._input (...) -> bool Receives the SIG_KEYDOWN events and updates the text. |
_set_caret_visible(self, visible)E._set_caret_visible (...) -> None Sets the visibility of the caret. |
| Property Details |
|---|
caretThe caret position.
|
caret_visibleIndicates, if the caret is currently visible.
|
editableIndicates, if the text can be edited or not.
|
textThe text to display on the Editable.
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Jan 10 10:18:43 2008 | http://epydoc.sf.net |