:orphan: :py:mod:`pyqtribbon.panel` ========================== .. py:module:: pyqtribbon.panel Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: pyqtribbon.panel.RibbonPanelTitle pyqtribbon.panel.RibbonSpaceFindMode pyqtribbon.panel.RibbonGridLayoutManager pyqtribbon.panel.RibbonPanelItemWidget pyqtribbon.panel.RibbonPanelOptionButton pyqtribbon.panel.RibbonPanel .. py:class:: RibbonPanelTitle Bases: :py:obj:`qtpy.QtWidgets.QLabel` Widget to display the title of a panel. .. py:class:: RibbonSpaceFindMode Bases: :py:obj:`enum.IntEnum` Mode to find available space in a grid layout, ColumnWise or RowWise. .. py:class:: RibbonGridLayoutManager(rows: int) Bases: :py:obj:`object` Grid Layout Manager. .. py:method:: request_cells(rowSpan: int = 1, colSpan: int = 1, mode=ColumnWise) Request a number of available cells from the grid. :param rowSpan: The number of rows the cell should span. :param colSpan: The number of columns the cell should span. :param mode: The mode of the grid. :return: row, col, the row and column of the requested cell. .. py:class:: RibbonPanelItemWidget(parent=None) Bases: :py:obj:`qtpy.QtWidgets.QFrame` Widget to display a panel item. .. py:method:: addWidget(widget) Add a widget to the panel item. :param widget: The widget to add. .. py:class:: RibbonPanelOptionButton Bases: :py:obj:`qtpy.QtWidgets.QToolButton` Button to display the options of a panel. .. py:class:: RibbonPanel(title: str = '', maxRows: int = 6, showPanelOptionButton=True, parent=None) RibbonPanel(parent=None) Bases: :py:obj:`qtpy.QtWidgets.QFrame` Panel in the ribbon category. .. py:method:: maximumRows() -> int Return the maximal number of rows in the panel. :return: The maximal number of rows in the panel. .. py:method:: largeRows() -> int Return the number of span rows for large widgets. :return: The number of span rows for large widgets. .. py:method:: mediumRows() -> int Return the number of span rows for medium widgets. :return: The number of span rows for medium widgets. .. py:method:: smallRows() -> int Return the number of span rows for small widgets. :return: The number of span rows for small widgets. .. py:method:: setMaximumRows(maxRows: int) Set the maximal number of rows in the panel. :param maxRows: The maximal number of rows in the panel. .. py:method:: setLargeRows(rows: int) Set the number of span rows for large widgets. :param rows: The number of span rows for large widgets. .. py:method:: setMediumRows(rows: int) Set the number of span rows for medium widgets. :param rows: The number of span rows for medium widgets. .. py:method:: setSmallRows(rows: int) Set the number of span rows for small widgets. :param rows: The number of span rows for small widgets. .. py:method:: defaultRowSpan(rowSpan: Union[int, pyqtribbon.toolbutton.RibbonButtonStyle]) -> int Return the number of span rows for the given widget type. :param rowSpan: row span or type. :return: The number of span rows for the given widget type. .. py:method:: panelOptionButton() -> RibbonPanelOptionButton Return the panel option button. :return: The panel option button. .. py:method:: setPanelOptionToolTip(text: str) Set the tooltip of the panel option button. :param text: The tooltip text. .. py:method:: rowHeight() -> int Return the height of a row. .. py:method:: addWidgetsBy(data: Dict[str, Dict]) -> Dict[str, qtpy.QtWidgets.QWidget] Add widgets to the panel. :param data: The data to add. The dict is of the form: .. code-block:: python { "widget-name": { "type": "Button", "arguments": { "key1": "value1", "key2": "value2" } }, } Possible types are: Button, SmallButton, MediumButton, LargeButton, ToggleButton, SmallToggleButton, MediumToggleButton, LargeToggleButton, ComboBox, FontComboBox, LineEdit, TextEdit, PlainTextEdit, Label, ProgressBar, SpinBox, DoubleSpinBox, DataEdit, TimeEdit, DateTimeEdit, TableWidget, TreeWidget, ListWidget, CalendarWidget, Separator, HorizontalSeparator, VerticalSeparator, Gallery. :return: A dictionary of the added widgets. .. py:method:: addWidget(widget: qtpy.QtWidgets.QWidget, *, rowSpan: Union[int, pyqtribbon.toolbutton.RibbonButtonStyle] = Small, colSpan: int = 1, mode=ColumnWise, alignment=QtCore.Qt.AlignCenter, fixedHeight: Union[bool, float] = False) -> QtWidgets.QWidget | Any Add a widget to the panel. :param widget: The widget to add. :param rowSpan: The number of rows the widget should span, 2: small, 3: medium, 6: large. :param colSpan: The number of columns the widget should span. :param mode: The mode to find spaces. :param alignment: The alignment of the widget. :param fixedHeight: Whether to fix the height of the widget, it can be a boolean, a percentage or a fixed height, when a boolean is given, the height is fixed to the maximum height allowed if the value is True, when a percentage is given (0 < percentage < 1) the height is calculated from the height of the maximum height allowed, depends on the number of rows to span. The minimum height is 40% of the maximum height allowed. :return: The added widget. .. py:method:: removeWidget(widget: qtpy.QtWidgets.QWidget) Remove a widget from the panel. .. py:method:: widget(index: int) -> qtpy.QtWidgets.QWidget Get the widget at the given index. :param index: The index of the widget, starting from 0. :return: The widget at the given index. .. py:method:: widgets() -> List[qtpy.QtWidgets.QWidget] Get all the widgets in the panel. :return: A list of all the widgets in the panel. .. py:method:: addButton(text: str = None, icon: qtpy.QtGui.QIcon = None, showText: bool = True, slot: Callable = None, shortcut: qtpy.QtGui.QKeySequence = None, tooltip: str = None, statusTip: str = None, checkable: bool = False, *, rowSpan: pyqtribbon.toolbutton.RibbonButtonStyle = Large, **kwargs) -> pyqtribbon.toolbutton.RibbonToolButton Add a button to the panel. :param text: The text of the button. :param icon: The icon of the button. :param showText: Whether to show the text of the button. :param slot: The slot to call when the button is clicked. :param shortcut: The shortcut of the button. :param tooltip: The tooltip of the button. :param statusTip: The status tip of the button. :param checkable: Whether the button is checkable. :param rowSpan: The type of the button corresponding to the number of rows it should span. :param kwargs: keyword arguments to control the properties of the widget on the ribbon bar. :return: The button that was added. .. py:method:: addAnyWidget(*args, cls, initializer: Callable = None, **kwargs) -> qtpy.QtWidgets.QWidget Add any widget to the panel. :param args: The arguments to pass to the initializer. :param cls: The class of the widget to add. :param initializer: The initializer of the widget to add, the first argument must be the widget. :param kwargs: The keyword arguments to pass to the initializer and to control the properties of the widget on the ribbon bar. .. py:method:: __getattr__(method: str) -> Callable Get the dynamic method `add[Small|Medium|Large][Widget]`. :param method: The name of the method to get. :return: The method of the widget to add. .. py:method:: addSeparator(orientation=QtCore.Qt.Vertical, width=6, **kwargs) -> pyqtribbon.separator.RibbonSeparator Add a separator to the panel. :param orientation: The orientation of the separator. :param width: The width of the separator. :param kwargs: keyword arguments to control the properties of the widget on the ribbon bar. :return: The separator. .. py:method:: addGallery(minimumWidth=800, popupHideOnClick=False, **kwargs) -> pyqtribbon.gallery.RibbonGallery Add a gallery to the panel. :param minimumWidth: The minimum width of the gallery. :param popupHideOnClick: Whether the gallery popup should be hidden when a user clicks on it. :param kwargs: keyword arguments to control the properties of the widget on the ribbon bar. :return: The gallery. .. py:method:: setTitle(title: str) Set the title of the panel. :param title: The title to set. .. py:method:: title() Get the title of the panel. :return: The title.