The viewactions module

ViewActions provides QActions to control a View.

class ViewActions(*args, **kwargs)[source]

Bases: PyQt5.QtCore.QObject

ViewActions provides QActions to control a View.

Use setView() to connect the actions with a View. If no View is connected, and an action is used; the viewRequested signal is emitted. You can connect this signal and call setView() in the called slot; the action is then performed on the View.

The attribute smartLayoutOrientationEnabled (defaulting to True) enables some intuitive behaviour: if set to True, for layout modes that do not make sense in horizontal mode the orientation is automatically set to Vertical; and when the user chooses Horizontal orientation in such modes, the layout mode is set to “single”.

smartLayoutOrientationEnabled = True
viewRequested
setView(view)[source]

Connects all the actions to the View.

Use None to set no view. If a view was previously set, all connections are removed from that View.

view()[source]

Return the View.

If no View is set, viewRequested is emitted. You can connect to this signal to create a View, and call setView() to use it to perform the requested action.

static names()[source]

Return a tuple of all the names of the actions we support.

createActions()[source]

Creates the actions; called by __init__().

updateFromProperties(properties)[source]

Set the actions to the state stored in the given ViewProperties.

connectActions()[source]

Connect our actions with our methods. Called by __init__().

updateActions()[source]

Update the state of the actions not handled in the other update methods.

updatePageLayoutModeActions(mode)[source]

Update the state of the layout mode actions.

updateViewModeActions(mode)[source]

Update the state of view mode related actions.

updateZoomActions(factor)[source]

Update the state of zoom related actions.

updatePagerActions()[source]

Update the state of paging-related actions.

setActionTexts(_=None)[source]

Set a default text to all the actions, you may override or translate them.

You may also set tooltip or whatsthis text in this method.

setActionIcons()[source]

Implement this method to set icons to the actions.

setActionShortcuts()[source]

Implement this method to set keyboard shortcuts to the actions.

slotPrint()[source]
slotViewMode(action)[source]
slotZoomNatural()[source]
slotZoomOriginal()[source]
slotZoomIn()[source]
slotZoomOut()[source]
slotZoomViewMode(mode)[source]
slotZoomFactor(factor)[source]
slotRotateLeft()[source]
slotRotateRight()[source]
slotPageLayoutMode(action)[source]
slotOrientation(action)[source]
slotContinuousMode()[source]
slotReload()[source]
slotPreviousPage()[source]
slotNextPage()[source]
slotSetPageNumber(num)[source]
slotMagnifier()[source]
class PagerAction(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QWidgetAction

PagerAction shows a spinbox widget with the current page number.

When the current page number is changed (by the user or by calling setCurrentPageNumber()) the signal currentPageNumberChanged() is emitted with the new current page number.

You can use the instance or class attributes buttonSymbols, focusPolicy and the displayFormat() method to influence behaviour and appearance of the spinbox widget(s) that is/are created when this action is added to a toolbar.

The displayFormat string should contain the text “{num}”. You can also include the string “{total}”, so the page count is displayed as well.

currentPageNumberChanged
buttonSymbols = 2
focusPolicy = 2
createWidget(self, QWidget)QWidget[source]
setButtonSymbols(buttonSymbols)[source]

Set the buttonSymbols property, and update already existing widgets.

displayFormat()[source]

Return the currently active display format string.

setDisplayFormat(displayFormat)[source]

Set the display format string to use.

The default is “{num} of {total}”.

pageCount()[source]

Return the currently set page count.

setPageCount(pageCount)[source]

Set the page count.

currentPageNumber()[source]

Return the current page number.

setCurrentPageNumber(num)[source]

Set our current page number.

updateCurrentPageNumber(num)[source]

Set our current page number, but without emitting the signal.

class ZoomerAction(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QWidgetAction

ZoomerAction provides a combobox with view modes and zoom factors.

zoomFactorChanged
viewModeChanged
viewModes()[source]

Return the view modes that are displayed in the combobox.

See setViewModes() for explanation.

setViewModes(modes)[source]

Set the view modes to display on top of the zoom values in the box.

An iterable of tuples (mode, name) is expected; every mode is a viewMode, the name is displayed. By default modes 1, 2 and 3 are displayed with the names “Width”, “Height”, “Page”.

zoomFactors()[source]

Return the zoom factors that are displayed in the combobox.

A zoom factor of 100% is represented by a floating point value of 1.0.

setZoomFactors(factors)[source]

Set the zoom factors to display in the combobox.

A zoom factor of 100% is represented by a floating point value of 1.0.

zoomFormat()[source]

Return the format string used to display zoom factors.

setZoomFormat(zoomFormat)[source]

Set the format string used to display zoom factors.

createWidget(self, QWidget)QWidget[source]
viewMode()[source]

Return the current view mode.

setViewMode(mode)[source]

Set the current view mode.

zoomFactor()[source]

Return the current zoom factor.

setZoomFactor(factor)[source]

Set the current zoom factor.

setCurrentIndex(index)[source]

Called when the user chooses an entry in a combobox.