コード例 #1
0
    def dragObject(self):

        if not self.selectedIndexes():
            return

        item = self.selectedItems()[0]
        role = item.data(0, QtCore.Qt.UserRole)

        if role == 'Folder':
            return

        text = 'BeamComponent:' + role

        mimeData = QtCore.QMimeData()
        mimeData.setText(text)

        drag = QtGui.QDrag(self)
        drag.setMimeData(mimeData)
        drag.setHotSpot(QtCore.QPoint(90, 23))

        ghostComponent = QtGui.QPixmap(180, 46)
        #ghostComponent.fill(QtGui.QColor(67, 143, 153, 80))
        ghostComponent.fill (QtGui.QColor (255, 255, 255, 255))

        drag.setPixmap(ghostComponent)
        drag.start(QtCore.Qt.IgnoreAction)
コード例 #2
0
    def __init__(self, parent=None):

        # constructors of base classes
        super(BeamUI, self).__init__(parent)
        self.setObjectName('mainUI')
        self.setWindowIcon(QtGui.QIcon(''))

        self.setWindowTitle("Beam Editor")
        self.setAcceptDrops(True)

        self.mainVboxLayout = QtGui.QVBoxLayout (self)

        self.guideLayout = QtGui.QVBoxLayout ()
        self.mainVboxLayout.addLayout(self.guideLayout)

        self.build_from_selection = QtGui.QPushButton("build_from_selection")
        self.mainVboxLayout.addWidget(self.build_from_selection)

        compDir = shifter.getComponentDirectories ()

        path = self.current_path ()

        trackLoadComponent = []

        for path, comps in compDir.iteritems ():
            for comp_name in comps:

                if comp_name in trackLoadComponent:
                    pm.displayWarning(
                        "Custom component name: %s, already in default "
                        "components. Names should be unique. This component is"
                        " not loaded" % comp_name)
                    continue
                else:
                    trackLoadComponent.append (comp_name)
                if not os.path.exists(os.path.join(path,
                                                   comp_name, "__init__.py")):
                    continue
                module = shifter.importComponentGuide (comp_name)
                print "BeamUI.__init__.module",module
                reload (module)

                commandbutton = self.loadUiWidget (os.path.join (path.replace("beam_components","widgets"), "commandbutton.ui"))

                icon = QtGui.QPixmap(os.path.join (path,module.TYPE,"icon.jpg"))
                self.guideLayout.addWidget (commandbutton)
                commandbutton.pushButton.setText(module.TYPE)
                commandbutton.label.setPixmap (icon)
                QtCore.QObject.connect (commandbutton.pushButton, QtCore.SIGNAL ("clicked()"),
                                        partial (self.drawComp, module.TYPE))

        self.createConnections()
コード例 #3
0
    def __init__(self, parent, color):
        super(KColorWidget, self).__init__(parent)
        self.installEventFilter(self)
        self._color = QtGui.QColor(color)

        self.pixmap = QtGui.QPixmap(12, 12)
        self.pixmap.fill(self._color)

        self.setProperty('colorLabel', True)
        self.setFixedSize(24, 24)
        self.setScaledContents(True)
        self.setPixmap(self.pixmap)

        self.createConnections()