示例#1
0
    def __init__(self, label, matrix, min, max, parent=None):
        """

        :param label: the matrix widget label
        :type label: str
        :param matrix: a list of lists the lenght of each nested list is equal to the column length of the matrix for
         example if we're dealing with a 4x4 matrix then its a length of 4, 3x3 is 3 etc
        :type matrix: list(list(float))
        :param: min: a list of floats, each float is min for each vector
        :type min: list(float)
        :param: max: a list of floats, each float is max for each vector
        :type max: list(float)
        :param parent:
        :type parent:
        """
        super(Matrix, self).__init__(parent=parent)
        self.mainLayout = QtWidgets.QGridLayout(self)
        self.mainLayout.setContentsMargins(2, 2, 2, 2)
        self.mainLayout.setSpacing(uiconstants.SPACING)
        self.label = QtWidgets.QLabel(label, parent=self)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.mainLayout.addWidget(self.label, 0, 0)
        self.mainLayout.addItem(spacerItem, 1, 0)
        self._widgets = OrderedDict()
        axislabels = ("X", "Y", "Z")
        for i, c in enumerate(matrix):
            vec = VectorSpinBox(label="", value=c, min=min[i], max=max[i], axis=axislabels, parent=self)
            self.mainLayout.addWidget(vec, i, 1)
            self._widgets[i] = vec

        self.setLayout(self.mainLayout)
示例#2
0
    def __init__(self,
                 label="",
                 parent=None,
                 showToolbar=True,
                 showArrows=True,
                 showClose=True,
                 titleEditable=True):
        super(StackWidget, self).__init__(parent=parent)

        self.stackTableWgt = StackTableWidget(showArrows=showArrows,
                                              showClose=showClose,
                                              parent=self)
        self.stackItems = self.stackTableWgt.stackItems
        self.stackSearchEdit = QtWidgets.QLineEdit(parent=self)
        self.collapseBtn = QtWidgets.QPushButton(parent=self)
        self.expandBtn = QtWidgets.QPushButton(parent=self)

        self.text = label
        self.showToolbar = showToolbar
        self.showArrows = showArrows
        self.showClose = showClose
        self.titleEditable = titleEditable

        self.initUi()

        self.connections()
示例#3
0
    def __init__(self, showColumnVisBox=True, showHeaderBox=True, parent=None):
        super(ViewSearchWidget, self).__init__(parent=parent)
        searchIcon = iconlib.icon("magnifier", 16)
        closeIcon = iconlib.icon("close", 16)

        self.searchFrame = QtWidgets.QFrame(parent=self)
        self.searchFrame.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.searchFrame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.searchLayout = QtWidgets.QHBoxLayout(self)
        self.searchLayout.setContentsMargins(2, 2, 2, 2)

        self.searchWidget = searchwidget.SearchLineEdit(searchIcon, closeIcon, parent=self)
        self.searchWidget.textCleared.connect(self.searchTextedCleared.emit)
        self.searchWidget.textChanged.connect(self.searchTextedChanged.emit)

        self.searchFrame.setLayout(self.searchLayout)

        self.columnVisibilityBox = None
        self.columnVisibilityBox = combobox.ExtendedComboBox(parent=self)
        self.columnVisibilityBox.setMinimumWidth(100)
        self.columnVisibilityBox.checkStateChanged.connect(self.onVisibilityChanged)
        self.searchLayout.addWidget(self.columnVisibilityBox)

        self.searchHeaderBox = combobox.ExtendedComboBox(parent=self)
        self.searchHeaderBox.setMinimumWidth(100)
        self.searchHeaderBox.currentIndexChanged.connect(self.onFilterChanged)
        self.searchLayout.addWidget(self.searchHeaderBox)
        self.searchLayout.addWidget(self.searchWidget)
        if not showColumnVisBox:
            self.columnVisibilityBox.hide()
        if not showHeaderBox:
            self.searchHeaderBox.hide()
示例#4
0
    def show(self, parent):
        self.editorParent = QtWidgets.QWidget(parent=parent)
        self.editorParent.setObjectName("ScriptEditor")
        self.splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)
        self.layout = qtutils.vBoxLayout(parent=self.editorParent)
        self.layout.addWidget(self.splitter)
        self.editor = pythoneditor.TabbedEditor(parent=parent)
        self.editor.setObjectName("Script Editor")
        self.editor.addNewEditor("New Tab")
        self.logout = logoutput.OutputLogDialog("History", parent=parent)

        self.pythonHighlighter = highlighter.highlighterFromJson(os.path.join(os.path.dirname(highlighter.__file__),
                                                                              "highlightdata.json"),
                                                                 self.logout.document())
        handler = logoutput.QWidgetHandler()
        handler.addWidget(self.logout)
        for logger in logging.Logger.manager.loggerDict.values():
            try:
                logger.addHandler(handler)
            except AttributeError:
                continue
        self.splitter.addWidget(self.logout)
        self.splitter.addWidget(self.editor)
        self.editor.outputText.connect(self.outputText)
        XStream.stdout().messageWritten.connect(self.logout.insertPlainText)
        XStream.stderr().messageWritten.connect(self.logout.logError)
        self.application.setShortcutForWidget(self.logout, "ScriptEditorHistory")
        self.application.setShortcutForWidget(self.editor, "ScriptEditor")

        return self.editorParent
示例#5
0
    def __init__(self, label="Color:", initialRgbColor=None, initialRgbColorF=None, contentsMargins=(0, 0, 0, 0),
                 parent=None, labelWeight=1, colorWeight=1, colorWidth=None):
        """Initialize variables

        :param label: The name of the label, usually "Color:"
        :type label: str
        :param initialRgbColor: The initial rgb color in 0-255 ranges, overridden if there's a initialRgbColorF value
        :type initialRgbColor: tuple
        :param initialRgbColorF: The initial rgb color in 0-1.0 ranges, if None defaults to initialRgbColor values
        :type initialRgbColorF: tuple
        :param parent: the widget parent
        :type parent: class
        """
        super(labelColorBtn, self).__init__(parent=parent)
        self.layout = HBoxLayout(parent=None, margins=utils.marginsDpiScale(*contentsMargins),
                                 spacing=utils.dpiScale(uiconstants.SPACING))
        self.layout.addWidget(QtWidgets.QLabel(label, parent=self), labelWeight)
        self.colorPickerBtn = QtWidgets.QPushButton("", parent=self)
        # use initialRgbColor (255 range) or initialRgbColorF (float range 0-1)
        # if no color given then default to red
        self.storedRgbColor = initialRgbColor or tuple([i * 255 for i in initialRgbColorF]) or tuple([255, 0, 0])
        self.colorPickerBtn.setStyleSheet("background-color: rgb{}".format(str(self.storedRgbColor)))
        if colorWidth:
            self.colorPickerBtn.setFixedWidth(colorWidth)
        self.layout.addWidget(self.colorPickerBtn, colorWeight)
        self.setLayout(self.layout)
        self.connections()
示例#6
0
    def __init__(self, showColumnVisBox=True, showHeaderBox=True, parent=None):
        super(ViewSearchWidget, self).__init__(parent=parent)
        # TODO: these button colors need stylesheeting once Stylesheeting is moved to zoocore
        searchIcon = iconlib.iconColorized("magnifier", size=14, color=(255, 255, 255))
        closeIcon = iconlib.iconColorized("close", size=14, color=(255, 255, 255))

        self.searchFrame = QtWidgets.QFrame(parent=self)
        self.searchFrame.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.searchFrame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.searchLayout = QtWidgets.QHBoxLayout(self)
        self.searchLayout.setContentsMargins(0, 0, 0, 0)

        self.searchWidget = searchwidget.SearchLineEdit(searchIcon, closeIcon, parent=self)
        self.searchWidget.textCleared.connect(self.searchTextedCleared.emit)
        self.searchWidget.textChanged.connect(self.searchTextedChanged.emit)

        self.searchFrame.setLayout(self.searchLayout)

        self.columnVisibilityBox = combobox.ExtendedComboBox(parent=self)
        self.columnVisibilityBox.setMinimumWidth(100)
        self.columnVisibilityBox.checkStateChanged.connect(self.onVisibilityChanged)
        self.searchLayout.addWidget(self.columnVisibilityBox)

        self.searchHeaderBox = combobox.ExtendedComboBox(parent=self)
        self.searchHeaderBox.setMinimumWidth(100)
        self.searchHeaderBox.currentIndexChanged.connect(self.onFilterChanged)
        self.searchLayout.addWidget(self.searchHeaderBox)
        self.searchLayout.addWidget(self.searchWidget)
        if not showColumnVisBox:
            self.columnVisibilityBox.hide()
        if not showHeaderBox:
            self.searchHeaderBox.hide()
示例#7
0
    def __init__(self, widget, title, uid=None, parent=None):

        # maya internals workouts the parent if None
        super(BootStrapWidget, self).__init__(parent=parent)
        # self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        self.preferredSize = self.PREFERRED_SIZE
        # bind this instance globally so the maya callback can talk to it
        global BOOT_STRAPPED_WIDGETS
        uid = uid or title
        self.setObjectName(uid)
        BOOT_STRAPPED_WIDGETS[uid] = self

        self.setWindowTitle(title)
        # create a QMainWindow frame that other windows can dock into.
        self.dockingFrame = QtWidgets.QMainWindow(self)
        self.dockingFrame.layout().setContentsMargins(0, 0, 0, 0)
        self.dockingFrame.setWindowFlags(QtCore.Qt.Widget)
        self.dockingFrame.setDockOptions(QtWidgets.QMainWindow.AnimatedDocks)

        self.centralWidget = widget
        self.dockingFrame.setCentralWidget(self.centralWidget)

        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(self.dockingFrame, 0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        self.setLayout(layout)
        widget.setProperty('bootstrapWidget', self)
示例#8
0
    def __init__(self, searchPixmap=None, clearPixmap=None, parent=None):
        QtWidgets.QLineEdit.__init__(self, parent)

        if searchPixmap is None:
            searchPixmap = iconlib.iconColorized("magnifier", utils.dpiScale(16), (128,128,128))  # these should be in layouts

        if clearPixmap is None:
            clearPixmap = iconlib.iconColorized("close", utils.dpiScale(16), (128,128,128))

        self.clearButton = QtWidgets.QToolButton(self)
        self.clearButton.setIcon(QtGui.QIcon(clearPixmap))
        self.clearButton.setCursor(QtCore.Qt.ArrowCursor)
        self.clearButton.setStyleSheet("QToolButton { border: none; padding: 1px; }")
        self.clearButton.hide()
        self.clearButton.clicked.connect(self.clear)
        self.textChanged.connect(self.updateCloseButton)

        self.searchButton = QtWidgets.QToolButton(self)
        self.searchButton.setStyleSheet("QToolButton { border: none; padding: 0px; }")
        self.searchButton.setIcon(QtGui.QIcon(searchPixmap))

        frameWidth = self.style().pixelMetric(QtWidgets.QStyle.PM_DefaultFrameWidth)
        self.setStyleSheet("QLineEdit { padding-left: %dpx; padding-right: %dpx; } "%(
            self.searchButton.sizeHint().width() + frameWidth + 1,
            self.clearButton.sizeHint().width() + frameWidth + 1))

        msz = self.minimumSizeHint()
        self.setMinimumSize(max(msz.width(),
                                self.searchButton.sizeHint().width() +
                                self.clearButton.sizeHint().width() + frameWidth * 2 + 2),
                            max(msz.height(),
                                self.clearButton.sizeHint().height() + frameWidth * 2 + 2))
示例#9
0
    def __init__(self,
                 applicationModel,
                 title="Vortex",
                 width=1920,
                 height=1080,
                 icon="",
                 parent=None,
                 showOnInitialize=True):
        super(ApplicationWindow, self).__init__(title, width, height, icon,
                                                parent, showOnInitialize)
        self.setObjectName("VortexMainWindow")
        self.setStyleSheet(style.data)
        self.noteBook = graphnotebook.GraphNotebook(parent=self)
        self.setCustomCentralWidget(self.noteBook)
        self.noteBook.bindApplication(applicationModel)
        self.setupMenuBar()
        self.loadAction = QtWidgets.QAction("Load", parent=self)
        self.saveAction = QtWidgets.QAction("Save", parent=self)
        self.recentFilesMenu = QtWidgets.QMenu("Recent Files", parent=self)

        self.fileMenu.insertAction(self.exitAction, self.saveAction)
        self.fileMenu.insertAction(self.exitAction, self.loadAction)
        self.fileMenu.insertMenu(self.exitAction, self.recentFilesMenu)
        self.saveAction.triggered.connect(self.onSave)
        self.loadAction.triggered.connect(self.onLoad)
示例#10
0
    def __init__(self, parent=None):
        super(ArrayAttributeView, self).__init__(parent)

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

        sliceLayout = QtWidgets.QHBoxLayout()
        layout.addLayout(sliceLayout)

        sliceLayout.addWidget(QtWidgets.QLabel("Slice:"))
        self._lineEdit = _SliceLineEdit()
        self._lineEdit.setPlaceholderText('e.g.: "0:5000", "::-1"')
        sliceLayout.addWidget(self._lineEdit)

        self._arrayAttrModel = _ArrayAttributeModel()
        self._listView = QtWidgets.QListView()
        self._listView.setUniformItemSizes(True)
        self._listView.setViewMode(QtWidgets.QListView.ListMode)
        self._listView.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)
        self._listView.setModel(self._arrayAttrModel)
        layout.addWidget(self._listView)

        self._lineEdit.SliceChanged.connect(self._arrayAttrModel.SetSlice)

        self._SetupContextMenu()
示例#11
0
 def buildTitleFrame(self):
     """Builds the title part of the layout with a QFrame widget
     """
     # main dark grey qframe
     self.titleFrame = frame.QFrame(parent=self)
     self.setFrameColor(self.color)
     self.titleFrame.setContentsMargins(4, 0, 4, 0)
     # the horizontal layout
     self.horizontalLayout = QtWidgets.QHBoxLayout(self.titleFrame)
     self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
     # the icon and title and spacer
     self.iconButton = QtWidgets.QToolButton(parent=self)
     if self.collapsed:
         self.iconButton.setIcon(self._collapsedIcon)
     else:
         self.iconButton.setIcon(self._expandIcon)
     self.titleLabel = QtWidgets.QLabel(self.title, parent=self)
     self.titleLabel.setStyleSheet("font: bold;")
     self.titleLabel.setContentsMargins(0, 0, 0, 0)
     spacerItem = QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
     # add to horizontal layout
     self.horizontalLayout.addWidget(self.iconButton)
     self.horizontalLayout.addWidget(self.titleLabel)
     self.horizontalLayout.addItem(spacerItem)
     self.titleFrame.setFixedHeight(self.titleFrame.sizeHint().height())
     self.setMinimumSize(self.titleFrame.sizeHint().width(), self.titleFrame.sizeHint().height())
示例#12
0
    def __init__(self, node, text, secondaryText="", icon=None, parent=None):
        super(NodeHeader, self).__init__(parent)
        self._node = node

        self.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding))

        layout = QtWidgets.QGraphicsLinearLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.setOrientation(QtCore.Qt.Horizontal)
        self.setLayout(layout)
        self.headerIcon = HeaderPixmap(pixmap=icon or "", parent=self)
        layout.addItem(self.headerIcon)
        if not icon:
            self.headerIcon.hide()
        self._createLabels(text, secondaryText, layout)
        layout.addStretch(1)
        headerButton = NodeHeaderButton(size=12,
                                        color=node.model.headerButtonColor())
        headerButton.stateChanged.connect(self.headerButtonStateChanged.emit)
        layout.addItem(headerButton)
        layout.setAlignment(headerButton,
                            QtCore.Qt.AlignCenter | QtCore.Qt.AlignCenter)
示例#13
0
    def __init__(self, parent=None):

        super(DebugFlagsWidget, self).__init__(parent)

        self.setObjectName("Debug Flags")
        self.setMinimumSize(640, 300)
        self._listView = QtWidgets.QListView()
        self._tableWidget = QtWidgets.QTableWidget(0, 2)

        # Configure and populate the left list view
        self._listView.setEditTriggers(
            QtWidgets.QAbstractItemView.NoEditTriggers)

        self._populateDebugFlagsListView(self._listView)

        # For some reason, the last two lines work, while combining them into one command throws an error.
        self._listModel = self._listView.selectionModel()
        self._listModel.selectionChanged.connect(self._onFlagSelectionChanged)

        # Configure the table widget
        self._tableWidget.horizontalHeader().setStretchLastSection(True)
        self._tableWidget.horizontalHeader().setDefaultSectionSize(200)
        self._tableWidget.setHorizontalHeaderLabels(
            ['Debug Symbol', 'Description'])
        self._tableWidget.verticalHeader().hide()

        self._tableWidget.itemClicked.connect(self._onDebugFlagChecked)

        # Set the layout
        lay = QtWidgets.QHBoxLayout()
        lay.addWidget(self._listView, 0)
        lay.addWidget(self._tableWidget, 1)
        self.setLayout(lay)
示例#14
0
 def _initUi(self):
     parent = self.parent()
     self.frame = QtWidgets.QFrame(parent)
     self.iconWidget = QtWidgets.QLabel(parent)
     self.iconWidget.setFixedWidth(29)
     self.label = _ExtendedQLabel(self._label, parent)
     self.optionBox = QtWidgets.QToolButton(parent)
     self.iconWidget.setFixedWidth(29)
     self.label.clicked.connect(self.triggered.emit)
     self.optionBox.clicked.connect(self.optionBoxTriggered.emit)
示例#15
0
 def _setupFilter(self):
     self.reloadBtn = QtWidgets.QToolButton(parent=self)
     self.reloadBtn.setIcon(iconlib.icon("reload"))
     self.searchLayout = QtWidgets.QHBoxLayout(self)
     self.searchLayout.setContentsMargins(2, 2, 2, 2)
     self.searchLayout.addWidget(self.reloadBtn)
     # setup the column search widget
     self.searchWidget = viewfilterwidget.ViewSearchWidget(parent=self)
     self.searchLayout.addWidget(self.searchWidget)
     self.mainLayout.addLayout(self.searchLayout)
示例#16
0
 def buildHiderWidget(self):
     """Builds widget that is collapsable
     Widget can be toggled so it's a container for the layout
     """
     self.widgetHider = QtWidgets.QFrame()
     self.widgetHider.setContentsMargins(0, 0, 0, 0)
     self.hiderLayout = QtWidgets.QVBoxLayout(self.widgetHider)
     self.hiderLayout.setContentsMargins(*self.contentMargins)
     self.hiderLayout.setSpacing(self.contentSpacing)
     self.widgetHider.setHidden(self.collapsed)
示例#17
0
def vlineEdit(labelName, parent, enabled=True):
    layout = QtWidgets.QVBoxLayout()
    label = QtWidgets.QLabel(labelName, parent=parent)
    edit = QtWidgets.QLineEdit(parent=parent)
    edit.setEnabled(enabled)
    layout.addWidget(label)
    layout.addWidget(edit)
    layout.setContentsMargins(2, 2, 2, 2)
    layout.setSpacing(1)
    return label, edit, layout
示例#18
0
 def __init__(self, orientation=QtCore.Qt.Vertical, parent=None):
     super(ItemContainer, self).__init__(parent=parent)
     self.setSizePolicy(
         QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                               QtWidgets.QSizePolicy.Expanding))
     layout = QtWidgets.QGraphicsLinearLayout()
     layout.setSpacing(2)
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setOrientation(orientation)
     self.setLayout(layout)
示例#19
0
def DragSpinBoxExample():
    wid = QtWidgets.QWidget()

    horizontalLayout = QtWidgets.QHBoxLayout(wid)
    spinBox = spinbox.DragSpinBox(wid)
    horizontalLayout.addWidget(spinBox)
    doubleSpinBox = spinbox.DragDoubleSpinBox(wid)
    horizontalLayout.addWidget(doubleSpinBox)
    wid.show()
    return wid
示例#20
0
 def __init__(self, label, widget, parent=None):
     super(AttributeItemWidget, self).__init__(parent=parent)
     layout = QtWidgets.QFormLayout()
     layout.setSpacing(0)
     layout.setContentsMargins(0, 0, 0, 0)
     label = QtWidgets.QLabel(label, parent=self)
     widget.setParent(self)
     layout.addWidget(label)
     layout.addWidget(widget)
     self.setLayout(layout)
示例#21
0
    def _setupFilter(self):
        self.reloadBtn = QtWidgets.QToolButton(parent=self)
        self.reloadBtn.setIcon(iconlib.icon("reload"))
        self.searchLayout = QtWidgets.QHBoxLayout(self)
        self.searchLayout.setContentsMargins(2, 2, 2, 2)
        self.searchLayout.addWidget(self.reloadBtn)
        self.searchWidget = viewfilterwidget.ViewSearchWidget(showColumnVisBox=False, showHeaderBox=False, parent=self)

        self.searchLayout.addWidget(self.searchWidget)
        self.mainLayout.addLayout(self.searchLayout)
示例#22
0
 def _headerMenu(self, pos):
     globalPos = self.mapToGlobal(pos)
     menu = QtWidgets.QMenu(parent=self)
     headers = self.headerItems()
     for i in range(len(headers)):
         item = QtWidgets.QAction(headers[i], menu, checkable=True)
         menu.addAction(item)
         item.setChecked(not self.treeView.header().isSectionHidden(i))
         item.setData({"index": i})
     selectedItem = menu.exec_(globalPos)
     self.toggleColumn(selectedItem.data()["index"],
                       QtCore.Qt.Checked if selectedItem.isChecked() else QtCore.Qt.Unchecked)
示例#23
0
 def __init__(self, executor, parent=None):
     super(CommandViewer, self).__init__(parent=parent)
     self.executor = executor
     layout = QtWidgets.QVBoxLayout(self)
     self.scrollWidget = QtWidgets.QScrollArea(self)
     layout.addWidget(self.scrollWidget)
     scrollLayout = QtWidgets.QVBoxLayout(self)
     self.scrollWidget.setLayout(scrollLayout)
     self.listWidget = QtWidgets.QListWidget(self)
     scrollLayout.addWidget(self.listWidget)
     self.setLayout(layout)
     self.setup()
示例#24
0
    def _init(self):
        # search custom widget action
        self.searchAction = QtWidgets.QWidgetAction(self)
        self.searchAction.setObjectName("SearchAction")

        self.searchEdit = QtWidgets.QLineEdit()
        self.searchEdit.setPlaceholderText("Search...")
        self.searchEdit.textChanged.connect(self.updateSearch)

        self.searchAction.setDefaultWidget(self.searchEdit)

        self.addAction(self.searchAction)
        self.addSeparator()
示例#25
0
    def _setupFilter(self):
        self.reloadBtn = QtWidgets.QToolButton(parent=self)
        # TODO: this button color needs stylesheeting once Stylesheeting is moved to zoocore
        self.reloadBtn.setIcon(iconlib.iconColorized("reload", color=(255, 255, 255)))

        self.searchLayout = QtWidgets.QHBoxLayout(self)
        self.searchLayout.setContentsMargins(0, 0, 0, 0)
        self.searchLayout.addWidget(self.reloadBtn)
        self.searchWidget = viewfilterwidget.ViewSearchWidget(showColumnVisBox=False, showHeaderBox=False, parent=self)
        self.searchWidget.setFixedHeight(utils.dpiScale(23))

        self.searchLayout.addWidget(self.searchWidget)
        self.mainLayout.addLayout(self.searchLayout)
示例#26
0
    def __init__(self, label="", parent=None):
        """
        :type parent: QtWidgets.QMenu
        """
        QtWidgets.QWidgetAction.__init__(self, parent)

        self.widget = frame.QFrame(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
示例#27
0
 def __init__(self, model, parent=None):
     super(PathWidget, self).__init__(parent=parent)
     self.directory = False
     self.model = model
     self.edit = QtWidgets.QLineEdit(parent=self)
     self.layout = QtWidgets.QHBoxLayout()
     self.layout.setSpacing(0)
     self.layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(self.layout)
     self.layout.addWidget(self.edit)
     self.browserBtn = QtWidgets.QPushButton("...", parent=self)
     self.layout.addWidget(self.browserBtn)
     self.browserBtn.clicked.connect(self.onBrowserClicked)
     self.edit.editingFinished.connect(self.onEditChanged)
示例#28
0
    def __init__(self, node, text, parent=None):
        super(NodeHeader, self).__init__(parent)
        self._node = node
        self.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding))

        layout = QtWidgets.QGraphicsLinearLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.setOrientation(QtCore.Qt.Horizontal)
        self.setLayout(layout)
        self._createLabel(text, layout)
        layout.addStretch(1)
示例#29
0
    def __init__(self, text, *args, **kwargs):
        super(TextContainer, self).__init__(*args, **kwargs)
        self.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding))
        layout = QtWidgets.QGraphicsLinearLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.setOrientation(QtCore.Qt.Horizontal)
        self.setLayout(layout)

        self.title = GraphicsText(text, parent=self)
        layout.addItem(self.title)
        layout.setAlignment(self.title,
                            QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop)
示例#30
0
    def __init__(self, radioList=None, toolTipList=None, default=0, parent=None, vertical=False):
        """Horizontal group of radio buttons

        :param radioList: a list of radio button names (strings)
        :type radioList: list
        :param default: the default button to be checked as on, starts at 0 matching the list
        :type default: int
        :param parent: the parent widget
        :type parent: obj
        """
        super(RadioButtonGroup, self).__init__(parent=parent)
        # todo: STYLESHEET needs to be in the stylesheet and not hardcoded
        # rgb(27, 27, 27) is the main color of the unchecked button
        # rgb(45, 45, 45) is the background color of the window, unchecked has no icon
        indicatorWH = utils.dpiScale(14)
        uncheckedWH = utils.dpiScale(10)
        borderRadius = utils.dpiScale(7)
        borderPx = utils.dpiScale(2)
        styleSheetF = "QRadioButton::indicator {0}" \
                      "width: {2}px; " \
                      "height: {2}px;{1}" \
                      "QRadioButton::indicator:unchecked " \
                      "{0}background: rgb(27, 27, 27); " \
                      "width: {3}px; " \
                      "height: {3}px;" \
                      "border-radius: {4}px; " \
                      "border: {5}px solid rgb(45, 45, 45){1}".format("{", "}", indicatorWH, uncheckedWH,
                                                                      borderRadius, borderPx)
        if radioList is None:
            radioList = []
        self.radioButtons = []
        self.group = QtWidgets.QButtonGroup(parent=self)
        if not vertical:
            radioLayout = QtWidgets.QHBoxLayout()
        else:
            radioLayout = QtWidgets.QVBoxLayout()
        for i, radioName in enumerate(radioList):
            newRadio = QtWidgets.QRadioButton(radioName, self)
            newRadio.setStyleSheet(styleSheetF)
            if toolTipList:
                newRadio.setToolTip(toolTipList[i])
            self.group.addButton(newRadio)
            radioLayout.addWidget(newRadio)
            self.radioButtons.append(newRadio)
        if default is not None and default < len(self.radioButtons):
            self.radioButtons[default].setChecked(True)
        self.group.buttonClicked.connect(self.toggled.emit)
        self.setLayout(radioLayout)