Package ocempgui :: Package widgets :: Module Editable :: Class Editable
[show private | hide private]
[frames | no frames]

Type Editable

 object --+            
          |            
INotifyable --+        
              |        
     BaseObject --+    
                  |    
     object --+   |    
              |   |    
         Sprite --+    
                  |    
         BaseWidget --+
                      |
                     Editable

Known Subclasses:
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)
  activate(self)
E.activate () -> None
  notify(self, event)
E.notify (...) -> None
  set_caret(self, pos)
E.set_caret (...) -> None
  set_editable(self, editable)
E.set_editable (...) -> None
  set_focus(self, focus)
E.set_focus (...) -> bool
  set_text(self, text)
E.set_text (...) -> None
  _input(self, event)
E._input (...) -> bool
  _set_caret_visible(self, visible)
E._set_caret_visible (...) -> None
    Inherited from BaseWidget
  activate_mnemonic(self, mnemonic)
W.activate_mnemonic (...) -> bool
  check_sizes(self, width, height)
W.check_sizes (...) -> int, int
  create_style(self)
W.create_style () -> WidgetStyle
  debug_update(self)
For debugging usage only
  destroy(self)
W.destroy () -> None
  draw(self)
W.draw () -> None
  draw_bg(self)
W.draw_bg () -> Surface
  get_style(self)
W.get_style () -> WidgetStyle
  initclass(cls)
B.initclass () -> None (Class method)
  lock(self)
W.lock () -> None
  rect_to_client(self, rect)
W.rect_to_client (...) -> pygame.Rect
  set_depth(self, depth)
W.set_depth (...) -> None
  set_dirty(self, dirty, update)
W.set_dirty (...) -> None
  set_entered(self, entered)
W.set_entered (...) -> None
  set_event_area(self, area)
W.set_event_area (...) -> None
  set_event_manager(self, manager)
W.set_event_manager (...) -> None
  set_index(self, index)
W.set_index (...) -> None
  set_indexable(self, indexable)
W.set_indexable (...) -> None
  set_maximum_size(self, width, height)
W.set_maximum_size (...) -> None
  set_minimum_size(self, width, height)
W.set_minimum_size (...) -> None
  set_opacity(self, opacity)
W.set_opacity (...) -> None
  set_position(self, x, y)
W.set_position (...) -> None
  set_sensitive(self, sensitive)
W.set_sensitive (...) -> None
  set_size(self, width, height)
W.set_size (...) -> None
  set_state(self, state)
W.set_state (...) -> None
  set_style(self, style)
W.set_style (...) -> None
  set_tooltip(self, tooltip)
W.set_tooltip (...) -> None
  unlock(self)
W.unlock () -> None
  update(self, **kwargs)
W.update (...) -> None
  _get_rect(self)
W._get_rect () -> pygame.Rect
  _get_rect_attr(self, attr)
W._get_rect_attr (...) -> var
  _set_rect_attr(self, attr, value)
W._set_rect_attr (...) -> None
    Inherited from BaseObject
  connect_signal(self, signal, callback, *data)
B.connect_signal (...) -> EventCallback
  disconnect_signal(self, event)
B.disconnect_signal (...) -> None
  emit(self, signal, data)
B.emit (...) -> bool
  run_signal_handlers(self, signal, *data)
B.run_signal_handlers (...) -> None
    Inherited from Sprite
  __repr__(self)
  add(self, *groups)
add(group or list of of groups, ...) add a sprite to container
  add_internal(self, group)
  alive(self)
alive() -> bool check to see if the sprite is in any groups
  groups(self)
groups() -> list of groups list used sprite containers
  kill(self)
kill() remove this sprite from all groups
  remove(self, *groups)
remove(group or list of groups, ...) remove a sprite from container
  remove_internal(self, group)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
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.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.activate

notify(self, event)

E.notify (...) -> None

Notifies the Editable about an event.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.notify

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.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.set_focus

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

caret

The caret position.
Get Method:
unknown-696367396(...)
Set Method:
unknown-696367452(...)

caret_visible

Indicates, if the caret is currently visible.
Get Method:
unknown-696367620(...)
Set Method:
unknown-696367676(...)

editable

Indicates, if the text can be edited or not.
Get Method:
unknown-696367508(...)
Set Method:
unknown-696367564(...)

text

The text to display on the Editable.
Get Method:
unknown-696367284(...)
Set Method:
unknown-696367340(...)

Generated by Epydoc 2.1 on Thu Jan 10 10:18:43 2008 http://epydoc.sf.net