Package gnue :: Package forms :: Package input :: Package displayHandlers :: Module Cursor :: Class BaseCursor
[show private | hide private]

Type BaseCursor

object --+    
         |    
EventAware --+
             |
            BaseCursor

Known Subclasses:
Checkbox, Component, Dropdown, Listbox, Numeric, Password, Text, DateRelated, Image

The base display handler for entries that deal with cursor based input (aka text).

This class should not be used directly. Other handlers should inherit from this one.
Method Summary
  __init__(self, entry, eventHandler, subEventHandler, displayMask, inputMask)
Constructor
  __change_text(self, start, end, text, new_cursor)
  __error(self, message)
  __handleENTER(self, event)
  __move_cursor(self, position, selecting)
Move the cursor to the specified position optionally selecting the text.
  __updateFieldValue(self)
  _addText(self, event)
  _autocomplete_(self, new_value, new_cursor)
Descandants can override this method to introduce autocompletion.
  _backspace(self, event)
  _delete(self, event)
  _deleteRange(self, event)
  _insertTextAt(self, event)
  _moveCursor(self, event, selecting)
Moves the cursor to the specified position optionally selecting the text.
  _moveCursorLeft(self, event, selecting)
Moves the cursor to the left optionally selecting the text.
  _moveCursorRight(self, event, selecting)
Moves the cursor to the right optionally selecting the text.
  _moveCursorToBegin(self, event, selecting)
Moves the cursor to the beginning optionally selecting the text.
  _moveCursorToEnd(self, event, selecting)
Moves the cursor to the end optionally selecting the text.
  _replace_text(self, event)
  _selectAll(self, event)
Select the entire text of the entry and move the cursor to the end
  _selectLeft(self, event)
Move the selection cursor to the left one unit
  _selectRight(self, event)
Move the selection cursor to the right one unit
  _selectToBegin(self, event)
Select from the current curson position to the beginning of the entry
  _selectToEnd(self, event)
Select from the current curson position to the end of the entry
  _selectWithMouse(self, event)
Select an area of text based upon the mouse
  beginEdit(self)
Notifies the handler that it will be doing edits.
  build_display(self, value, editing)
Build the display string from the user value.
  endEdit(self)
Called when a widget loses focus or when ENTER is hit.
  generateRefreshEvent(self)
Function to emit an event that will cause forms to update the UI.
  get_tip(self)
Descendands can override this method to return a tip which will be displayed in the statusbar if neither the entry nor the field provide such a tip.
  getSelectionArea(self)
Return the selected area
  parse_display(self, display)
  setSelectionArea(self, cursor1, cursor2)
Set the selection area
  updateFieldValue(self)
Update the associated field with the current value of the display handler.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
Return repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Method Details

__init__(self, entry, eventHandler, subEventHandler, displayMask, inputMask)
(Constructor)

Constructor
Parameters:
entry - The GFEntry instance associated with this handler
eventHandler - The
subEventHandler - The event handler this display helper will user to register it's listeners.
Overrides:
gnue.common.events.EventAware.EventAware.__init__

__change_text(self, start, end, text, new_cursor)

__error(self, message)

__handleENTER(self, event)

__move_cursor(self, position, selecting=False)

Move the cursor to the specified position optionally selecting the text. After moving the cursor a refresh event will be generated.
Parameters:
position - the position to set the cursor to
selecting - boolean indicating if the text should be selected.

__updateFieldValue(self)

_addText(self, event)

_autocomplete_(self, new_value, new_cursor)

Descandants can override this method to introduce autocompletion. This method get's called from __change_text() if the current cursor is at the end of the display-string
Returns:
the new (autocompleted) value to use

_backspace(self, event)

_delete(self, event)

_deleteRange(self, event)

_insertTextAt(self, event)

_moveCursor(self, event, selecting=False)

Moves the cursor to the specified position optionally selecting the text.
Parameters:
event - The GFEvent making the request
selecting - Boolean indicating if text should be selected as part of the cursor move

_moveCursorLeft(self, event, selecting=False)

Moves the cursor to the left optionally selecting the text.
Parameters:
event - The GFEvent making the request
selecting - Boolean indicating if text should be selected as part of the cursor move

_moveCursorRight(self, event, selecting=False)

Moves the cursor to the right optionally selecting the text.
Parameters:
event - The GFEvent making the request
selecting - Boolean indicating if text should be selected as part of the cursor move

_moveCursorToBegin(self, event, selecting=False)

Moves the cursor to the beginning optionally selecting the text.
Parameters:
event - The GFEvent making the request
selecting - Boolean indicating if text should be selected as part of the cursor move

_moveCursorToEnd(self, event, selecting=False)

Moves the cursor to the end optionally selecting the text.
Parameters:
event - The GFEvent making the request
selecting - Boolean indicating if text should be selected as part of the cursor move

_replace_text(self, event)

_selectAll(self, event)

Select the entire text of the entry and move the cursor to the end
Parameters:
event - The GFEvent making the request

_selectLeft(self, event)

Move the selection cursor to the left one unit
Parameters:
event - The GFEvent making the request

_selectRight(self, event)

Move the selection cursor to the right one unit
Parameters:
event - The GFEvent making the request

_selectToBegin(self, event)

Select from the current curson position to the beginning of the entry
Parameters:
event - The GFEvent making the request

_selectToEnd(self, event)

Select from the current curson position to the end of the entry
Parameters:
event - The GFEvent making the request

_selectWithMouse(self, event)

Select an area of text based upon the mouse
Parameters:
event - The GFEvent making the request

beginEdit(self)

Notifies the handler that it will be doing edits.

Called when a widget first gets focus. It places the display handler into edit mode, syncs the current value with the GFField associated with this display handler, and creates the string to display in the form.

build_display(self, value, editing)

Build the display string from the user value.

endEdit(self)

Called when a widget loses focus or when ENTER is hit.

generateRefreshEvent(self)

Function to emit an event that will cause forms to update the UI.

get_tip(self)

Descendands can override this method to return a tip which will be displayed in the statusbar if neither the entry nor the field provide such a tip.

getSelectionArea(self)

Return the selected area
Returns:
The selected area as a tuple or None if no selection

parse_display(self, display)

setSelectionArea(self, cursor1, cursor2)

Set the selection area

Starting and ending position can be passed in an any order.
Parameters:
cursor1 - A starting or ending position for the selection
cursor2 - A starting or ending position for the selection

updateFieldValue(self)

Update the associated field with the current value of the display handler. Exceptions are ignored. This function is used to update the underlying field while the entry remains in editing mode (so the user still can correct errors).


GNUe Home

Private API

Developer's Corner