Esempio n. 1
0
    def __init__(self, parent=None, form=None):
        super(FormDialog, self).__init__(parent)

        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self.setLayout(layout)

        self._widgets = []
        self._validator = None

        self._title = QtWidgets.QLabel(self)
        self._title.setObjectName('title')
        self._title.setText('FORM')
        self.layout().addWidget(self._title)

        self._description = QtWidgets.QLabel(self)
        self._description.setObjectName('description')
        self.layout().addWidget(self._description)

        self._formWidget = FormWidget(self)
        self._formWidget.setObjectName("formWidget")
        self._formWidget.validated.connect(self._validated)
        self.layout().addWidget(self._formWidget)

        self.layout().addStretch(1)

        buttonLayout = QtWidgets.QHBoxLayout(self)
        buttonLayout.setContentsMargins(0, 0, 0, 0)
        buttonLayout.setSpacing(0)

        self.layout().addLayout(buttonLayout)

        buttonLayout.addStretch(1)

        self._acceptButton = QtWidgets.QPushButton(self)
        self._acceptButton.setObjectName('acceptButton')
        self._acceptButton.setText('Submit')
        self._acceptButton.clicked.connect(self.accept)

        self._rejectButton = QtWidgets.QPushButton(self)
        self._rejectButton.setObjectName('rejectButton')
        self._rejectButton.setText('Cancel')
        self._rejectButton.clicked.connect(self.reject)

        buttonLayout.addWidget(self._acceptButton)
        buttonLayout.addWidget(self._rejectButton)

        if form:
            self.setSettings(form)
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        super(ButtonGroupFieldWidget, self).__init__(*args, **kwargs)

        self._value = ""
        self._buttons = {}

        items = self.data().get('items')

        widget = QtWidgets.QFrame()
        layout = QtWidgets.QHBoxLayout(widget)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        widget.setLayout(layout)

        i = 0
        for item in items:
            i += 1

            button = QtWidgets.QPushButton(toTitle(item), self)
            button.setCheckable(True)

            callback = functools.partial(self.setValue, item)
            button.clicked.connect(callback)

            self._buttons[item] = button

            if i == 1:
                button.setProperty('first', True)

            if i == len(items):
                button.setProperty('last', True)

            widget.layout().addWidget(button)

        self.setWidget(widget)
Esempio n. 3
0
    def setColors(self, colors):
        """
        Set the colors for the color bar.

        :type colors: list[str] or list[studioqt.Color]
        """
        self.deleteButtons()

        self.layout().addStretch()

        for color in colors:

            if not isinstance(color, str):
                color = studioqt.Color(color)
                color = color.toString()

            callback = partial(self._colorChanged, color)
            css = "background-color: " + color

            button = self.COLOR_BUTTON_CLASS(self)
            button.setObjectName('colorButton')
            button.setStyleSheet(css)
            button.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                 QtWidgets.QSizePolicy.Preferred)
            button.clicked.connect(callback)
            self.layout().addWidget(button)

        button = QtWidgets.QPushButton("...", self)
        button.setObjectName('browseColorButton')
        button.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
                             QtWidgets.QSizePolicy.Preferred)

        button.clicked.connect(self.browseColor)
        self.layout().addWidget(button)
        self.layout().addStretch()
Esempio n. 4
0
 def createWidget(self, parent):
     """
     :type parent: QtWidgets.QMenu
     """
     height = 25
     spacing = 1
     options = self.library().theme().options()
     styleSheet = studioqt.StyleSheet.fromText(LibraryAction.STYLE_SHEET, options=options)
     actionWidget = QtWidgets.QFrame(parent)
     actionWidget.setObjectName('actionWidget')
     actionWidget.setStyleSheet(styleSheet.data())
     actionLabel = QtWidgets.QLabel(self.library().name(), actionWidget)
     actionLabel.setObjectName('actionLabel')
     actionLabel.setFixedHeight(height)
     iconColor = QtGui.QColor(255, 255, 255, 220)
     icon = studiolibrary.resource().icon('delete', color=iconColor)
     actionOption = QtWidgets.QPushButton('', actionWidget)
     actionOption.setObjectName('actionOption')
     actionOption.setIcon(icon)
     actionOption.setFixedHeight(height + spacing)
     actionOption.setFixedWidth(height)
     actionOption.clicked.connect(self.deleteLibrary)
     actionIcon = QtWidgets.QLabel('', actionWidget)
     actionIcon.setObjectName('actionIcon')
     actionIcon.setFixedWidth(10)
     actionIcon.setFixedHeight(height)
     actionLayout = QtWidgets.QHBoxLayout(actionWidget)
     actionLayout.setSpacing(0)
     actionLayout.setContentsMargins(0, 0, 0, 0)
     actionLayout.addWidget(actionIcon, stretch=1)
     actionLayout.addWidget(actionLabel, stretch=1)
     actionLayout.addWidget(actionOption, stretch=1)
     return actionWidget
Esempio n. 5
0
    def __init__(self, title, widget, *args, **kwargs):
        super(GroupBoxWidget, self).__init__(*args, **kwargs)

        self._widget = None

        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self.setLayout(layout)

        self._titleWidget = QtWidgets.QPushButton(self)
        self._titleWidget.setCheckable(True)
        self._titleWidget.setText(title)
        self._titleWidget.setObjectName("title")
        self._titleWidget.toggled.connect(self._toggle)

        self.layout().addWidget(self._titleWidget)

        self._widgetFrame = QtWidgets.QFrame(self)
        self._widgetFrame.setObjectName("frame")

        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self._widgetFrame.setLayout(layout)

        self.layout().addWidget(self._widgetFrame)

        if widget:
            self.setWidget(widget)
Esempio n. 6
0
    def __init__(self, *args, **kwargs):
        super(FormWidget, self).__init__(*args, **kwargs)

        self._schema = []
        self._widgets = []
        self._validator = None

        layout = QtWidgets.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self.setLayout(layout)

        self._optionsFrame = QtWidgets.QFrame(self)
        self._optionsFrame.setObjectName("optionsFrame")

        layout = QtWidgets.QVBoxLayout(self._optionsFrame)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self._optionsFrame.setLayout(layout)

        self._titleWidget = QtWidgets.QPushButton(self)
        self._titleWidget.setCheckable(True)
        self._titleWidget.setObjectName("titleWidget")
        self._titleWidget.toggled.connect(self._titleClicked)
        self._titleWidget.hide()

        self.layout().addWidget(self._titleWidget)
        self.layout().addWidget(self._optionsFrame)
Esempio n. 7
0
    def __init__(self, *args):
        QtWidgets.QFrame.__init__(self, *args)

        self.setObjectName("statusWidget")
        self.setFrameShape(QtWidgets.QFrame.NoFrame)

        self._label = QtWidgets.QLabel("Hello :)", self)

        policy = QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred
        self._label.setSizePolicy(*policy)

        self._timer = QtCore.QTimer(self)

        self._button = QtWidgets.QPushButton(self)
        self._button.setMaximumSize(QtCore.QSize(17, 17))
        self._button.setIconSize(QtCore.QSize(17, 17))

        layout = QtWidgets.QHBoxLayout(self)
        layout.setContentsMargins(1, 0, 0, 0)

        layout.addWidget(self._button)
        layout.addWidget(self._label)

        self.setLayout(layout)
        self.setFixedHeight(19)
        self.setMinimumWidth(5)

        QtCore.QObject.connect(self._timer, QtCore.SIGNAL("timeout()"),
                               self.clear)
Esempio n. 8
0
    def __init__(self, *args):
        QtWidgets.QFrame.__init__(self, *args)

        self.setObjectName("statusWidget")
        self.setFrameShape(QtWidgets.QFrame.NoFrame)

        self._blocking = False
        self._timer = QtCore.QTimer(self)

        self._label = QtWidgets.QLabel("", self)
        self._label.setCursor(QtCore.Qt.IBeamCursor)
        self._label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        self._label.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Preferred)

        self._button = QtWidgets.QPushButton(self)
        self._button.setMaximumSize(QtCore.QSize(17, 17))
        self._button.setIconSize(QtCore.QSize(17, 17))

        layout = QtWidgets.QHBoxLayout(self)
        layout.setContentsMargins(1, 0, 0, 0)

        layout.addWidget(self._button)
        layout.addWidget(self._label)

        self.setLayout(layout)
        self.setFixedHeight(19)
        self.setMinimumWidth(5)

        QtCore.QObject.connect(self._timer, QtCore.SIGNAL("timeout()"),
                               self.reset)
    def __init__(self, *args):
        QtWidgets.QWidget.__init__(self, *args)

        layout = QtWidgets.QHBoxLayout(self)
        self.setLayout(layout)

        layout.setContentsMargins(0,0,0,0)
        layout.setSpacing(0)

        self._dataset = None
        self._iconPadding = 6
        self._iconButton = QtWidgets.QPushButton(self)
        self._iconButton.clicked.connect(self._onClicked)
        layout.addWidget(self._iconButton)

        icon = studiolibrary.resource().icon("pokeball")
        self._iconButton.setIcon(icon)

        self._comboBox = QtWidgets.QComboBox(self)
        layout.addWidget(self._comboBox, 1)

        self._comboBox.addItem("Select a character", "")
        self._comboBox.installEventFilter(self)
        self._comboBox.activated.connect(self._onActivated)

        self._comboBox.setSizePolicy( QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        self.setSizePolicy( QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)

        self.update()
Esempio n. 10
0
 def __init__(self, *args):
     QtWidgets.QLineEdit.__init__(self, *args)
     self._iconPadding = 4
     self._iconButton = QtWidgets.QPushButton(self)
     self._iconButton.clicked.connect(self._iconClicked)
     self._searchFilter = studioqt.SearchFilter('')
     icon = studioqt.icon('search')
     self.setIcon(icon)
     self.setPlaceholderText(self.DEFAULT_PLACEHOLDER_TEXT)
     self.textChanged.connect(self._textChanged)
     self.searchChanged = self.searchFilter().searchChanged
     self.update()
Esempio n. 11
0
    def __init__(self, *args, **kwargs):
        super(ColorFieldWidget, self).__init__(*args, **kwargs)

        self._value = "rgb(100,100,100)"

        widget = QtWidgets.QPushButton(self)
        widget.setObjectName('widget')
        widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                             QtWidgets.QSizePolicy.Preferred)

        widget.clicked.connect(self.browseColor)
        self.setWidget(widget)
Esempio n. 12
0
    def __init__(self, libraries, parent=None):
        super(FolderLibraryCreateCustomWidget, self).__init__(parent)
        layout = QtWidgets.QHBoxLayout(self)

        self._label = QtWidgets.QLabel(libraries[0], self)
        layout.addWidget(self._label, 100)

        self._menu = studiolibrary.widgets.LibrarySelectMenu(
            libraries, 'to create', self)
        self._pushButton = QtWidgets.QPushButton("...", self)
        self._pushButton.clicked.connect(self._onclicked)
        layout.addWidget(self._pushButton, 1)
    def __init__(self,
                 path="",
                 parent=None,
                 startFrame=None,
                 endFrame=None,
                 step=1):
        """
        :type path: str
        :type parent: QtWidgets.QWidget
        :type startFrame: int
        :type endFrame:  int
        :type step: int
        """
        parent = parent or mutils.gui.mayaWindow()

        QtWidgets.QDialog.__init__(self, parent)

        self._path = path
        self._step = step
        self._endFrame = None
        self._startFrame = None
        self._capturedPath = None

        if endFrame is None:
            endFrame = int(maya.cmds.currentTime(query=True))

        if startFrame is None:
            startFrame = int(maya.cmds.currentTime(query=True))

        self.setEndFrame(endFrame)
        self.setStartFrame(startFrame)

        self.setObjectName("CaptureWindow")
        self.setWindowTitle("Capture Window")

        self._captureButton = QtWidgets.QPushButton("Capture")
        self._captureButton.clicked.connect(self.capture)

        self._modelPanelWidget = mutils.gui.modelpanelwidget.ModelPanelWidget(
            self)

        vbox = QtWidgets.QVBoxLayout(self)
        vbox.setObjectName(self.objectName() + "Layout")
        vbox.addWidget(self._modelPanelWidget)
        vbox.addWidget(self._captureButton)

        self.setLayout(vbox)

        width = (self.DEFAULT_WIDTH * 1.5)
        height = (self.DEFAULT_HEIGHT * 1.5) + 50

        self.setWidthHeight(width, height)
        self.centerWindow()
Esempio n. 14
0
    def setColors(self, colors, width=24):
        """
        Set the colors for the color bar.

        :type colors: list[studioqt.Color]
        :type width: int
        :rtype: None
        """
        self.deleteButtons()

        for color in colors:

            if not isinstance(color, studioqt.Color):
                color = studioqt.Color(color)

            callback = partial(self._colorChanged, color)
            css = "background-color: " + color.toString()

            button = QtWidgets.QPushButton()
            button.setStyleSheet(css)
            button.setMinimumWidth(width)
            button.setSizePolicy(
                QtWidgets.QSizePolicy.Preferred,
                QtWidgets.QSizePolicy.Preferred
            )
            button.clicked.connect(callback)
            self.layout().addWidget(button)

        button = QtWidgets.QPushButton("...")
        button.setMinimumWidth(width*2)
        button.setMaximumWidth(width*2)
        button.setSizePolicy(
            QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Preferred
        )

        button.clicked.connect(self.browseColor)
        self.layout().addWidget(button)
Esempio n. 15
0
    def __init__(self, *args):
        QtWidgets.QLineEdit.__init__(self, *args)

        self._dataset = None
        self._spaceOperator = "and"
        self._iconPadding = 6
        self._iconButton = QtWidgets.QPushButton(self)
        self._iconButton.clicked.connect(self._iconClicked)

        icon = studiolibrary.resource().icon("search")
        self.setIcon(icon)

        self._clearButton = QtWidgets.QPushButton(self)
        self._clearButton.setCursor(QtCore.Qt.ArrowCursor)
        icon = studiolibrary.resource().icon("cross")
        self._clearButton.setIcon(icon)
        self._clearButton.setToolTip("Clear all search text")
        self._clearButton.clicked.connect(self._clearClicked)
        self._clearButton.setStyleSheet("background-color: transparent;")

        self.setPlaceholderText(self.PLACEHOLDER_TEXT)
        self.textChanged.connect(self._textChanged)

        self.update()
Esempio n. 16
0
    def createMenuButton(self):
        """Create the menu button to show the actions."""
        menu = self.data().get("menu", {})
        actions = self.data().get("actions", {})

        if menu or actions:

            name = menu.get("name", "...")
            callback = menu.get("callback", self.showMenu)

            self._menuButton = QtWidgets.QPushButton(name)
            self._menuButton.setObjectName("menuButton")
            self._menuButton.clicked.connect(callback)

            self._layout2.addWidget(self._menuButton)
Esempio n. 17
0
    def __init__(self, *args):
        QtWidgets.QLineEdit.__init__(self, *args)

        self._iconPadding = 6
        self._iconButton = QtWidgets.QPushButton(self)
        self._iconButton.clicked.connect(self._iconClicked)
        self._searchFilter = studioqt.SearchFilter("")

        icon = studioqt.icon("search")
        self.setIcon(icon)

        self._clearButton = QtWidgets.QPushButton(self)
        self._clearButton.setCursor(QtCore.Qt.ArrowCursor)
        icon = studioqt.icon("cross")
        self._clearButton.setIcon(icon)
        self._clearButton.setToolTip("Clear all search text")
        self._clearButton.clicked.connect(self._clearClicked)

        self.setPlaceholderText(self.DEFAULT_PLACEHOLDER_TEXT)

        self.textChanged.connect(self._textChanged)
        self.searchChanged = self.searchFilter().searchChanged

        self.update()
Esempio n. 18
0
    def setWidget(self, widget):
        """
        Set the widget used to set and get the field value.
        
        :type widget: QtWidgets.QWidget
        """
        widgetLayout = QtWidgets.QHBoxLayout()
        widgetLayout.setContentsMargins(0, 0, 0, 0)
        widgetLayout.setSpacing(0)

        self._widget = widget
        self._widget.setParent(self)
        self._widget.setObjectName('widget')
        self._widget.setSizePolicy(
            QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Preferred,
        )

        self._menuButton = QtWidgets.QPushButton("...")
        self._menuButton.setHidden(True)
        self._menuButton.setObjectName("menuButton")
        self._menuButton.clicked.connect(self._menuCallback)
        self._menuButton.setSizePolicy(
            QtWidgets.QSizePolicy.Preferred,
            QtWidgets.QSizePolicy.Expanding,
        )

        widgetLayout.addWidget(self._widget)
        widgetLayout.addWidget(self._menuButton)

        layout = QtWidgets.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self._errorLabel = QtWidgets.QLabel(self)
        self._errorLabel.setHidden(True)
        self._errorLabel.setObjectName("errorLabel")
        self._errorLabel.setSizePolicy(
            QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Preferred,
        )

        layout.addLayout(widgetLayout)
        layout.addWidget(self._errorLabel)

        self._layout2.addLayout(layout)
    def setColors(self, colors):
        """
        Set the colors for the color bar.

        :type colors: list[str] or list[studioqt.Color]
        """
        self.deleteButtons()

        first = True
        last = False

        for i, color in enumerate(colors):

            if i == len(colors) - 1:
                last = True

            if not isinstance(color, str):
                color = studioqt.Color(color)
                color = color.toString()

            callback = partial(self._colorChanged, color)
            css = "background-color: " + color

            button = self.COLOR_BUTTON_CLASS(self)
            button.setObjectName('colorButton')
            button.setStyleSheet(css)
            button.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                 QtWidgets.QSizePolicy.Preferred)

            button.setProperty("first", first)
            button.setProperty("last", last)

            button.clicked.connect(callback)
            self.layout().addWidget(button)

            first = False

        button = QtWidgets.QPushButton("...", self)
        button.setObjectName('menuButton')
        button.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                             QtWidgets.QSizePolicy.Preferred)

        button.clicked.connect(self.browseColor)
        self.layout().addWidget(button)
Esempio n. 20
0
 def __init__(self, parent = None, themes = None):
     """
     :type parent: QtWidgets.QWidget
     :type themes: list[Theme]
     """
     QtWidgets.QWidget.__init__(self, parent)
     if not themes:
         themes = themePresets()
     layout = QtWidgets.QHBoxLayout(self)
     layout.setSpacing(0)
     layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(layout)
     for theme in themes:
         color = theme.accentColor().toString()
         themeWidget = QtWidgets.QPushButton(self)
         themeWidget.setStyleSheet('background-color: ' + color)
         callback = partial(self.themeClicked.emit, theme)
         themeWidget.clicked.connect(callback)
         layout.addWidget(themeWidget)
Esempio n. 21
0
    def __init__(self, item, *args):
        """
        :type item: ImageItem
        :type args: list
        """
        QtWidgets.QWidget.__init__(self, *args)

        self._item = item
        self._pixmap = QtGui.QPixmap(item.thumbnailPath())

        self._image = QtWidgets.QLabel(self)
        self._image.setAlignment(QtCore.Qt.AlignHCenter)

        self._loadButton = QtWidgets.QPushButton("Load")
        self._loadButton.setFixedHeight(40)
        self._loadButton.clicked.connect(self.load)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self._image)
        layout.addStretch(1)
        layout.addWidget(self._loadButton)

        self.setLayout(layout)