Module pywraps :: Class simplecustviewer_t
[frames] | no frames]

Class simplecustviewer_t

object --+
         |
        simplecustviewer_t

The base class for implementing simple custom viewers

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__del__(self)
Destructor.
 
Create(self, title)
Creates the custom view.
 
Close(self)
Destroys the view.
 
Show(self)
Shows an already created view.
 
Refresh(self)
 
RefreshCurrent(self)
Refreshes the current line only
 
Count(self)
Returns the number of lines in the view
 
GetSelection(self)
Returns the selected area or None
 
ClearLines(self)
Clears all the lines
 
AddLine(self, line, fgcolor=None, bgcolor=None)
Adds a colored line to the view
 
InsertLine(self, lineno, line, fgcolor=None, bgcolor=None)
Inserts a line in the given position @return Boolean
 
EditLine(self, lineno, line, fgcolor=None, bgcolor=None)
Edits an existing line.
 
PatchLine(self, lineno, offs, value)
Patches an existing line character at the given offset.
 
DelLine(self, lineno)
Deletes an existing line @return Boolean
 
GetLine(self, lineno)
Returns a line
 
GetCurrentWord(self, mouse=0)
Returns the current word
 
GetCurrentLine(self, mouse=0, notags=0)
Returns the current line.
 
GetPos(self, mouse=0)
Returns the current cursor or mouse position.
 
GetLineNo(self, mouse=0)
Calls GetPos() and returns the current line number only or None on failure
 
Jump(self, lineno, x=0, y=0)
 
AddPopupMenu(self, title, hotkey="")
Adds a popup menu item
 
ClearPopupMenu(self)
Clears all previously installed popup menu items.
 
IsFocused(self)
Returns True if the current view is the focused view
 
OnClick(self, shift)
User clicked in the view
 
OnDblClick(self, shift)
User dbl-clicked in the view
 
OnCursorPosChanged(self)
Cursor position changed.
 
OnClose(self)
The view is closing.
 
OnKeydown(self, vkey, shift)
User pressed a key
 
OnPopup(self)
Context menu popup is about to be shown.
 
OnHint(self, lineno)
Hint requested for the given line number.
 
OnPopupMenu(self, menu_id)
A context (or popup) menu item was executed.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__del__(self)
(Destructor)

 

Destructor. It also frees the associated C++ object

Create(self, title)

 

Creates the custom view. This should be the first method called after instantiation

Parameters:
  • title - The title of the view
Returns:
Boolean whether it succeeds or fails. It may fail if a window with the same title is already open. In this case better close existing windows

Close(self)

 

Destroys the view. One has to call Create() afterwards. Show() can be called and it will call Create() internally.

Returns:
Boolean

Show(self)

 

Shows an already created view. It the view was close, then it will call Create() for you

Returns:
Boolean

GetSelection(self)

 

Returns the selected area or None

Returns:
  • tuple(x1, y1, x2, y2)
  • None if no selection

AddLine(self, line, fgcolor=None, bgcolor=None)

 

Adds a colored line to the view

Returns:
Boolean

EditLine(self, lineno, line, fgcolor=None, bgcolor=None)

 

Edits an existing line. @return Boolean

PatchLine(self, lineno, offs, value)

 

Patches an existing line character at the given offset. This is a low level function. You must know what you're doing

GetLine(self, lineno)

 

Returns a line

Parameters:
  • lineno - The line number
Returns:
Returns a tuple (colored_line, fgcolor, bgcolor) or None

GetCurrentWord(self, mouse=0)

 

Returns the current word

Parameters:
  • mouse - Use mouse position or cursor position
Returns:
None if failed or a String containing the current word at mouse or cursor

GetCurrentLine(self, mouse=0, notags=0)

 

Returns the current line.

Parameters:
  • mouse - Current line at mouse pos
  • notags - If True then tag_remove() will be called before returning the line
Returns:
Returns the current line (colored or uncolored) or None on failure

GetPos(self, mouse=0)

 

Returns the current cursor or mouse position.

Parameters:
  • mouse - return mouse position
Returns:
Returns a tuple (lineno, x, y)

AddPopupMenu(self, title, hotkey="")

 

Adds a popup menu item

Parameters:
  • title - The name of the menu item
  • hotkey - Hotkey of the item or just empty
Returns:
Returns the

ClearPopupMenu(self)

 

Clears all previously installed popup menu items. Use this function if you're generating menu items on the fly (in the OnPopup() callback), and before adding new items

OnClick(self, shift)

 

User clicked in the view

Parameters:
  • shift - Shift flag
Returns:
Boolean. True if you handled the event

OnDblClick(self, shift)

 

User dbl-clicked in the view

Parameters:
  • shift - Shift flag
Returns:
Boolean. True if you handled the event

OnCursorPosChanged(self)

 

Cursor position changed.

Returns:
Nothing

OnClose(self)

 

The view is closing. Use this event to cleanup.

Returns:
Nothing

OnKeydown(self, vkey, shift)

 

User pressed a key

Parameters:
  • vkey - Virtual key code
  • shift - Shift flag
Returns:
Boolean. True if you handled the event

OnPopup(self)

 

Context menu popup is about to be shown. Create items dynamically if you wish

Returns:
Boolean. True if you handled the event

OnHint(self, lineno)

 

Hint requested for the given line number.

Parameters:
  • lineno - The line number (zero based)
Returns:
  • tuple(number of important lines, hint string)
  • None: if no hint available

OnPopupMenu(self, menu_id)

 

A context (or popup) menu item was executed.

Parameters:
  • menu_id - ID previously registered with add_popup_menu()
Returns:
Boolean