pyqtribbon.category

Module Contents

Classes

RibbonCategoryStyle

The button style of a category.

RibbonCategoryLayoutButton

Previous/Next buttons in the category when the

RibbonCategoryScrollArea

Scroll area for the gallery

RibbonCategoryScrollAreaContents

Scroll area contents for the gallery

RibbonCategoryLayoutWidget

The category layout widget's category scroll area to arrange the widgets in the category.

RibbonCategory

The RibbonCategory is the logical grouping that represents the contents of a ribbon tab.

RibbonNormalCategory

A normal category.

RibbonContextCategory

A context category.

RibbonContextCategories

A list of context categories.

class pyqtribbon.category.RibbonCategoryStyle[source]

Bases: enum.IntEnum

The button style of a category.

class pyqtribbon.category.RibbonCategoryLayoutButton[source]

Bases: qtpy.QtWidgets.QToolButton

Previous/Next buttons in the category when the size is not enough for the widgets.

class pyqtribbon.category.RibbonCategoryScrollArea[source]

Bases: qtpy.QtWidgets.QScrollArea

Scroll area for the gallery

class pyqtribbon.category.RibbonCategoryScrollAreaContents[source]

Bases: qtpy.QtWidgets.QFrame

Scroll area contents for the gallery

class pyqtribbon.category.RibbonCategoryLayoutWidget(parent=None)[source]

Bases: qtpy.QtWidgets.QFrame

The category layout widget’s category scroll area to arrange the widgets in the category.

paintEvent(a0: qtpy.QtGui.QPaintEvent) None[source]

Override the paint event to draw the background.

resizeEvent(a0: qtpy.QtGui.QResizeEvent) None[source]

Override the resize event to resize the scroll area.

autoSetScrollButtonsVisible()[source]

Set the visibility of the scroll buttons.

scrollPrevious()[source]

Scroll the category to the previous widget.

scrollNext()[source]

Scroll the category to the next widget.

addWidget(widget: qtpy.QtWidgets.QWidget)[source]

Add a widget to the category layout.

Parameters:

widget – The widget to add.

removeWidget(widget: qtpy.QtWidgets.QWidget)[source]

Remove a widget from the category layout.

Parameters:

widget – The widget to remove.

takeWidget(widget: qtpy.QtWidgets.QWidget) qtpy.QtWidgets.QWidget[source]

Remove and return a widget from the category layout.

Parameters:

widget – The widget to remove.

Returns:

The widget that was removed.

class pyqtribbon.category.RibbonCategory(title: str = '', style: RibbonCategoryStyle = RibbonCategoryStyle.Normal, color: qtpy.QtGui.QColor = None, parent=None)           RibbonCategory(parent=None)[source]

Bases: RibbonCategoryLayoutWidget

The RibbonCategory is the logical grouping that represents the contents of a ribbon tab.

setMaximumRows(rows: int)[source]

Set the maximum number of rows.

Parameters:

rows – The maximum number of rows.

title() str[source]

Return the title of the category.

setCategoryStyle(style: RibbonCategoryStyle)[source]

Set the button style of the category.

Parameters:

style – The button style.

categoryStyle() RibbonCategoryStyle[source]

Return the button style of the category.

Returns:

The button style.

addPanelsBy(data: Dict[str, Dict]) Dict[str, pyqtribbon.panel.RibbonPanel][source]

Add panels from a dictionary.

Parameters:

data

The dictionary. The keys are the titles of the panels. The value is a dictionary of arguments. the argument showPanelOptionButton is a boolean to decide whether to show the panel option button, the rest arguments are passed to the RibbonPanel.addWidgetsBy() method. The dict is of the form:

{
    "panel-title": {
        "showPanelOptionButton": True,
        "widgets": {
            "widget-name": {
                "type": "Button",
                "arguments": {
                    "key1": "value1",
                    "key2": "value2"
                }
            },
        }
    },
}

Returns:

A dictionary of the newly created panels.

addPanel(title: str, showPanelOptionButton=True) pyqtribbon.panel.RibbonPanel[source]

Add a new panel to the category.

Parameters:
  • title – The title of the panel.

  • showPanelOptionButton – Whether to show the panel option button.

Returns:

The newly created panel.

removePanel(title: str)[source]

Remove a panel from the category.

Parameters:

title – The title of the panel.

takePanel(title: str) pyqtribbon.panel.RibbonPanel[source]

Remove and return a panel from the category.

Parameters:

title – The title of the panel.

Returns:

The removed panel.

panel(title: str) pyqtribbon.panel.RibbonPanel[source]

Return a panel from the category.

Parameters:

title – The title of the panel.

Returns:

The panel.

panels() Dict[str, pyqtribbon.panel.RibbonPanel][source]

Return all panels in the category.

Returns:

The panels.

class pyqtribbon.category.RibbonNormalCategory(title: str, parent: qtpy.QtWidgets.QWidget)[source]

Bases: RibbonCategory

A normal category.

setCategoryStyle(style: RibbonCategoryStyle)[source]

Set the button style of the category.

Parameters:

style – The button style.

class pyqtribbon.category.RibbonContextCategory(title: str, color: qtpy.QtGui.QColor, parent: qtpy.QtWidgets.QWidget)[source]

Bases: RibbonCategory

A context category.

setCategoryStyle(style: RibbonCategoryStyle)[source]

Set the button style of the category.

Parameters:

style – The button style.

color() qtpy.QtGui.QColor[source]

Return the color of the context category.

Returns:

The color of the context category.

setColor(color: qtpy.QtGui.QColor)[source]

Set the color of the context category.

Parameters:

color – The color of the context category.

showContextCategory()[source]

Show the given category, if it is not a context category, nothing happens.

hideContextCategory()[source]

Hide the given category, if it is not a context category, nothing happens.

categoryVisible() bool[source]

Return whether the category is shown.

Returns:

Whether the category is shown.

setCategoryVisible(visible: bool)[source]

Set the state of the category.

Parameters:

visible – The state.

class pyqtribbon.category.RibbonContextCategories(name: str, color: qtpy.QtGui.QColor, categories: Dict[str, RibbonContextCategory], ribbon)[source]

Bases: Dict[str, RibbonContextCategory]

A list of context categories.

name() str[source]

Return the name of the context categories.

setName(name: str)[source]

Set the name of the context categories.

color() qtpy.QtGui.QColor[source]

Return the color of the context categories.

setColor(color: qtpy.QtGui.QColor)[source]

Set the color of the context categories.

showContextCategories()[source]

Show the categories

hideContextCategories()[source]

Hide the categories

categoriesVisible() bool[source]

Return whether the categories are shown.

setCategoriesVisible(visible: bool)[source]

Set the state of the categories.