eric3.UI.LogView

Module implementing the log viewer widget and the log widget.

Classes

LogView Class providing a stack of tabbed scrollable widgets.
LogViewViewport Internal class representing the viewport of the scrollview.
LogViewWidget Base class for widgets to be displayed by LogView.
LogWidget A class for displaying logging messages.

Functions

None

LogView

Class providing a stack of tabbed scrollable widgets. Like QTabWidget the LogView provides a stack of widgets. Different from the normal QTabWidget the tabs are aligned at the bottom with QTabBar::RoundedBelow style. The contents of the different widgets can be scrolled by scrollbars that are on the right and bottom side. The widgets themselves must be derived from LogViewWidget.

LogView is not derived from QTabWidget as this would prevent the implentation of the horizontal scrollbar at the side of the tabbar. The interface is similar to QTabWidget to make it easy to use.

Derived from

QFrame

Methods

LogView Constructor
addTab Adds a tab.
contextMenuEvent Reimplemented for custom context menu.
getActualViewport Gets the actual viewport or None if there is none.
handleClearWidget Private slot to handle the clear popup menu action.
handleCopyWidget Private slot to handle the copy popup menu action.
handleScrollbarValueChanged Called when the value of a scrollbar changes.
handleTabbarSelected Called when the selection in the tabbar changes.
handleWidgetSizeChanged Recalculates the scrollbars if necessary.
resizeEvent Reimplemented to set the scrollbar sizes.
setCurrentPage Set the page at position pos as the current page.
setupScrollBars Calculates the sizes of the scrollbars for the top widget.
wheelEvent Private method to override the wheel event.

LogView (Constructor)

LogView(parent=None, name=None, flags=0)

Constructor

flags
window flags
name
name of this widget (string or QString)
parent
parent widget (QWidget)

LogView.addTab

addTab(labelOrTabOrIconset, label = None)

Adds a tab.

label
label to be displayed next to an icon (QString)
labelOrTabOrIconset
label, tab or icon to be shown (QString, QTab or QIconSet)
Returns:
a tuple of the tab id and the child managed by this tab (integer, LogWidget)

LogView.contextMenuEvent

contextMenuEvent(evt)

Reimplemented for custom context menu.

evt
context menu event (QContextMenuEvent)

LogView.getActualViewport

getActualViewport()

Gets the actual viewport or None if there is none.

Returns:
reference to the actual viewport

LogView.handleClearWidget

handleClearWidget()

Private slot to handle the clear popup menu action.

LogView.handleCopyWidget

handleCopyWidget()

Private slot to handle the copy popup menu action.

LogView.handleScrollbarValueChanged

handleScrollbarValueChanged(value)

Called when the value of a scrollbar changes.

value
value of the scrollbar (int) (ignored)

LogView.handleTabbarSelected

handleTabbarSelected(id)

Called when the selection in the tabbar changes. The corresponding widget is activated.

id
the id of the selected tab (int)

LogView.handleWidgetSizeChanged

handleWidgetSizeChanged(widget)

Recalculates the scrollbars if necessary.

LogView.resizeEvent

resizeEvent(evt)

Reimplemented to set the scrollbar sizes.

evt
resize event (QResizeEvent)

LogView.setCurrentPage

setCurrentPage(pos)

Set the page at position pos as the current page.

LogView.setupScrollBars

setupScrollBars()

Calculates the sizes of the scrollbars for the top widget.

LogView.wheelEvent

wheelEvent(evt)

Private method to override the wheel event.

evt
wheel event (QWheelEvent)

Up

LogViewViewport

Internal class representing the viewport of the scrollview.

Derived from

QWidget

Methods

LogViewViewport Constructor
getChild
getWidget Public method returning the child widget.
getWidgetSize Public method to get the size of the child widget.
setScrollOffset Sets the scrolling offset for the child widget.
setScrollOffsetP Sets the scrolling offset for the child widget.

LogViewViewport (Constructor)

LogViewViewport(parent=None, name=None)

Constructor

name
name of this widget (string or QString)
parent
parent widget (QWidget)

LogViewViewport.getChild

getChild()

LogViewViewport.getWidget

getWidget()

Public method returning the child widget.

Returns:
child widget

LogViewViewport.getWidgetSize

getWidgetSize()

Public method to get the size of the child widget.

Returns:
the size of the child widget (QSize)

LogViewViewport.setScrollOffset

setScrollOffset(x, y)

Sets the scrolling offset for the child widget.

x
x-offset (int)
y
y-offset (int)

LogViewViewport.setScrollOffsetP

setScrollOffsetP(point)

Sets the scrolling offset for the child widget.

point
scrolling offset (QPoint)

Up

LogViewWidget

Base class for widgets to be displayed by LogView. Subclasses may emit the signal sizeChanged(LogViewWidget) to tell the container that a resizing may be necessary.

Derived from

QWidget

Methods

LogViewWidget Constructor
preferredBackgroundColor Private method setting the background colour.

LogViewWidget (Constructor)

LogViewWidget(parent=None, name=None)

Constructor

name
name of this widget (string or QString)
parent
parent widget (QWidget)

LogViewWidget.preferredBackgroundColor

preferredBackgroundColor()

Private method setting the background colour.

Up

LogWidget

A class for displaying logging messages. LogWidget is a simple class to be plugged in a LogView. It displays lines of text without interpretation of richtext or html tags. Neither are special characters like newlines or tabs interpreted. The widget can either store all the strings sent to it (the default) or can limit the number of lines to store. In this case the oldest lines are discarded when new lines arrive.

Derived from

LogViewWidget

Methods

LogWidget Constructor
append Public method to append text to the messages.
clear Public method to delete all strings from the internal buffer and clears the display.
copy Public method to copy all strings from the internal buffer to the clipboard.
handleSetMaxLines Sets the maximum number of lines to be shown.
paintEvent Reimplemented for custom painting.
preferredBackgroundColor Reimplemented to return colorgroup().base().

LogWidget (Constructor)

LogWidget(parent=None, name=None)

Constructor

name
name of this widget (string or QString)
parent
parent widget (QWidget)

LogWidget.append

append(text)

Public method to append text to the messages. When the LogWidget is already scrolled to the bottom, it will further scroll down to display the newly added line. If the scrolling position is not at the end, this position is not changed.

text
text to be appended (string or QString)

LogWidget.clear

clear()

Public method to delete all strings from the internal buffer and clears the display.

LogWidget.copy

copy()

Public method to copy all strings from the internal buffer to the clipboard.

LogWidget.handleSetMaxLines

handleSetMaxLines(val)

Sets the maximum number of lines to be shown.

val
maximum number of lines to be displayed If val is <= 0 then there will be no limit. If the maximum number of lines is appended, the oldest are discarded.

LogWidget.paintEvent

paintEvent(evt)

Reimplemented for custom painting.

evt
the paint event object (QPaintEvent)

LogWidget.preferredBackgroundColor

preferredBackgroundColor()

Reimplemented to return colorgroup().base().

Returns:
preferred background colour (QColor)

Up