Python PySide.QtCore 模块,QRect() 实例源码

我们从Python开源项目中,提取了以下27个代码示例,用于说明如何使用PySide.QtCore.QRect()

项目:CyclopsVFX-Unity    作者:geoffroygivry    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QtGui.QPainter(self)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        parent = self.parentWidget()

        pieRect = QtCore.QRect(1, 1, self.width()-2, self.height()-2)
        startAngle = 0 * 16

        if self.currentIndex() == 0:
            # STATUS = WAITING
            painter.drawEllipse(pieRect)
        elif self.currentIndex() == 1:
            # STATUS = IN PROGGRESS
            painter.setPen(QtGui.QColor(0,0,0,0))
            painter.setBrush(QtGui.QColor(255, 140, 30))
            startAngle = 90 * 16
            spanAngle = self.currentIndex() * 270 * 16
            painter.drawPie(pieRect, startAngle, spanAngle)
        elif self.currentIndex() == 2:
            # STATUS = FINISHED
            painter.setPen(QtGui.QColor(0,0,0,0))
            painter.setBrush(QtGui.QColor('darkGreen'))
            spanAngle = self.currentIndex() * 360 * 16
            painter.drawPie(pieRect, startAngle, spanAngle)
项目:nuke    作者:Kagarrache    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QtGui.QPainter(self)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        parent = self.parentWidget()

        pieRect = QtCore.QRect(1, 1, self.width()-2, self.height()-2)
        startAngle = 0 * 16

        if self.currentIndex() == 0:
            # STATUS = WAITING
            painter.drawEllipse(pieRect)
        elif self.currentIndex() == 1:
            # STATUS = IN PROGGRESS
            painter.setPen(QtGui.QColor(0,0,0,0))
            painter.setBrush(QtGui.QColor(255, 140, 30))
            startAngle = 90 * 16
            spanAngle = self.currentIndex() * 270 * 16
            painter.drawPie(pieRect, startAngle, spanAngle)
        elif self.currentIndex() == 2:
            # STATUS = FINISHED
            painter.setPen(QtGui.QColor(0,0,0,0))
            painter.setBrush(QtGui.QColor('darkGreen'))
            spanAngle = self.currentIndex() * 360 * 16
            painter.drawPie(pieRect, startAngle, spanAngle)
项目:FitScan    作者:GunfighterJ    | 项目源码 | 文件源码
def setupUi(self, Instructions):
        Instructions.setObjectName("Instructions")
        Instructions.setEnabled(True)
        Instructions.resize(400, 300)
        Instructions.setMinimumSize(QtCore.QSize(400, 300))
        Instructions.setMaximumSize(QtCore.QSize(400, 300))
        self.label = QtGui.QLabel(Instructions)
        self.label.setGeometry(QtCore.QRect(20, 10, 361, 271))
        self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.label.setWordWrap(True)
        self.label.setObjectName("label")
        self.pushButton_OK = QtGui.QPushButton(Instructions)
        self.pushButton_OK.setGeometry(QtCore.QRect(300, 260, 75, 23))
        self.pushButton_OK.setObjectName("pushButton_OK")

        self.retranslateUi(Instructions)
        QtCore.QMetaObject.connectSlotsByName(Instructions)
项目:xiboside    作者:ajiwo    | 项目源码 | 文件源码
def _populate_media(self):
        self._media_view = []

        for media in self._media:
            media['_layout_id'] = self._layout_id
            media['_schedule_id'] = self._schedule_id
            media['_region_id'] = self._id
            media['_save_dir'] = self._save_dir
            media['_geometry'] = QRect(
                int(float(self._left)), int(float(self._top)),
                int(float(self._width)), int(float(self._height))
            )
            view = MediaView.make(media, self._parent)
            view.finished_signal.connect(self.play_next)
            self._media_view.append(view)
            self._media_length += 1
        # for media ...
项目:BioNanoAnalyst    作者:AppliedBioinformatics    | 项目源码 | 文件源码
def setupUi(self, Manual):
        Manual.setObjectName(_fromUtf8("Manual"))
        Manual.resize(740, 450)
        Manual.setMinimumSize(QtCore.QSize(740, 450))
        Manual.setMaximumSize(QtCore.QSize(740, 450))
        self.textBrowser = QtGui.QTextBrowser(Manual)
        self.textBrowser.setGeometry(QtCore.QRect(10, 40, 721, 371))
        self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
        self.label = QtGui.QLabel(Manual)
        self.label.setGeometry(QtCore.QRect(10, 10, 271, 21))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))
        self.manual_bn = QtGui.QPushButton(Manual)
        self.manual_bn.setGeometry(QtCore.QRect(650, 420, 75, 23))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        self.manual_bn.setFont(font)
        self.manual_bn.setObjectName(_fromUtf8("manual_bn"))

        self.retranslateUi(Manual)
        QtCore.QMetaObject.connectSlotsByName(Manual)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtGui.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtGui.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtGui.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtGui.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtGui.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtGui.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtGui.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtGui.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtGui.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtGui.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:CaptsLog    作者:jaehoonhwang    | 项目源码 | 文件源码
def setupUi(self, MainWindow):
        """Setting up UI for Main Window
        """
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(804, 600)

        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName("horizontalLayout")

        self.txtInput = QtGui.QPlainTextEdit(self.centralwidget)
        self.txtInput.setObjectName("MarkDtextEdit")
        self.horizontalLayout.addWidget(self.txtInput)

        self.txtOutput = QtGui.QTextEdit(self.centralwidget)
        self.txtOutput.setObjectName("MarkDownView")
        self.horizontalLayout.addWidget(self.txtOutput)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 804, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
项目:CyclopsVFX-Unity    作者:geoffroygivry    | 项目源码 | 文件源码
def paintEvent(self, event):
        '''Paint the button grey if not highlighted, else yellow'''

        painter = QtGui.QPainter(self)
        colour = QtGui.QColor(247, 147, 30, 150)
        gradient = QtGui.QLinearGradient(QtCore.QPoint(0,0), QtCore.QPoint(self.width()/2, 0))
        gradient.setColorAt(0, QtCore.Qt.transparent)
        gradient.setColorAt(1, colour)
        gradient.setSpread(QtGui.QGradient.ReflectSpread)
        painter.setBrush(QtGui.QBrush(gradient))
        painter.setPen(QtCore.Qt.transparent)
        rect = QtCore.QRect(0,0,self.width(),self.height())
        painter.drawRect(rect)
项目:CyclopsVFX-Unity    作者:geoffroygivry    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QtGui.QPainter(self)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        currentIndex = self.currentIndex()
        painter.setPen(QtGui.QColor(0,0,0,0))

        if currentIndex == 0:
            progress =  .1
            if self.active or self.hasFocus():
                painter.setBrush(self.colWaiting.lighter())
            else:
                painter.setBrush(self.colWaiting)
        elif currentIndex == 1:
            progress = .6
            if self.active or self.hasFocus():
                painter.setBrush(self.colInProgress.lighter())
            else:
                painter.setBrush(self.colInProgress)
        elif currentIndex == 2:
            progress = 1
            if self.active or self.hasFocus():
                painter.setBrush(self.colFinished.lighter())
            else:
                painter.setBrush(self.colFinished)
        barRect = QtCore.QRect(0, self.height() * .25, (self.width()) * progress, self.height() * .5)
        painter.drawRect(barRect)

        outline = QtCore.QRect(1, self.height() * .25, (self.width())-2, self.height() * .5)
        painter.setBrush(QtGui.QColor(0,0,0,0))
        painter.setPen(QtGui.QColor(0,0,0,255))
        painter.drawRect(outline)
项目:Electrify    作者:jyapayne    | 项目源码 | 文件源码
def paintEvent(self, event=None):
        painter = QtGui.QPainter(self)
        if self.color is not None:
            painter.setBrush(QtGui.QBrush(self.color))
            rect = self.rect()
            margins = self.contentsMargins()
            new_rect = QtCore.QRect(rect.left()+margins.left(),
                                    rect.top()+margins.top(),
                                    rect.width()-margins.right()*2,
                                    rect.height()-margins.bottom()*2)
            painter.drawRect(new_rect)
项目:zeex    作者:zbarge    | 项目源码 | 文件源码
def setupUi(self, FileAnalyzerDialog):
        FileAnalyzerDialog.setObjectName("FileAnalyzerDialog")
        FileAnalyzerDialog.resize(904, 505)
        self.gridLayoutWidget = QtGui.QWidget(FileAnalyzerDialog)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 20, 881, 471))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.gridLayout_2 = QtGui.QGridLayout()
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.btnRefresh = QtGui.QPushButton(self.gridLayoutWidget)
        self.btnRefresh.setObjectName("btnRefresh")
        self.gridLayout_2.addWidget(self.btnRefresh, 1, 0, 1, 1)
        self.btnExport = QtGui.QPushButton(self.gridLayoutWidget)
        self.btnExport.setObjectName("btnExport")
        self.gridLayout_2.addWidget(self.btnExport, 0, 0, 1, 1)
        self.btnPivot = QtGui.QPushButton(self.gridLayoutWidget)
        self.btnPivot.setObjectName("btnPivot")
        self.gridLayout_2.addWidget(self.btnPivot, 2, 0, 1, 1)
        self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1)
        self.buttonBox = QtGui.QDialogButtonBox(self.gridLayoutWidget)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 1, 1, 1, 1)
        self.tableView = QtGui.QTableView(self.gridLayoutWidget)
        self.tableView.setObjectName("tableView")
        self.gridLayout.addWidget(self.tableView, 0, 1, 1, 1)

        self.retranslateUi(FileAnalyzerDialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), FileAnalyzerDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), FileAnalyzerDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(FileAnalyzerDialog)
项目:zeex    作者:zbarge    | 项目源码 | 文件源码
def setupUi(self, PushGridWidget):
        PushGridWidget.setObjectName("PushGridWidget")
        PushGridWidget.resize(302, 203)
        self.gridLayoutWidget_2 = QtGui.QWidget(PushGridWidget)
        self.gridLayoutWidget_2.setGeometry(QtCore.QRect(0, 0, 301, 201))
        self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2")
        self.pushGrid = QtGui.QGridLayout(self.gridLayoutWidget_2)
        self.pushGrid.setContentsMargins(0, 0, 0, 0)
        self.pushGrid.setObjectName("pushGrid")
        self.listViewLeft = QtGui.QListView(self.gridLayoutWidget_2)
        self.listViewLeft.setObjectName("listViewLeft")
        self.pushGrid.addWidget(self.listViewLeft, 0, 0, 1, 1)
        self.listViewRight = QtGui.QListView(self.gridLayoutWidget_2)
        self.listViewRight.setObjectName("listViewRight")
        self.pushGrid.addWidget(self.listViewRight, 0, 2, 1, 1)
        self.btnGrid = QtGui.QGridLayout()
        self.btnGrid.setObjectName("btnGrid")
        self.btnPushRight = QtGui.QPushButton(self.gridLayoutWidget_2)
        self.btnPushRight.setObjectName("btnPushRight")
        self.btnGrid.addWidget(self.btnPushRight, 0, 0, 1, 1)
        self.btnPushLeft = QtGui.QPushButton(self.gridLayoutWidget_2)
        self.btnPushLeft.setObjectName("btnPushLeft")
        self.btnGrid.addWidget(self.btnPushLeft, 1, 0, 1, 1)
        self.pushGrid.addLayout(self.btnGrid, 0, 1, 1, 1)

        self.retranslateUi(PushGridWidget)
        QtCore.QMetaObject.connectSlotsByName(PushGridWidget)
项目:zeex    作者:zbarge    | 项目源码 | 文件源码
def setupUi(self, LineEditDialog):
        LineEditDialog.setObjectName("LineEditDialog")
        LineEditDialog.resize(294, 112)
        self.verticalLayoutWidget = QtGui.QWidget(LineEditDialog)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 271, 91))
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
        self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtGui.QLabel(self.verticalLayoutWidget)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.lineEdit = QtGui.QLineEdit(self.verticalLayoutWidget)
        self.lineEdit.setObjectName("lineEdit")
        self.gridLayout.addWidget(self.lineEdit, 0, 1, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)
        self.buttonBox = QtGui.QDialogButtonBox(self.verticalLayoutWidget)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(LineEditDialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), LineEditDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), LineEditDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(LineEditDialog)
项目:zeex    作者:zbarge    | 项目源码 | 文件源码
def setupUi(self, DirectoryViewDialog):
        DirectoryViewDialog.setObjectName("DirectoryViewDialog")
        DirectoryViewDialog.resize(408, 337)
        self.gridLayoutWidget = QtGui.QWidget(DirectoryViewDialog)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(20, 20, 371, 301))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.gridLayout_2 = QtGui.QGridLayout()
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.btnRefresh = QtGui.QPushButton(self.gridLayoutWidget)
        self.btnRefresh.setObjectName("btnRefresh")
        self.gridLayout_2.addWidget(self.btnRefresh, 4, 0, 1, 1)
        self.btnUpload = QtGui.QPushButton(self.gridLayoutWidget)
        self.btnUpload.setObjectName("btnUpload")
        self.gridLayout_2.addWidget(self.btnUpload, 0, 0, 1, 1)
        self.btnDelete = QtGui.QPushButton(self.gridLayoutWidget)
        self.btnDelete.setObjectName("btnDelete")
        self.gridLayout_2.addWidget(self.btnDelete, 3, 0, 1, 1)
        self.btnDownload = QtGui.QPushButton(self.gridLayoutWidget)
        self.btnDownload.setObjectName("btnDownload")
        self.gridLayout_2.addWidget(self.btnDownload, 1, 0, 1, 1)
        self.btnAddFolder = QtGui.QPushButton(self.gridLayoutWidget)
        self.btnAddFolder.setObjectName("btnAddFolder")
        self.gridLayout_2.addWidget(self.btnAddFolder, 2, 0, 1, 1)
        self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1)
        self.treeView = QtGui.QTreeView(self.gridLayoutWidget)
        self.treeView.setObjectName("treeView")
        self.gridLayout.addWidget(self.treeView, 0, 1, 1, 1)
        self.buttonBox = QtGui.QDialogButtonBox(self.gridLayoutWidget)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 1, 1, 1, 1)

        self.retranslateUi(DirectoryViewDialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), DirectoryViewDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), DirectoryViewDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(DirectoryViewDialog)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def numberbarPaint(self, number_bar, event):
            font_metrics = self.fontMetrics()
            current_line = self.document().findBlock(self.textCursor().position()).blockNumber() + 1

            block = self.firstVisibleBlock()
            line_count = block.blockNumber()
            painter = QtGui.QPainter(number_bar)
            painter.fillRect(event.rect(), self.palette().base())

            # Iterate over all visible text blocks in the document.
            while block.isValid():
                line_count += 1
                block_top = self.blockBoundingGeometry(block).translated(self.contentOffset()).top()

                # Check if the position of the block is out side of the visible
                # area.
                if not block.isVisible() or block_top >= event.rect().bottom():
                    break

                # We want the line number for the selected line to be bold.
                if line_count == current_line:
                    font = painter.font()
                    font.setBold(True)
                    painter.setFont(font)
                else:
                    font = painter.font()
                    font.setBold(False)
                    painter.setFont(font)

                # Draw the line number right justified at the position of the line.
                paint_rect = QtCore.QRect(0, block_top, number_bar.width(), font_metrics.height())
                painter.drawText(paint_rect, QtCore.Qt.AlignRight, unicode(line_count))

                block = block.next()

            painter.end()
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def numberbarPaint(self, number_bar, event):
            font_metrics = self.fontMetrics()
            current_line = self.document().findBlock(self.textCursor().position()).blockNumber() + 1

            block = self.firstVisibleBlock()
            line_count = block.blockNumber()
            painter = QtGui.QPainter(number_bar)
            painter.fillRect(event.rect(), self.palette().base())

            # Iterate over all visible text blocks in the document.
            while block.isValid():
                line_count += 1
                block_top = self.blockBoundingGeometry(block).translated(self.contentOffset()).top()

                # Check if the position of the block is out side of the visible
                # area.
                if not block.isVisible() or block_top >= event.rect().bottom():
                    break

                # We want the line number for the selected line to be bold.
                if line_count == current_line:
                    font = painter.font()
                    font.setBold(True)
                    painter.setFont(font)
                else:
                    font = painter.font()
                    font.setBold(False)
                    painter.setFont(font)

                # Draw the line number right justified at the position of the line.
                paint_rect = QtCore.QRect(0, block_top, number_bar.width(), font_metrics.height())
                painter.drawText(paint_rect, QtCore.Qt.AlignRight, unicode(line_count))

                block = block.next()

            painter.end()
项目:nuke    作者:Kagarrache    | 项目源码 | 文件源码
def paintEvent(self, event):
        '''Paint the button grey if not highlighted, else yellow'''

        painter = QtGui.QPainter(self)
        colour = QtGui.QColor(247, 147, 30, 150)
        gradient = QtGui.QLinearGradient(QtCore.QPoint(0,0), QtCore.QPoint(self.width()/2, 0))
        gradient.setColorAt(0, QtCore.Qt.transparent)
        gradient.setColorAt(1, colour)
        gradient.setSpread(QtGui.QGradient.ReflectSpread)
        painter.setBrush(QtGui.QBrush(gradient))
        painter.setPen(QtCore.Qt.transparent)
        rect = QtCore.QRect(0,0,self.width(),self.height())
        painter.drawRect(rect)
项目:nuke    作者:Kagarrache    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QtGui.QPainter(self)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        currentIndex = self.currentIndex()
        painter.setPen(QtGui.QColor(0,0,0,0))

        if currentIndex == 0:
            progress =  .1
            if self.active or self.hasFocus():
                painter.setBrush(self.colWaiting.lighter())
            else:
                painter.setBrush(self.colWaiting)
        elif currentIndex == 1:
            progress = .6
            if self.active or self.hasFocus():
                painter.setBrush(self.colInProgress.lighter())
            else:
                painter.setBrush(self.colInProgress)
        elif currentIndex == 2:
            progress = 1
            if self.active or self.hasFocus():
                painter.setBrush(self.colFinished.lighter())
            else:
                painter.setBrush(self.colFinished)
        barRect = QtCore.QRect(0, self.height() * .25, (self.width()) * progress, self.height() * .5)
        painter.drawRect(barRect)

        outline = QtCore.QRect(1, self.height() * .25, (self.width())-2, self.height() * .5)
        painter.setBrush(QtGui.QColor(0,0,0,0))
        painter.setPen(QtGui.QColor(0,0,0,255))
        painter.drawRect(outline)
项目:freecad-nurbs    作者:microelly2    | 项目源码 | 文件源码
def setupUi(self, Zebra):
        Zebra.setObjectName(_fromUtf8("Zebra"))
        Zebra.resize(241, 302)
        self.verticalLayoutWidget = QtGui.QWidget(Zebra)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 221, 251))
        self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget"))
        self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.label = QtGui.QLabel(self.verticalLayoutWidget)
        self.label.setObjectName(_fromUtf8("label"))
        self.verticalLayout.addWidget(self.label, QtCore.Qt.AlignHCenter)
        self.horizontalSlider = QtGui.QSlider(self.verticalLayoutWidget)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setObjectName(_fromUtf8("horizontalSlider"))
        self.verticalLayout.addWidget(self.horizontalSlider)
        self.label_2 = QtGui.QLabel(self.verticalLayoutWidget)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.verticalLayout.addWidget(self.label_2, QtCore.Qt.AlignHCenter)
        self.horizontalSlider_2 = QtGui.QSlider(self.verticalLayoutWidget)
        self.horizontalSlider_2.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider_2.setObjectName(_fromUtf8("horizontalSlider_2"))
        self.verticalLayout.addWidget(self.horizontalSlider_2)
        self.label_3 = QtGui.QLabel(self.verticalLayoutWidget)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.verticalLayout.addWidget(self.label_3, QtCore.Qt.AlignHCenter)
        self.horizontalSlider_3 = QtGui.QSlider(self.verticalLayoutWidget)
        self.horizontalSlider_3.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider_3.setObjectName(_fromUtf8("horizontalSlider_3"))
        self.verticalLayout.addWidget(self.horizontalSlider_3)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.pushButton = QtGui.QPushButton(self.verticalLayoutWidget)
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.verticalLayout.addWidget(self.pushButton, QtCore.Qt.AlignHCenter)

        self.retranslateUi(Zebra)
#        QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("released()")), Zebra.close)
#        QtCore.QMetaObject.connectSlotsByName(Zebra)
项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def get_handle_for_mouse(self, pos):
        for n, handle in enumerate(self.model.all_handles()):
            if handle is None:
                continue
            # get the pix-wise BBOX of the handle
            p = self.im2V(handle)
            r = QtCore.QRect(p[0], p[1], 0, 0)
            r.adjust(-HANDLE_HALF_SIZE, -HANDLE_HALF_SIZE, HANDLE_HALF_SIZE, HANDLE_HALF_SIZE)

            # If event inside the bbox
            if r.contains(pos):
                return n
        return None
项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if len(args) == 2:
            self.width, self.height = args
        elif len(args) == 1 and isinstance(args[0], (QtCore.QRect, QtCore.QRectF)):
            self.width = args[0].width()
            self.width = args[0].height()
        elif len(args) == 1 and len(args[0]) == 2:
            self.width, self.height = args[0]
        elif len(kwargs) == 2 and "width" in kwargs and "height" in kwargs:
            self.width = kwargs["width"]
            self.height = kwards["height"]
        else:
            raise TypeError
项目:BioNanoAnalyst    作者:AppliedBioinformatics    | 项目源码 | 文件源码
def setupUi(self, About):
        About.setObjectName(_fromUtf8("About"))
        About.resize(378, 342)
        About.setMinimumSize(QtCore.QSize(378, 342))
        About.setMaximumSize(QtCore.QSize(378, 342))
        self.label = QtGui.QLabel(About)
        self.label.setGeometry(QtCore.QRect(10, 10, 191, 21))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))
        self.label_2 = QtGui.QLabel(About)
        self.label_2.setGeometry(QtCore.QRect(10, 30, 181, 21))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.label_2.setFont(font)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.label_3 = QtGui.QLabel(About)
        self.label_3.setGeometry(QtCore.QRect(10, 50, 211, 16))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        font.setPointSize(8)
        font.setItalic(False)
        self.label_3.setFont(font)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.label_4 = QtGui.QLabel(About)
        self.label_4.setGeometry(QtCore.QRect(10, 60, 261, 31))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        font.setPointSize(8)
        font.setItalic(False)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.textBrowser = QtGui.QTextBrowser(About)
        self.textBrowser.setGeometry(QtCore.QRect(10, 90, 361, 211))
        self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
        self.about_bn = QtGui.QPushButton(About)
        self.about_bn.setGeometry(QtCore.QRect(290, 310, 75, 23))
        self.about_bn.setObjectName(_fromUtf8("about_bn"))

        self.retranslateUi(About)
        QtCore.QMetaObject.connectSlotsByName(About)
项目:CaptsLog    作者:jaehoonhwang    | 项目源码 | 文件源码
def setupUi(self, Form):
        """Setting up Log in UI Form
        """
        Form.setObjectName("Form")
        Form.setFixedSize(400, 300)

        self.formLayoutWidget = QtGui.QWidget(Form)
        self.formLayoutWidget.setGeometry(QtCore.QRect(70, 110, 251, 71))
        self.formLayoutWidget.setObjectName("formLayoutWidget")

        self.formLayout = QtGui.QFormLayout(self.formLayoutWidget)
        self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setContentsMargins(0, 0, 0, 0)
        self.formLayout.setObjectName("formLayout")

        self.Username = QtGui.QLabel(self.formLayoutWidget)
        self.Username.setObjectName("Username")
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.Username)

        self.Password = QtGui.QLabel(self.formLayoutWidget)
        self.Password.setObjectName("Password")
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.Password)

        self.iUsername = QtGui.QLineEdit(self.formLayoutWidget)
        self.iUsername.setObjectName("iUsername")
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.iUsername)

        self.iPassword = QtGui.QLineEdit(self.formLayoutWidget)
        self.iPassword.setObjectName("iPassword")
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.iPassword)

        spacerItem = QtGui.QSpacerItem(
            20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.formLayout.setItem(1, QtGui.QFormLayout.LabelRole, spacerItem)

        self.Login = QtGui.QPushButton(Form)
        self.Login.setGeometry(QtCore.QRect(210, 220, 75, 23))
        self.Login.setObjectName("Login")

        self.Captslog = QtGui.QLabel(Form)
        self.Captslog.setGeometry(QtCore.QRect(90, 50, 221, 41))
        font = QtGui.QFont()
        font.setPointSize(30)
        font.setWeight(75)
        font.setBold(True)
        self.Captslog.setFont(font)
        self.Captslog.setObjectName("Captslog")

        self.ErrorMessage = QtGui.QLabel(Form)
        self.ErrorMessage.setGeometry(QtCore.QRect(120, 190, 151, 20))
        self.ErrorMessage.setText("")
        self.ErrorMessage.setAlignment(QtCore.Qt.AlignCenter)
        self.ErrorMessage.setObjectName("ErrorMessage")

        self.Signup = QtGui.QPushButton(Form)
        self.Signup.setGeometry(QtCore.QRect(100, 220, 75, 23))
        self.Signup.setObjectName("Signup")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:zeex    作者:zbarge    | 项目源码 | 文件源码
def setupUi(self, NewProjectDialog):
        NewProjectDialog.setObjectName("NewProjectDialog")
        NewProjectDialog.resize(514, 243)
        self.buttonBox = QtGui.QDialogButtonBox(NewProjectDialog)
        self.buttonBox.setGeometry(QtCore.QRect(50, 180, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.formLayoutWidget = QtGui.QWidget(NewProjectDialog)
        self.formLayoutWidget.setGeometry(QtCore.QRect(9, 40, 481, 111))
        self.formLayoutWidget.setObjectName("formLayoutWidget")
        self.formLayout = QtGui.QFormLayout(self.formLayoutWidget)
        self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setContentsMargins(0, 0, 0, 0)
        self.formLayout.setObjectName("formLayout")
        self.nameLabel = QtGui.QLabel(self.formLayoutWidget)
        self.nameLabel.setObjectName("nameLabel")
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.nameLabel)
        self.settingsFileLabel = QtGui.QLabel(self.formLayoutWidget)
        self.settingsFileLabel.setObjectName("settingsFileLabel")
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.settingsFileLabel)
        self.nameGridLayout = QtGui.QGridLayout()
        self.nameGridLayout.setObjectName("nameGridLayout")
        self.namePushButton = QtGui.QPushButton(self.formLayoutWidget)
        self.namePushButton.setObjectName("namePushButton")
        self.nameGridLayout.addWidget(self.namePushButton, 0, 1, 1, 1)
        self.nameLineEdit = QtGui.QLineEdit(self.formLayoutWidget)
        self.nameLineEdit.setObjectName("nameLineEdit")
        self.nameGridLayout.addWidget(self.nameLineEdit, 0, 0, 1, 1)
        self.formLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.nameGridLayout)
        self.settingsFileGridLayout = QtGui.QGridLayout()
        self.settingsFileGridLayout.setObjectName("settingsFileGridLayout")
        self.settingsFilePushButton = QtGui.QPushButton(self.formLayoutWidget)
        self.settingsFilePushButton.setObjectName("settingsFilePushButton")
        self.settingsFileGridLayout.addWidget(self.settingsFilePushButton, 0, 1, 1, 1)
        self.settingsFileLineEdit = QtGui.QLineEdit(self.formLayoutWidget)
        self.settingsFileLineEdit.setObjectName("settingsFileLineEdit")
        self.settingsFileGridLayout.addWidget(self.settingsFileLineEdit, 0, 0, 1, 1)
        self.formLayout.setLayout(1, QtGui.QFormLayout.FieldRole, self.settingsFileGridLayout)

        self.retranslateUi(NewProjectDialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), NewProjectDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), NewProjectDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(NewProjectDialog)
项目:twitterMonitor    作者:birolkuyumcu    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(823, 677)
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 10, 800, 400))
        self.label.setFrameShape(QtGui.QFrame.WinPanel)
        self.label.setText("")
        self.label.setObjectName("label")
        self.listWidget = QtGui.QListWidget(Dialog)
        self.listWidget.setGeometry(QtCore.QRect(10, 470, 801, 192))
        self.listWidget.setObjectName("listWidget")
        self.widget = QtGui.QWidget(Dialog)
        self.widget.setGeometry(QtCore.QRect(10, 429, 801, 25))
        self.widget.setObjectName("widget")
        self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_2 = QtGui.QLabel(self.widget)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.lineEdit = QtGui.QLineEdit(self.widget)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout.addWidget(self.lineEdit)
        self.pushButton = QtGui.QPushButton(self.widget)
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout.addWidget(self.pushButton)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        #
        self.pushButton.clicked.connect(self.on_buttom_pressed)
        self.listWidget.doubleClicked.connect(self.goTweet)

        #
        self.alText = u''
        self.fullText = u''
        self.twitter = Twitter(language='tr')
        self.prevId = None
        self.timer = QtCore.QTimer(Dialog)
        self.timer.timeout.connect(self.on_timer)
        self.dialog = Dialog
        self.twIds = []
项目:PyMail    作者:anshulshah96    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(1262, 529)
        self.user_email = QtGui.QLabel(Form)
        self.user_email.setGeometry(QtCore.QRect(1030, 20, 221, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(75)
        font.setBold(True)
        self.user_email.setFont(font)
        self.user_email.setObjectName("user_email")
        self.retrieve_button = QtGui.QPushButton(Form)
        self.retrieve_button.setGeometry(QtCore.QRect(10, 50, 103, 34))
        self.retrieve_button.setObjectName("retrieve_button")
        self.compose_button = QtGui.QPushButton(Form)
        self.compose_button.setGeometry(QtCore.QRect(140, 50, 103, 34))
        self.compose_button.setObjectName("compose_button")
        self.received_email = QtGui.QTableWidget(Form)
        self.received_email.setGeometry(QtCore.QRect(10, 90, 821, 431))
        self.received_email.setObjectName("received_email")
        self.received_email.setColumnCount(3)
        self.received_email.setRowCount(0)
        item = QtGui.QTableWidgetItem()
        self.received_email.setHorizontalHeaderItem(0, item)
        item = QtGui.QTableWidgetItem()
        self.received_email.setHorizontalHeaderItem(1, item)
        item = QtGui.QTableWidgetItem()
        self.received_email.setHorizontalHeaderItem(2, item)
        self.email_body = QtGui.QTextBrowser(Form)
        self.email_body.setGeometry(QtCore.QRect(840, 120, 411, 401))
        self.email_body.setObjectName("email_body")
        self.label = QtGui.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(930, 80, 91, 41))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(75)
        font.setBold(True)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.app_title = QtGui.QLabel(Form)
        self.app_title.setGeometry(QtCore.QRect(10, 0, 101, 41))
        font = QtGui.QFont()
        font.setPointSize(18)
        font.setWeight(75)
        font.setBold(True)
        self.app_title.setFont(font)
        self.app_title.setObjectName("app_title")
        self.showing_label = QtGui.QLabel(Form)
        self.showing_label.setGeometry(QtCore.QRect(560, 60, 271, 20))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setWeight(75)
        font.setBold(True)
        self.showing_label.setFont(font)
        self.showing_label.setObjectName("showing_label")
        self.open_browser = QtGui.QPushButton(Form)
        self.open_browser.setGeometry(QtCore.QRect(1100, 80, 151, 34))
        self.open_browser.setObjectName("open_browser")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)