GroupScrollingFeature Example

import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../shared")

from DevMachines import __pyside2__, __pyside6__
from DevMachines import QtitanBase
from DevMachines.QtitanBase import CommonStyle
from DevMachines.QtitanRibbon import RibbonSliderPane

if __pyside2__:
    from PySide2 import QtCore
    from PySide2.QtCore import Qt, QPoint
    from PySide2.QtGui import QIcon, QPixmap, QKeySequence
    from PySide2.QtWidgets import QApplication

if __pyside6__:
    from PySide6 import QtCore
    from PySide6.QtCore import Qt, QPoint
    from PySide6.QtGui import QIcon, QPixmap, QKeySequence
    from PySide6.QtWidgets import QApplication

from DemoRibbonWindow import DemoRibbonWindow

import GroupScrollingFeature_rc

class MainWindow(DemoRibbonWindow):
    def __init__(self):
        DemoRibbonWindow.__init__(self)
        self.setWindowTitle(self.tr("PyQtitanRibbon Group Scrolling"))
        self.createRibbon()
        self.createStatusBar()

        self.actionLogoRight = self.ribbonBar().addAction(QIcon(":/res/smallRight.png"), self.tr("Logo Right"), Qt.ToolButtonIconOnly)
        self.actionLogoRight.setCheckable(True)
        self.connect(self.actionLogoRight, QtCore.SIGNAL("triggered()"), self.pressLogoRight)
        self.actionLogoLeft  = self.ribbonBar().addAction(QIcon(":/res/smallLeft.png"), self.tr("Logo Left"), Qt.ToolButtonIconOnly)
        self.actionLogoLeft.setCheckable(True)
        self.connect(self.actionLogoLeft, QtCore.SIGNAL("triggered()"), self.pressLogoLeft)

        self.move(QPoint(200, 200));
        geom = self.screen().availableGeometry()
        self.resize(2 * geom.width() / 4, 2 * geom.height() / 4)

    def createQuickAccessBar(self):
        quickAccessBar = self.ribbonBar().quickAccessBar()
        action = quickAccessBar.actionCustomizeButton()
        action.setToolTip(self.tr("Customize Quick Access Bar"))

        smallButton = quickAccessBar.addAction(DemoRibbonWindow.createIcon(DemoRibbonWindow.Image_New), self.tr("New"))
        smallButton.setToolTip(self.tr("Create a new document"))
        quickAccessBar.setActionVisible(smallButton, False)

        smallButton = quickAccessBar.addAction(DemoRibbonWindow.createIcon(DemoRibbonWindow.Image_Open), self.tr("Open"))
        smallButton.setToolTip(self.tr("Open an existing document"))
        quickAccessBar.setActionVisible(smallButton, False)

        smallButton = quickAccessBar.addAction(DemoRibbonWindow.createIcon(DemoRibbonWindow.Image_Save), self.tr("Save"))
        smallButton.setToolTip(self.tr("Save the active document"))

        smallButton = quickAccessBar.addAction(DemoRibbonWindow.createIcon(DemoRibbonWindow.Image_Undo), self.tr("&Undo"))
        smallButton.setShortcut(QKeySequence.Undo)
        smallButton.setEnabled(False)

        smallButton = quickAccessBar.addAction(DemoRibbonWindow.createIcon(DemoRibbonWindow.Image_Redo), self.tr("&Redo"))
        smallButton.setShortcut(QKeySequence.Redo)
        smallButton.setEnabled(False)

        quickAccessBar.setVisible(True)

    def createRibbon(self):
        pageButtons = self.ribbonBar().addPage(self.tr("&Buttons"))
        if pageButtons:
            iconButtton = QIcon(":/res/scroll.png")
            for i in range(0, 18):
                ribbonGroup = pageButtons.addGroup(self.tr("Buttons number ") + str(i + 1))
                if ribbonGroup:
                    ribbonGroup.setIcon(iconButtton)
                    ribbonGroup.setContentAlignment(Qt.AlignVCenter)
                    ribbonGroup.addAction(iconButtton, self.tr("&Button 1"), Qt.ToolButtonTextUnderIcon)
                    ribbonGroup.addAction(iconButtton, self.tr("&Button 2"), Qt.ToolButtonTextUnderIcon)
                    ribbonGroup.addAction(iconButtton, self.tr("&Button 3"), Qt.ToolButtonTextUnderIcon)
                    ribbonGroup.addAction(iconButtton, self.tr("&Button 4"), Qt.ToolButtonTextUnderIcon)
                    ribbonGroup.addAction(iconButtton, self.tr("&Button 5"), Qt.ToolButtonTextUnderIcon)
                    ribbonGroup.addAction(iconButtton, self.tr("&Button 6"), Qt.ToolButtonTextUnderIcon)
                    ribbonGroup.addAction(iconButtton, self.tr("&Button 7"), Qt.ToolButtonTextUnderIcon)
                    ribbonGroup.addAction(iconButtton, self.tr("&Button 8"), Qt.ToolButtonTextUnderIcon)
        self.ribbonBar().setLogoPixmap(QPixmap(":/res/qtitan.png"), Qt.AlignRight);
        self.ribbonBar().setFrameThemeEnabled();

    def createStatusBar(self):
        sliderPane = RibbonSliderPane()
        sliderPane.setScrollButtons(True)
        sliderPane.setRange(0, 100)
        sliderPane.setMaximumWidth(130)
        sliderPane.setSingleStep(10)
        sliderPane.setSliderPosition(50)
        self.statusBar().addPermanentWidget(sliderPane)

    @QtCore.Slot()
    def pressLogoRight(self):
        self.ribbonBar().setLogoPixmap(QPixmap(":/res/qtitan.png"), Qt.AlignRight)
        self.actionLogoRight.setChecked(True)
        self.actionLogoLeft.setChecked(False)

    @QtCore.Slot()
    def pressLogoLeft(self):
        self.ribbonBar().setLogoPixmap(QPixmap(":/res/qtitan.png"), Qt.AlignLeft)
        self.actionLogoRight.setChecked(False)
        self.actionLogoLeft.setChecked(True)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setApplicationName("PyQtitanRibbon Group Scrolling");
    app.setOrganizationName("Developer Machines");
    w = MainWindow()
    w.show()
    sys.exit(app.exec_())