示例#1
0
    def _buildLayout(self):
        self.setLayout(QtWidgets.QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.modeWidget = QtWidgets.QComboBox()
        self.modeWidget.addItems(
            [mode.capitalize() for mode in _controller.settings.modes])
        self.layout().addWidget(self.modeWidget)
示例#2
0
    def rightClickMenu(self, menu=None):
        if menu is None:
            menu = QtWidgets.QMenu()
        menu.addSeparator()

        if not self._configuringUI:
            configureAction = menu.addAction("Configure UI")
            restoreSettingsAction = object()
        else:
            configureAction = object()
            restoreSettingsAction = menu.addAction(
                "Restore Everything to Default")

        action = super(SlideAnimationKeysWidget,
                       self).rightClickMenu(menu=menu)
        if action == configureAction:
            self.toggleConfigureMode()
        elif action == restoreSettingsAction:
            answer = QtWidgets.QMessageBox.question(
                self, "Are you sure?", "This will reset all settings back to "
                "their defaults. This action cannot be undone.",
                QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)

            if answer == QtWidgets.QMessageBox.Yes:
                self.restoreAllSettings()

        return action
    def _buildLayout(self):
        self.setWindowTitle("Lock 'n Hide")
        self.setLayout(QtWidgets.QVBoxLayout())
        self.row1Layout = QtWidgets.QHBoxLayout()
        self.row2Layout = QtWidgets.QHBoxLayout()
        self.layout().addLayout(self.row1Layout)
        self.layout().addLayout(self.row2Layout)

        self.lockButton = CopyActionButton(
            "lockHideSelected(lock=True, hide=False)", "Lock")
        self.lockHideButton = CopyActionButton(
            "lockHideSelected(lock=True, hide=True)", "Lock 'n Hide")
        self.resetButton = CopyActionButton("reset()", "Reset Selected")

        self.row1Layout.addWidget(self.lockButton)
        self.row1Layout.addWidget(self.lockHideButton)
        self.row2Layout.addWidget(self.resetButton)
示例#4
0
 def buttonMenu(self, functionName):
     menu = QtWidgets.QMenu()
     copyAction = menu.addAction("Copy action to clipboard")
     clickedAction = menu.exec_(QtGui.QCursor.pos())
     if clickedAction == copyAction:
         internal.copyFunctionToClipboard(__name__, functionName)
         _log.info("Copied action to clipboard! Paste it into the python "
                   "script editor or python hotkey.")
示例#5
0
    def _buildLayout(self):
        self.setLayout(QtWidgets.QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.buttonsWidget = QtWidgets.QWidget(parent=self)
        self.buttonsWidget.setLayout(QtWidgets.QHBoxLayout())
        self.buttonsWidget.layout().setContentsMargins(0, 0, 0, 0)
        self.buttonsWidget.layout().setSpacing(2)

        self.configuringWidgets = ToggleFrame(parent=self)
        self.configuringWidgets.setLayout(QtWidgets.QVBoxLayout())
        self.configuringWidgets.layout().setContentsMargins(0, 0, 0, 0)
        self.configuringWidgets.layout().setSpacing(2)

        self.nudgeButton = QtWidgets.QRadioButton("Nudge")
        self.absoluteButton = QtWidgets.QRadioButton("Absolute")

        self.modeContainer = QtWidgets.QWidget(parent=self)
        self.modeContainer.setLayout(QtWidgets.QHBoxLayout())
        self.modeContainer.layout().setContentsMargins(0, 0, 0, 0)
        self.modeContainer.layout().setSpacing(2)
        self.modeContainer.layout().addWidget(self.nudgeButton)
        self.modeContainer.layout().addWidget(self.absoluteButton)
        self.modeContainer.layout().setAlignment(QtCore.Qt.AlignCenter)

        self.fieldsWidget = QtWidgets.QWidget(parent=self)
        self.fieldsWidget.setLayout(QtWidgets.QHBoxLayout())
        self.fieldsWidget.layout().setContentsMargins(0, 0, 0, 0)
        self.fieldsWidget.layout().setSpacing(2)

        self.configuringWidgets.checkbox.setText("Show Quick Picks")
        self.configuringWidgets.layout().addWidget(self.modeContainer)
        self.configuringWidgets.layout().addWidget(self.fieldsWidget)

        for x in xrange(len(_controller.settings.quickPickNums)):
            self.createButton()
        self.updateButtons()
        self.updateCheckboxes()

        self.stack = StackedWidgets(self.layout())
        self.stack.addWidget(self.buttonsWidget)
        self.stack.addWidget(self.configuringWidgets)

        if not _controller.settings.showQuickPick:
            self.hide()
示例#6
0
    def _buildLayout(self):
        self.setContentsMargins(0, 0, 0, 0)

        self._widgetHolder = QtWidgets.QFrame(parent=self)
        self._widgetHolder.setLayout(QtWidgets.QHBoxLayout())
        self._widgetHolder.layout().setAlignment(QtCore.Qt.AlignTop
                                                 | QtCore.Qt.AlignLeft)
        self._widgetHolder.setObjectName("_widgetHolder")
        self._widgetHolder.setContentsMargins(4, 10, 4, 4)
        self._widgetHolder.layout().setMargin(0)

        self.checkbox = QtWidgets.QCheckBox(parent=self)

        self._widgetHolder.layout().addWidget(self.checkbox)
        self._widgetHolder.move(15, -8)

        self._widgetHolder.setBackgroundRole(QtGui.QPalette.Window)
        self._widgetHolder.setAutoFillBackground(True)
 def rightClickMenu(self, menu=None):
     if menu is None:
         menu = QtWidgets.QMenu()
     copyAction = menu.addAction("Copy action to clipboard")
     action = super(CopyActionButton, self).rightClickMenu(menu=menu)
     if action == copyAction:
         internal.copyFunctionToClipboard(__name__, self._actionText)
         _log.info("Copied action to clipboard! Paste it into the python "
                   "script editor or python hotkey.")
     return action
示例#8
0
    def __init__(self, parent=None):
        super(SlideAnimationKeysWidget, self).__init__(parent=parent)
        self._configuringUI = False
        self._buildLayout()
        self._connectSignals()
        self._onControllerUpdate()

        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        QtWidgets.QShortcut(QtGui.QKeySequence("Esc"), self, self.close)
        self.setFocusPolicy(QtCore.Qt.ClickFocus)
    def rightClickMenu(self, menu=None):
        if menu is None:
            menu = QtWidgets.QMenu()
        else:
            menu.addSeparator()

        resetAction = menu.addAction("Reset All Channels")
        action = super(LockNHideWidget, self).rightClickMenu(menu=menu)
        if action == resetAction:
            resetAll()
        return action
示例#10
0
    def _buildLayout(self):
        self.setWindowTitle("Move My Objects")
        self.savePositionsButton = RightClickButton("Save Positions")
        self.applyPositionsButton = RightClickButton("Apply Positions")
        self.setLayout(QtWidgets.QHBoxLayout())
        self.setMinimumWidth(150)
        self.layout().addWidget(self.savePositionsButton)
        self.layout().addWidget(self.applyPositionsButton)

        self.adjustSize()
        self.resize(300, self.height())
        self.move(QtWidgets.QApplication.desktop().screen().rect().center() -
                  self.rect().center())
示例#11
0
    def rightClickMenu(self, menu=None):
        if menu is None:
            menu = QtWidgets.QMenu()

        copyAction = menu.addAction("Copy action to clipboard")
        action = super(ModeWidget, self).rightClickMenu(menu=menu)

        if action == copyAction:
            internal.copyFunctionToClipboard(slideAnimationKeys.__name__,
                                             'setMode(%r)' % self.getMode())
            _log.info("Copied action to clipboard! Paste it into the python "
                      "script editor or python hotkey.")

        return action
示例#12
0
    def __init__(self, parent=None):
        super(MoveMyObjectsWidget, self).__init__(parent=parent)
        self._buildLayout()
        self._connectSignals()

        # Set delete on close, so that destroyed() is called and our
        # callbacks are cleaned up.  I would have preferred to use
        # weakref to maintain our callbacks to avoid all these
        # shenanigans, but weakref's don't seem to be working for my
        # QWidget - they get dereferenced immediately after the function
        # returns.
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        QtWidgets.QShortcut(QtGui.QKeySequence("Esc"), self, self.close)
        self.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.update()
示例#13
0
    def rightClickMenu(self, menu=None):
        if menu is None:
            menu = QtWidgets.QMenu()

        # Don't allow the user to delete buttons, if there is only one
        # left - I don't want a situation where they can't figure out
        # where to click to create more.  This implementation is a big
        # fragile...
        if len(self._pickValues) <= 1:
            for action in menu.actions():
                if action.text().lower() == 'delete button':
                    menu.removeAction(action)

        action = super(QuickPicksWidget, self).rightClickMenu(menu=menu)

        return action
示例#14
0
    def rightClickMenu(self, menu=None):
        if menu is None:
            menu = QtWidgets.QMenu()

        # Ehhh, don't do this, have an "Enter edit mode", instead.
        # Buttons become text fields,
        copyAction = menu.addAction("Copy action to clipboard")

        action = super(QuickPickButton, self).rightClickMenu(menu=menu)

        if action == copyAction:
            internal.copyFunctionToClipboard(slideAnimationKeys.__name__,
                                             'hotkey(%d)' % self.value())
            _log.info("Copied action to clipboard! Paste it into the python "
                      "script editor or python hotkey.")

        return action
示例#15
0
    def rightClickMenu(self, menu=None):
        if menu is None:
            menu = QtWidgets.QMenu()

        insertButton = menu.addAction("Insert Button")
        deleteButton = menu.addAction("Delete Button")
        cursorPos = QtGui.QCursor.pos()
        action = super(QuickPickEdit, self).rightClickMenu(menu=menu,
                                                           bubble=True)
        if action == deleteButton:
            self.deletePick.emit()
        elif action == insertButton:
            # Find roughly where the right click came from, and use that
            # to determine the insertion direction
            pos = self.mapFromGlobal(cursorPos).x()
            if (float(pos) / self.width()) > 0.5:
                self.insertPick.emit('right')
            else:
                self.insertPick.emit('left')

        return action
示例#16
0
    def _buildLayout(self):
        self.setLayout(QtWidgets.QHBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self._configuringUI = False

        self.slider = QtWidgets.QSlider()
        self.slider.setRange(-100, 100)
        self.slider.setTickInterval(1)
        self.slider.setOrientation(QtCore.Qt.Horizontal)

        self.editSlider = QtWidgets.QSlider()
        self.editSlider.setRange(-100, 100)
        self.editSlider.setTickInterval(1)
        self.editSlider.setOrientation(QtCore.Qt.Horizontal)

        self.editMin = QtWidgets.QLineEdit()
        self.editMin.setValidator(IntegerValidator())
        self.editMin.setText(str(_controller.settings.sliderMin))
        self.editMin.setFixedWidth(35)  # Just hardcode something reasonable
        self.editMin.setToolTip('Minimum slider value')

        self.editMax = QtWidgets.QLineEdit()
        self.editMax.setValidator(IntegerValidator())
        self.editMax.setText(str(_controller.settings.sliderMax))
        self.editMax.setFixedWidth(35)  # Just hardcode something reasonable
        self.editMax.setToolTip('Maximum slider value')

        self.editFrame = ToggleFrame(parent=self)
        self.editFrame.setLayout(QtWidgets.QHBoxLayout())
        self.editFrame.layout().setContentsMargins(0, 0, 0, 0)
        self.editFrame.layout().setSpacing(2)
        self.editFrame.checkbox.setText("Show Slider")
        self.editFrame.checkbox.setChecked(_controller.settings.showSlider)
        self.editFrame.layout().addWidget(self.editMin)
        self.editFrame.layout().addWidget(self.editSlider)
        self.editFrame.layout().addWidget(self.editMax)

        self.stack = StackedWidgets(self.layout())
        self.stack.addWidget(self.slider)
        self.stack.addWidget(self.editFrame)

        self.layout().addWidget(self.slider)
        self.layout().addWidget(self.editFrame)

        if not _controller.settings.showSlider:
            self.hide()
示例#17
0
    def _buildLayout(self):
        self.setWindowTitle("Slide Animation Keys")
        self.sliderWidget = SliderWidget()

        self.confirmContainer = QtWidgets.QWidget()
        self.confirmContainer.setLayout(QtWidgets.QHBoxLayout())
        self.confirmContainer.layout().setContentsMargins(0, 0, 0, 0)
        self.confirmContainer.layout().setSpacing(4)

        self.applyButton = QtWidgets.QPushButton("Apply")
        self.cancelButton = QtWidgets.QPushButton("Cancel")

        self.modeWidget = ModeWidget(parent=self)
        self.sliderValueLabel = QtWidgets.QLabel("")
        self.sliderValueLabel.setAlignment(QtCore.Qt.AlignRight)
        self.quickPicksWidget = QuickPicksWidget(parent=self)

        self.topLayout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight)
        self.setLayout(QtWidgets.QVBoxLayout())
        self.layout().setSpacing(6)
        self.layout().addLayout(self.topLayout)

        self.topLayout.addWidget(self.modeWidget)
        self.topLayout.addWidget(self.sliderValueLabel)
        self.topLayout.insertStretch(1, 1)

        # Maya has apply / cancel buttons in this order.
        self.confirmContainer.layout().addWidget(self.applyButton)
        self.confirmContainer.layout().addWidget(self.cancelButton)
        self.confirmContainer.hide()

        self.layout().addWidget(self.quickPicksWidget)
        self.layout().addWidget(self.sliderWidget)
        self.layout().addWidget(self.confirmContainer)

        if not _controller.settings.showSlider:
            self.sliderValueLabel.hide()
示例#18
0
    def __init__(self, parent=None, closeOnRename=True, closeOnFocusLoss=True):
        super(RenameDialog, self).__init__(parent=parent,
                                           f=QtCore.Qt.FramelessWindowHint)
        self.closeOnRename = closeOnRename
        self.closeOnFocusLoss = closeOnFocusLoss

        font = QtGui.QFont("Bitstream Vera Sans Mono")
        font.setStyleHint(QtGui.QFont.TypeWriter)

        # Build layout
        self.searchText = QtWidgets.QLabel(self)
        self.searchText.setText('Search')
        self.searchField = QtWidgets.QLineEdit(self)
        self.searchField.setFont(font)
        self.searchField.returnPressed.connect(self.renameSelection)
        self.replaceText = QtWidgets.QLabel(self)
        self.replaceText.setText('Replace')
        self.replaceField = QtWidgets.QLineEdit(self)
        self.replaceField.setFont(font)
        self.replaceField.returnPressed.connect(self.renameSelection)
        self.populateReplaceField()

        self.setLayout(QtWidgets.QHBoxLayout())
        self.setMinimumWidth(250)
        self.textColumn = QtWidgets.QWidget(self)
        self.fieldColumn = QtWidgets.QWidget(self)
        self.layout().addWidget(self.textColumn)
        self.layout().addWidget(self.fieldColumn)
        fieldLayout = QtWidgets.QVBoxLayout()
        textLayout = QtWidgets.QVBoxLayout()
        self.textColumn.setLayout(textLayout)
        self.fieldColumn.setLayout(fieldLayout)
        textLayout.setContentsMargins(0, 0, 0, 0)
        fieldLayout.setContentsMargins(0, 0, 0, 0)

        textLayout.addWidget(self.searchText)
        textLayout.addWidget(self.replaceText)
        fieldLayout.addWidget(self.searchField)
        fieldLayout.addWidget(self.replaceField)

        # Monkey patch fields to detect focus events
        def checkFocusEvents(field):
            origFocusOut = field.focusOutEvent

            def wrappedFocusOutEvent(event):
                focused = self.anyFocus()
                if not focused and self.closeOnFocusLoss:
                    self.close()
                return origFocusOut(event)

            field.focusOutEvent = wrappedFocusOutEvent

        checkFocusEvents(self.searchField)
        checkFocusEvents(self.replaceField)

        # Transparencies only work with compositing on Linux.
        try:
            from guppy_animation_tools.internal.qt import QtX11Extras
            self.useRoundedCorners = QtX11Extras.QX11Info.isCompositingManagerRunning(
            )
        except ImportError:
            self.useRoundedCorners = platform.system() == 'Windows'

        if self.useRoundedCorners:
            # Set background transparent.  Only items drawn in paintEvent
            # will be visible.  This is necessary for rounded corners.
            self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True)
            palette = QtGui.QPalette()
            palette.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)
            self.setPalette(palette)
        self.replaceField.setFocus()

        # Add hotkeys to detect up and down arrows
        QtWidgets.QShortcut(QtGui.QKeySequence("Up"), self, self.previousEntry)
        QtWidgets.QShortcut(QtGui.QKeySequence("Down"), self, self.nextEntry)

        self.historyFields = {
            self.replaceField: _replaceHistory,
            self.searchField: _searchHistory
        }
        self._addTextToHistory()