예제 #1
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
예제 #2
0
    def __init__(self, parent=None):
        super(MessageBox, self).__init__(parent)

        self.setMinimumWidth(300)
        self.setMaximumWidth(400)

        self._standardButtonClicked = None

        self._header = QtWidgets.QFrame(self)
        self._header.setStyleSheet("background-color: rgb(50,150,200,0);")
        self._header.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        self._header.setFixedHeight(46)

        self._icon = QtWidgets.QLabel(self._header)
        self._icon.setAlignment(QtCore.Qt.AlignTop)
        self._icon.setScaledContents(True)
        self._icon.setFixedWidth(28)
        self._icon.setFixedHeight(28)
        self._icon.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)

        self._title = QtWidgets.QLabel(self._header)
        self._title.setStyleSheet("font: 14pt bold; color:rgb(255,255,255);")
        self._title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)

        hlayout = QtWidgets.QHBoxLayout(self._header)
        hlayout.setSpacing(10)
        hlayout.addWidget(self._icon)
        hlayout.addWidget(self._title)

        self._header.setLayout(hlayout)

        self._message = QtWidgets.QLabel()
        self._message.setMinimumHeight(50)
        self._message.setWordWrap(True)
        self._message.setAlignment(QtCore.Qt.AlignLeft)
        self._message.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        self._message.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)

        options = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel

        self._buttonBox = QtWidgets.QDialogButtonBox(None, QtCore.Qt.Horizontal, self)
        self._buttonBox.clicked.connect(self._clicked)
        self._buttonBox.accepted.connect(self.accept)
        self._buttonBox.rejected.connect(self.reject)

        vlayout1 = QtWidgets.QVBoxLayout(self)
        vlayout1.setContentsMargins(0, 0, 0, 0)

        vlayout1.addWidget(self._header)

        vlayout2 = QtWidgets.QVBoxLayout(self)
        vlayout2.setSpacing(25)
        vlayout2.setContentsMargins(15, 5, 15, 5)

        vlayout2.addWidget(self._message)
        vlayout2.addWidget(self._buttonBox)

        vlayout1.addLayout(vlayout2)

        self.setLayout(vlayout1)
예제 #3
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)
예제 #4
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)
예제 #5
0
    def createWidget(self, menu):
        """
        This method is called by the QWidgetAction base class.

        :type menu: QtWidgets.QMenu
        """
        widget = QtWidgets.QFrame(self.parent())
        widget.setObjectName("filterByAction")

        facet = self._facet

        name = facet.get("name") or ""
        count = str(facet.get("count", 0))

        title = name.replace(".", "").title()

        label = QtWidgets.QCheckBox(widget)
        label.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
        label.setText(title)
        label.installEventFilter(self)
        label.toggled.connect(self._triggered)
        label.setChecked(self._checked)

        label2 = QtWidgets.QLabel(widget)
        label2.setObjectName("actionCounter")
        label2.setText(count)

        layout = QtWidgets.QHBoxLayout(widget)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(label, stretch=1)
        layout.addWidget(label2)
        widget.setLayout(layout)

        return widget
예제 #6
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)
예제 #7
0
    def __init__(self, *args, **kwargs):
        super(SeparatorFieldWidget, self).__init__(*args, **kwargs)

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

        self.setWidget(widget)

        self.label().hide()
예제 #8
0
    def __init__(self, *args, **kwargs):
        super(SeparatorOptionWidget, self).__init__(*args, **kwargs)

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

        self.setWidget(separator)

        self.label().hide()
예제 #9
0
 def __init__(self, label='', parent=None, dpi=1):
     """
     :type parent: QtWidgets.QMenu
     """
     QtWidgets.QWidgetAction.__init__(self, parent)
     self.setObjectName('customAction')
     self._frame = QtWidgets.QFrame(parent)
     self._label = QtWidgets.QLabel(label, self._frame)
     self._label.setObjectName('sliderActionLabel')
     self._label.setMinimumWidth(85)
     self._slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self._frame)
     self.valueChanged = self._slider.valueChanged
예제 #10
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)
예제 #11
0
    def __init__(self, parent=None, data=None, formWidget=None):
        super(FieldWidget, self).__init__(parent)

        self._data = data or {}
        self._error = False
        self._widget = None
        self._default = None
        self._required = None
        self._collapsed = False
        self._errorLabel = None
        self._menuButton = None
        self._actionResult = None
        self._formWidget = None

        if formWidget:
            self.setFormWidget(formWidget)

        self.setObjectName("fieldWidget")

        direction = self._data.get("layout", self.DefaultLayout)

        if direction == "vertical":
            layout = QtWidgets.QVBoxLayout(self)
        else:
            layout = QtWidgets.QHBoxLayout(self)

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

        self.setContentsMargins(0, 0, 0, 0)

        self._label = QtWidgets.QLabel(self)
        self._label.setObjectName('label')
        self._label.setSizePolicy(
            QtWidgets.QSizePolicy.Preferred,
            QtWidgets.QSizePolicy.Preferred,
        )

        layout.addWidget(self._label)

        self._layout2 = QtWidgets.QHBoxLayout(self)
        layout.addLayout(self._layout2)

        if direction == "vertical":
            self._label.setAlignment(QtCore.Qt.AlignLeft
                                     | QtCore.Qt.AlignVCenter)
        else:
            self._label.setAlignment(QtCore.Qt.AlignRight
                                     | QtCore.Qt.AlignVCenter)

        widget = self.createWidget()
        if widget:
            self.setWidget(widget)
예제 #12
0
    def __init__(self, *args, **kwargs):
        super(ImageFieldWidget, self).__init__(*args, **kwargs)

        self._value = ""
        self._pixmap = None

        widget = QtWidgets.QLabel(self)
        self.setStyleSheet("min-height: 32px;")
        widget.setScaledContents(False)
        widget.setObjectName('widget')
        widget.setAlignment(QtCore.Qt.AlignHCenter)

        self.setWidget(widget)
        self.layout().addStretch()
예제 #13
0
    def __init__(self, label="", parent=None):
        """
        :type parent: QtWidgets.QMenu
        """
        QtWidgets.QWidgetAction.__init__(self, parent)

        self._widget = SeparatorWidgetAction(parent)

        self._label = QtWidgets.QLabel(self._widget)
        self._label.setText(label)

        self._line = Line(self._widget)
        self._line.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                 QtWidgets.QSizePolicy.Expanding)
예제 #14
0
    def __init__(self, label="", parent=None):
        """
        :type parent: QtWidgets.QMenu
        """
        QtWidgets.QWidgetAction.__init__(self, parent)

        self._widget = SliderWidgetAction(parent)
        self._label = QtWidgets.QLabel(label, self._widget)

        self._slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self._widget)
        self._slider.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Expanding)

        self.valueChanged = self._slider.valueChanged
예제 #15
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)
예제 #16
0
    def __init__(self, *args, **kwargs):
        super(OptionWidget, self).__init__(*args, **kwargs)

        self._option = {}
        self._widget = None
        self._default = None
        self._required = None

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

        self.setLayout(layout)
        self.setContentsMargins(0, 0, 0, 0)

        self._label = QtWidgets.QLabel(self)
        self._label.setObjectName('label')
        self._label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)

        layout.addWidget(self._label)
예제 #17
0
    def __init__(self, *args):
        QtWidgets.QFrame.__init__(self, *args)

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

        self._label = QtWidgets.QLabel("", self)
        self._label.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                  QtWidgets.QSizePolicy.Preferred)

        layout.addWidget(self._label)

        self._progressBar = QtWidgets.QProgressBar(self)
        self._progressBar.setFormat("")
        self._progressBar.setRange(0, 100)
        self._progressBar.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                        QtWidgets.QSizePolicy.Preferred)

        layout.addWidget(self._progressBar)

        self.setLayout(layout)
예제 #18
0
    def __init__(self, parent=None, options=None):
        super(OptionWidget, self).__init__(parent)

        self._option = options or {}
        self._widget = None
        self._default = None
        self._required = None

        direction = self._option.get("layout", "horizontal")
        self.setProperty("layout", direction)

        if direction == "vertical":
            layout = QtWidgets.QVBoxLayout(self)
        else:
            layout = QtWidgets.QHBoxLayout(self)

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

        self.setLayout(layout)
        self.setContentsMargins(0, 0, 0, 0)

        self._label = QtWidgets.QLabel(self)
        self._label.setObjectName('label')
        self._label.setSizePolicy(
            QtWidgets.QSizePolicy.Preferred,
            QtWidgets.QSizePolicy.Preferred,
        )

        layout.addWidget(self._label)

        if direction == "vertical":
            self._label.setAlignment(QtCore.Qt.AlignLeft
                                     | QtCore.Qt.AlignVCenter)
        else:
            layout.setStretchFactor(self._label, 2)

            self._label.setAlignment(QtCore.Qt.AlignRight
                                     | QtCore.Qt.AlignVCenter)
예제 #19
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)
예제 #20
0
    def __init__(self,
                 parent=None,
                 width=None,
                 height=None,
                 enableInputEdit=False,
                 enableDontShowCheckBox=False,
                 customInputWidget=None):
        super(MessageBox, self).__init__(parent)
        self.setObjectName("messageBox")

        self._frame = None
        self._animation = None
        self._dontShowCheckbox = False
        self._clickedButton = None
        self._clickedStandardButton = None

        self.setMinimumWidth(width or 320)
        self.setMinimumHeight(height or 220)

        parent = self.parent()

        if parent:
            parent.installEventFilter(self)
            self._frame = QtWidgets.QFrame(parent)
            self._frame.setObjectName("messageBoxFrame")
            self._frame.show()
            self.setParent(self._frame)

        self._header = QtWidgets.QFrame(self)
        self._header.setFixedHeight(46)
        self._header.setObjectName("messageBoxHeaderFrame")
        self._header.setStyleSheet("background-color: rgb(0,0,0,0);")
        self._header.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Fixed)

        self._icon = QtWidgets.QLabel(self._header)
        self._icon.hide()
        self._icon.setFixedWidth(32)
        self._icon.setFixedHeight(32)
        self._icon.setScaledContents(True)
        self._icon.setAlignment(QtCore.Qt.AlignTop)
        self._icon.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                 QtWidgets.QSizePolicy.Preferred)

        self._title = QtWidgets.QLabel(self._header)
        self._title.setObjectName("messageBoxHeaderLabel")
        self._title.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding)

        hlayout = QtWidgets.QHBoxLayout(self._header)
        hlayout.setContentsMargins(15, 7, 15, 10)
        hlayout.setSpacing(10)
        hlayout.addWidget(self._icon)
        hlayout.addWidget(self._title)

        self._header.setLayout(hlayout)

        bodyLayout = QtWidgets.QVBoxLayout(self)

        self._body = QtWidgets.QFrame(self)
        self._body.setObjectName("messageBoxBody")
        self._body.setLayout(bodyLayout)

        self._message = QtWidgets.QLabel(self._body)
        self._message.setWordWrap(True)
        self._message.setMinimumHeight(15)
        self._message.setAlignment(QtCore.Qt.AlignLeft)
        self._message.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        self._message.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                    QtWidgets.QSizePolicy.Expanding)

        bodyLayout.addWidget(self._message)
        bodyLayout.setContentsMargins(15, 15, 15, 15)

        if customInputWidget:
            self._customInputWidget = customInputWidget

            bodyLayout.addStretch(1)
            bodyLayout.addWidget(self._customInputWidget)
            bodyLayout.addStretch(10)

        if enableInputEdit:
            self._inputEdit = QtWidgets.QLineEdit(self._body)
            self._inputEdit.setObjectName("messageBoxInputEdit")
            self._inputEdit.setMinimumHeight(32)
            self._inputEdit.setFocus()

            bodyLayout.addStretch(1)
            bodyLayout.addWidget(self._inputEdit)
            bodyLayout.addStretch(10)

        if enableDontShowCheckBox:
            msg = "Don't show this message again"
            self._dontShowCheckbox = QtWidgets.QCheckBox(msg, self._body)

            bodyLayout.addStretch(10)
            bodyLayout.addWidget(self._dontShowCheckbox)
            bodyLayout.addStretch(2)

        self._buttonBox = QtWidgets.QDialogButtonBox(None,
                                                     QtCore.Qt.Horizontal,
                                                     self)
        self._buttonBox.clicked.connect(self._clicked)
        self._buttonBox.accepted.connect(self._accept)
        self._buttonBox.rejected.connect(self._reject)

        vlayout1 = QtWidgets.QVBoxLayout(self)
        vlayout1.setContentsMargins(0, 0, 0, 0)

        vlayout1.addWidget(self._header)
        vlayout1.addWidget(self._body)
        bodyLayout.addWidget(self._buttonBox)

        self.setLayout(vlayout1)
        self.updateGeometry()