def __init__(self, parent):
        """
        Constructor
        
        :param parent: QT parent object
        """
        QtGui.QWidget.__init__(self, parent)

        # make sure this widget isn't shown
        self.setVisible(False)
        
        # set up the UI
        self.ui = Ui_PublishHistoryWidget() 
        self.ui.setupUi(self)
        
        # set up action menu
        self._menu = QtGui.QMenu()   
        self._actions = []             
        self.ui.button.setMenu(self._menu)
        self.ui.button.setVisible(False)
        
        # compute hilight colors
        p = QtGui.QPalette()
        highlight_col = p.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight)
        self._highlight_str = "rgb(%s, %s, %s)" % (highlight_col.red(), 
                                                   highlight_col.green(), 
                                                   highlight_col.blue())
        self._transp_highlight_str = "rgba(%s, %s, %s, 25%%)" % (highlight_col.red(), 
                                                                 highlight_col.green(), 
                                                                 highlight_col.blue())
Ejemplo n.º 2
0
    def __init__(self, parent=None):
        """
        Construction

        :param parent: The parent widget
        """
        QtGui.QWidget.__init__(self, parent)

        self._thumbnail = True
        self._sg_fields = []

        # compute hilight colors
        p = QtGui.QPalette()
        highlight_col = p.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight)
        self._highlight_str = "rgb(%s, %s, %s)" % (
            highlight_col.red(),
            highlight_col.green(),
            highlight_col.blue(),
        )
        self._transp_highlight_str = "rgba(%s, %s, %s, 25%%)" % (
            highlight_col.red(),
            highlight_col.green(),
            highlight_col.blue(),
        )

        self._menu = QtGui.QMenu()
        self._actions = []
    def __init__(self, widget_factory, parent):
        """
        :param widget_factory: Qt Designer-generated widget factory.
        :param parent: Parent widget
        """
        QtGui.QWidget.__init__(self, parent)

        # make sure this widget isn't shown
        self.setVisible(False)

        # set up the UI
        self.ui = widget_factory()
        self.ui.setupUi(self)

        # set up action menu
        self._menu = QtGui.QMenu()
        self._actions = []
        self.ui.button.setMenu(self._menu)
        self.ui.button.setVisible(False)

        # compute hilight colors
        p = QtGui.QPalette()
        highlight_col = p.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight)
        self._highlight_str = "rgb(%s, %s, %s)" % (
            highlight_col.red(),
            highlight_col.green(),
            highlight_col.blue(),
        )
        self._transp_highlight_str = "rgba(%s, %s, %s, 25%%)" % (
            highlight_col.red(),
            highlight_col.green(),
            highlight_col.blue(),
        )
Ejemplo n.º 4
0
    def __init__(self, parent):
        """
        Constructor

        :param parent: QT parent object
        """
        QtGui.QWidget.__init__(self, parent)

        # make invisible by default
        self.setVisible(False)

        # set up the UI
        self._ui = Ui_SearchWidget()
        self._ui.setupUi(self)

        # now grab the default background color and use that
        # in addition to that, apply the same styling that the search
        # bar in the tree view is using.
        p = QtGui.QPalette()
        bg_col = p.color(QtGui.QPalette.Active, QtGui.QPalette.Window)

        style = """
        QGroupBox
        {
            background-color: rgb(%s, %s, %s);
            border-style: none;
            border-top-left-radius: 0px;
            border-top-right-radius: 0px;
            border-bottom-left-radius: 10px;
            border-bottom-right-radius: 10px;
        }

        QLineEdit
        {
            border-width: 1px;
            background-image: url(:/res/search.png);
            background-repeat: no-repeat;
            background-position: center left;
            border-radius: 5px;
            padding-left:20px;
            margin:4px;
            height:22px;
        }
        """ % (
            bg_col.red(),
            bg_col.green(),
            bg_col.blue(),
        )

        self._ui.group.setStyleSheet(style)

        # hook up a listener to the parent window so this widget
        # follows along when the parent window changes size
        filter = ResizeEventFilter(parent)
        filter.resized.connect(self._on_parent_resized)
        parent.installEventFilter(filter)

        # set up signals and slots
        self._ui.search.textChanged.connect(self._on_filter_changed)
Ejemplo n.º 5
0
    def _stylesheet_for_options(self, style_options, selected):
        # borrowed from qtwidgets framework's thumb_widget
        p = QtGui.QPalette()
        highlight_col = p.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight)

        border = "rgb(%s, %s, %s)" % (highlight_col.red(), highlight_col.green(), highlight_col.blue())
        background = "rgba(%s, %s, %s, 25%%)" % (highlight_col.red(), highlight_col.green(), highlight_col.blue())

        if selected:
            return HOVER_STYLE % (border, background)
        return REGULAR_STYLE
Ejemplo n.º 6
0
    def __init__(self, text, editable=True, parent=None):

        QtGui.QTextEdit.__init__(self, text, parent)
        if editable:
            self.setReadOnly(True)
            self.setFrameStyle(QtGui.QFrame.NoFrame)
            pal = QtGui.QPalette()
            pal.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)
            self.setPalette(pal)

            self.setLineWrapMode(QtGui.QTextEdit.WidgetWidth)
            self.setWordWrapMode(QtGui.QTextOption.WrapAnywhere)

            self.document().documentLayout().documentSizeChanged.connect(
                self.adjustMinimumSize)
        else:
            action = QtGui.QAction(self)
            action.setShortcuts(["Ctrl+Enter", "Ctrl+Return"])
            action.triggered.connect(self.actionReturn)
            self.addAction(action)

            self.setToolTip("Ctrl+Enter to create without pushing button")
Ejemplo n.º 7
0
    def set_selected(self, selected):
        """
        Adjust the style sheet to indicate selection or not.

        :param bool selected: Whether the widget is selected or not.
        """
        p = QtGui.QPalette()

        self.__selected = selected
        
        if selected:
            highlight_col = p.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight)
            highlight_str = "rgb(%s, %s, %s)" % (
                highlight_col.red(),
                highlight_col.green(),
                highlight_col.blue(),
            )

            self.ui.box.setStyleSheet(
                """
                #box {
                    border: 1px solid %s;
                    margin-bottom: 2px;
                    margin-right: 2px;
                }
                """ % (highlight_str)
            )
        elif self._show_border:
            self.ui.box.setStyleSheet(
                """
                #box {
                    border: 1px solid rgb(50,50,50);
                    margin-bottom: 2px;
                    margin-right: 2px;
                }
                """
            )
        else:
            self.ui.box.setStyleSheet("")
Ejemplo n.º 8
0
# Copyright (c) 2020 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

from sgtk.platform.qt import QtGui, QtCore

p = QtGui.QPalette()
highlight_col = p.color(QtGui.QPalette.Active, QtGui.QPalette.Highlight)

# The minimum size of a button icon.
ICON_SIZE = QtCore.QSize(50, 50)

# The styling of the buttons.
BUTTON_STYLE = """
QToolButton {
    font-size: 15px;
}

QToolButton::menu-button  {
    border: none;
    width: 30px;
}

QPushButton, QToolButton {
    background-color: transparent;