logctrl

Log Control, supporting text copying and zoom.

Classes:

LogCtrl(parent[, id, pos, size, style, name])

Log Window based on StyledTextCtrl.

class LogCtrl(parent, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=138412032, name='Log')[source]

Bases: StyledTextCtrl

Log Window based on StyledTextCtrl.

Parameters
  • parent (Window) – The parent window.

  • id (int) – An identifier for the Log window. wx.ID_ANY is taken to mean a default. Default -1.

  • pos (Point) – The Log window position. The value wx.DefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default (-1, -1).

  • size (Size) – The Log window size. The value ::wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default (-1, -1).

  • style (int) – The window style. See wxPanel. Default 138412032.

  • name (str) – Window name. Default 'Log'.

Methods:

Append(text[, c])

Add the text to the end of the control using colour c which should be suitable for feeding directly to wx.NamedColour.

AppendStderr(text)

Add the stderr text to the end of the control using colour “red”

CanCopy()

Returns True if text is selected and can be copied, False otherwise.

Copy()

Copy the selection and place it on the clipboard.

DoFindNext(findData[, findDlg])

GetContextMenu()

Create and return a context menu for the log.

GetLastPosition()

GetRange(start, end)

GetSelection()

OnContextMenu(_)

vent Handler for showing the context menu

OnFindClose(_)

OnFindText(*_)

OnZoomDefault(*_)

Event Handler for resetting the zoom

OnZoomIn(*_)

Event Handler for zooming in

OnZoomOut(*_)

Event Handler for zooming out

ShowPosition(pos)

ToggleLineNumbers(*_)

ToggleWrap(*_)

Toggle word wrap.

bufferHasChanged()

bufferSave()

fixLineEndings(text)

Return text with line endings replaced by OS-specific endings.

getStyle([c])

Returns a style for a given colour if one exists.

onKeyPress(event)

Event Handler for key being pressed.

setDisplayLineNumbers(state)

setStyles(faces)

Configure font size, typeface and color for lexer.

wrap([wrap])

Set whether text is word wrapped.

write(text)

Display text in the log.

Attributes:

Append(text, c=None)[source]

Add the text to the end of the control using colour c which should be suitable for feeding directly to wx.NamedColour.

Parameters
  • text – … Should be a unicode string or contain only ascii data.

  • c – Default None.

AppendStderr(text)[source]

Add the stderr text to the end of the control using colour “red”

Parameters

text – … Should be a unicode string or contain only ascii data.

CanCopy()[source]

Returns True if text is selected and can be copied, False otherwise.

Return type

bool

Copy()[source]

Copy the selection and place it on the clipboard.

DoFindNext(findData, findDlg=None)[source]
GetContextMenu()[source]

Create and return a context menu for the log. This is used instead of the scintilla default menu in order to correctly respect our immutable buffer.

GetLastPosition()[source]
GetRange(start, end)[source]
GetSelection()[source]
OnContextMenu(_)[source]

vent Handler for showing the context menu

OnFindClose(_)[source]
OnFindText(*_)[source]
OnZoomDefault(*_)[source]

Event Handler for resetting the zoom

OnZoomIn(*_)[source]

Event Handler for zooming in

OnZoomOut(*_)[source]

Event Handler for zooming out

ShowPosition(pos)[source]
ToggleLineNumbers(*_)[source]
ToggleWrap(*_)[source]

Toggle word wrap.

bufferHasChanged()[source]
bufferSave()[source]
findDlg

Type:    Optional[FindReplaceDialog]

fixLineEndings(text)[source]

Return text with line endings replaced by OS-specific endings.

Parameters

text

getStyle(c='black')[source]

Returns a style for a given colour if one exists.

If no style exists for the colour, make a new style.

If we run out of styles, (only 32 allowed here) we go to the top of the list and reuse previous styles.

Parameters

c (str) – Default 'black'.

onKeyPress(event)[source]

Event Handler for key being pressed.

setDisplayLineNumbers(state)[source]
setStyles(faces)[source]

Configure font size, typeface and color for lexer.

Parameters

faces

wrap(wrap=True)[source]

Set whether text is word wrapped.

Parameters

wrap (bool) – Whether the text should be word wrapped. Default True.

write(text)[source]

Display text in the log.

Replace line endings with OS-specific endings.

Parameters

text