retype.layouts.shelveslayout

PyQt grid layout that is like bookshelves; places each item at the bottom centre of its cell, like a book resting on a shelf. Changes dynamically as the window resizes to fit as many items as it can, accounting for contentsMargins.

Classes

ShelvesLayout([parent, min_cell_width, ...])

ShelvesWidget([parent, min_cell_width, ...])

A resizable and scrollable widget that uses ShelvesLayout.

class retype.layouts.shelveslayout.ShelvesLayout(parent=None, min_cell_width=140, max_cell_width=200, cell_height=140)[source]

Bases: QLayout

addItem(item)[source]

Add an item to the end of this layout

count()[source]

Return number of items in this layout

doLayout(rect, dry_run=False)[source]

Lay out the items in `item_list’ within bounding QRect `rect’. If dry_run, only do the calculations and return the resulting grid’s height.

hasHeightForWidth()[source]

This layout’s height depends on its width

heightForWidth(width)[source]

Return the preferred height for this layout

itemAt(index)[source]

Return item at given index (non-destructively)

minimumSize(self) QSize[source]
setGeometry(self, a0: QRect)[source]
sizeHint(self) QSize[source]
takeAt(index)[source]

Remove and return item at given index

class retype.layouts.shelveslayout.ShelvesWidget(parent=None, min_cell_width=140, max_cell_width=200, cell_height=140)[source]

Bases: QWidget

A resizable and scrollable widget that uses ShelvesLayout. Use its addWidget() method to add children, setContentsMargins() to set the layout’s margins.

addWidget(widget)[source]
clearWidgets()[source]
setContentsMargins(self, left: int, top: int, right: int, bottom: int)[source]
setContentsMargins(self, margins: QMargins) None