コード例 #1
0
ファイル: folderswidget.py プロジェクト: jeanim/studiolibrary
def example():
    path = r'C:/Users/Hovel/Dropbox/libraries/animation'
    trashPath = path + r'/Trash'

    ignoreFilter = ['.', '.studiolibrary', '.pose', '.anim', '.set']

    with studioqt.app():

        def itemSelectionChanged():
            print w.selectedFolders()
            print w.settings()

        w = FoldersWidget()
        w.enableFolderSettings(True)

        w.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        w.customContextMenuRequested.connect(w.showContextMenu)

        theme = studioqt.Theme()
        w.setStyleSheet(theme.styleSheet())

        w.setRootPath(path)
        w.reload()

        w.show()
        w.setIgnoreFilter(ignoreFilter)
        w.setFolderOrderIndex(trashPath, 0)

        w.itemSelectionChanged.connect(itemSelectionChanged)

    return w
コード例 #2
0
    def theme(self):
        """
        Return the Theme object for the library.

        :rtype: studioqt.Theme
        """
        if not self._theme:
            self._theme = studioqt.Theme()

            # Load legacy theme data.
            settings = self.settings()

            color = settings.get("color")
            if color:
                self._theme.setAccentColor(color)

            color = settings.get("accentColor")
            if color:
                self._theme.setAccentColor(color)

            color = settings.get("backgroundColor")
            if color:
                self._theme.setBackgroundColor(color)

            # Load new theme data.
            themeSettings = settings.get("theme")
            if themeSettings:
                self._theme.setSettings(themeSettings)

        return self._theme
コード例 #3
0
ファイル: messagebox.py プロジェクト: Rotomator/OPI_Tools
def createMessageBox(
        parent,
        title,
        text,
        width=None,
        height=None,
        buttons=None,
        headerIcon=None,
        headerColor=None,
        enableInputEdit=False,
        enableDontShowCheckBox=False
):
    """
    Open a question message box with the given options.

    :type parent: QWidget
    :type title: str
    :type text: str
    :type buttons: list[QMessageBox.StandardButton]
    :type headerIcon: str
    :type headerColor: str
    :type enableDontShowCheckBox: bool

    :rtype: MessageBox
    """
    mb = MessageBox(
        parent,
        width=width,
        height=height,
        enableInputEdit=enableInputEdit,
        enableDontShowCheckBox=enableDontShowCheckBox
    )

    mb.setText(text)

    buttons = buttons or QtWidgets.QDialogButtonBox.Ok
    mb.setButtons(buttons)

    if headerIcon:
        p = studioqt.resource.pixmap(headerIcon)
        mb.setPixmap(p)

    try:
        theme = parent.theme()
    except AttributeError:
        theme = studioqt.Theme()

    mb.setStyleSheet(theme.styleSheet())

    headerColor = headerColor or theme.accentColor().toString()
    headerColor = headerColor or "rgb(50, 150, 200)"

    mb.setHeaderColor(headerColor)

    mb.setWindowTitle(title)
    mb.setTitleText(title)

    return mb
コード例 #4
0
    def _valueChanged(self, value):

        value = value / 100.0

        theme = studioqt.Theme()
        theme.setDpi(value)
        theme.setLight()

        self._treeWidget.setDpi(value)
        self._treeWidget.setStyleSheet(theme.styleSheet())
コード例 #5
0
ファイル: hcolorbar.py プロジェクト: jubeyjose/maya-prefs
def example():
    """
    Example to show/test the HColorBar.

    :rtype: None
    """

    def _colorChanged(color):
        print "colorChanged:", color

    theme = studioqt.Theme()

    colors = [
        studioqt.Color(230, 60, 60, 255),
        studioqt.Color(255, 90, 40),
        studioqt.Color(255, 125, 100, 255),
        studioqt.Color(250, 200, 0, 255),
        studioqt.Color(80, 200, 140, 255),
        studioqt.Color(50, 180, 240, 255),
        studioqt.Color(110, 110, 240, 255),
    ]

    browserColors = []
    browserColors_ = [
        # Top row, Bottom row
        (230, 60, 60), (250, 80, 130),
        (255, 90, 40), (240, 100, 170),
        (255, 125, 100), (240, 200, 150),
        (250, 200, 0), (225, 200, 40),
        (80, 200, 140), (80, 225, 120),
        (50, 180, 240), (100, 200, 245),
        (130, 110, 240), (180, 160, 255),
        (180, 110, 240), (210, 110, 255)
    ]

    for colorR, colorG, colorB in browserColors_:
        for i in range(0, 3):
            color = QtGui.QColor(colorR, colorG, colorB)
            browserColors.append(color)

    colorBar = HColorBar()
    colorBar.setColors(colors)
    colorBar.setBrowserColors(browserColors)
    colorBar.colorChanged.connect(_colorChanged)
    colorBar.show()
コード例 #6
0
    def updateStyleSheet(self):
        """
        Update the style sheet with the current accent and background colors.

        :rtype: None
        """
        theme = studioqt.Theme()
        theme.setAccentColor(self.accentColor())
        theme.setBackgroundColor(self.backgroundColor())
        self.setStyleSheet(theme.styleSheet())

        # Update the font size to use "pt" for higher dpi screens.
        self.ui.text.setStyleSheet("font:11pt;")
        self.ui.title.setStyleSheet("font:22pt;")
        self.ui.header.setStyleSheet("font:15pt;")
        self.ui.nameEdit.setStyleSheet("font:12pt;")
        self.ui.pathEdit.setStyleSheet("font:12pt;")
        self.ui.nameLabel.setStyleSheet("font:14pt;")
        self.ui.themeLabel.setStyleSheet("font:14pt;")
        self.ui.locationLabel.setStyleSheet("font:14pt;")
コード例 #7
0
def example():
    """
    Example to show/test the SettingsDialog.

    :rtype: None
    """
    def _accentColorChanged(color):
        print "accent", color

    def _backgroundColorChanged(color):
        print "background:", color

    theme = studioqt.Theme()

    dialog = SettingsDialog()
    dialog.accentColorChanged.connect(_accentColorChanged)
    dialog.backgroundColorChanged.connect(_backgroundColorChanged)
    dialog.exec_()

    print dialog.name()
    print dialog.path()
    print dialog.accentColor()
    print dialog.backgroundColor()