python类red()的实例源码

launch_gui.py 文件源码 项目:spyking-circus 作者: spyking-circus 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def process_finished(self, exit_code):
        format = self.ui.edit_stdout.currentCharFormat()
        format.setFontWeight(QFont.Bold)
        if exit_code == 0:
            if self._interrupted:
                color = Qt.red
                msg = ('Process interrupted by user')
            else:
                color = Qt.green
                msg = ('Process exited normally')
        else:
            color = Qt.red
            msg = ('Process exited with exit code %d' % exit_code)
        format.setForeground(color)
        self.ui.edit_stdout.setCurrentCharFormat(format)
        self.ui.edit_stdout.appendPlainText(msg)
        self.restore_gui()
        self.ui.edit_stdout.setTextInteractionFlags(Qt.TextSelectableByMouse |
                                                    Qt.TextSelectableByKeyboard)
        self.process = None
        self.ui.btn_log.setEnabled(self.last_log_file is not None and
                                   os.path.isfile(self.last_log_file))
lab8.py 文件源码 项目:Computer-graphics 作者: Panda-Lewandowski 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def add_bars(win):
    if len(win.edges) == 0:
        QMessageBox.warning(win, "????????!", "?? ?????? ??????????!")
        return
    win.pen.setColor(red)
    w.lines.append([[win.edges[0].x() - 15, win.edges[0].y() - 15],
                    [win.edges[1].x() - 15, win.edges[1].y() - 15]])
    add_row(w.table_bars)
    i = w.table_bars.rowCount() - 1
    item_b = QTableWidgetItem("[{0}, {1}]".format(win.edges[0].x() - 15 , win.edges[0].y() - 15))
    item_e = QTableWidgetItem("[{0}, {1}]".format(win.edges[1].x() - 15, win.edges[1].y() - 15))
    w.table_bars.setItem(i, 0, item_b)
    w.table_bars.setItem(i, 1, item_e)
    w.scene.addLine(win.edges[0].x() - 15, win.edges[0].y() - 15, win.edges[1].x() - 15, win.edges[1].y() - 15, w.pen)

    win.pen.setColor(red)
    w.lines.append([[win.edges[0].x() + 15, win.edges[0].y() + 15],
                    [win.edges[1].x() + 15, win.edges[1].y() + 15]])
    add_row(w.table_bars)
    i = w.table_bars.rowCount() - 1
    item_b = QTableWidgetItem("[{0}, {1}]".format(win.edges[0].x() + 15, win.edges[0].y() + 15))
    item_e = QTableWidgetItem("[{0}, {1}]".format(win.edges[1].x() + 15, win.edges[1].y() + 15))
    w.table_bars.setItem(i, 0, item_b)
    w.table_bars.setItem(i, 1, item_e)
    w.scene.addLine(win.edges[0].x() + 15, win.edges[0].y() + 15, win.edges[1].x() + 15, win.edges[1].y() + 15, w.pen)
lab9.py 文件源码 项目:Computer-graphics 作者: Panda-Lewandowski 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def clipping(win):
    if len(win.clip) <= 1:
        QMessageBox.warning(win, "??????!", "?????????? ?? ?????!")

    if len(win.pol) <= 1:
        QMessageBox.warning(win, "??????!", "????????????? ?? ?????!")

    if len(win.pol) > 1 and len(win.clip) > 1:
        norm = isConvex(win.clip)
        if not norm:
            QMessageBox.warning(win, "??????!", "?????????? ?? ????????!???????? ?? ????? ???? ?????????!")
        else:
            p = sutherland_hodgman(win.clip, win.pol, norm)
            if p:
                win.pen.setWidth(2)
                win.pen.setColor(red)
                win.scene.addPolygon(p, win.pen)
                win.pen.setWidth(1)
lab7.py 文件源码 项目:Computer-graphics 作者: Panda-Lewandowski 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        QtWidgets.QWidget.__init__(self)
        uic.loadUi("window.ui", self)
        self.scene = Scene(0, 0, 561, 581)
        self.scene.win = self
        self.view.setScene(self.scene)
        self.image = QImage(561, 581, QImage.Format_ARGB32_Premultiplied)
        self.image.fill(Qt.white)
        self.bars.clicked.connect(lambda : set_bars(self))
        self.erase.clicked.connect(lambda: clean_all(self))
        self.paint.clicked.connect(lambda: clipping(self))
        self.rect.clicked.connect(lambda: set_rect(self))
        self.ect.clicked.connect(lambda: add_bars(self))
        self.lines = []
        self.clip = None
        self.point_now = None
        self.input_bars = False
        self.input_rect = False
        self.pen = QPen(red)
spreadsheetitem.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def data(self, role):
        if role in (Qt.EditRole, Qt.StatusTipRole):
            return self.formula()
        if role == Qt.DisplayRole:
            return self.display()
        t = str(self.display())
        try:
            number = int(t)
        except ValueError:
            number = None
        if role == Qt.TextColorRole:
            if number is None:
                return QColor(Qt.black)
            elif number < 0:
                return QColor(Qt.red)
            return QColor(Qt.blue)

        if role == Qt.TextAlignmentRole:
            if t and (t[0].isdigit() or t[0] == '-'):
                return Qt.AlignRight | Qt.AlignVCenter
        return super(SpreadSheetItem, self).data(role)
schema.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def moveCursor(self, line, column):
        self.instanceEdit.moveCursor(QTextCursor.Start)

        for i in range(1, line):
            self.instanceEdit.moveCursor(QTextCursor.Down)

        for i in range(1, column):
            self.instanceEdit.moveCursor(QTextCursor.Right)

        extraSelections = []
        selection = QTextEdit.ExtraSelection()

        lineColor = QColor(Qt.red).lighter(160)
        selection.format.setBackground(lineColor)
        selection.format.setProperty(QTextFormat.FullWidthSelection, True)
        selection.cursor = self.instanceEdit.textCursor()
        selection.cursor.clearSelection()
        extraSelections.append(selection)

        self.instanceEdit.setExtraSelections(extraSelections)

        self.instanceEdit.setFocus()
calendarwidget.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def reformatCalendarPage(self):
        if self.firstFridayCheckBox.isChecked():
            firstFriday = QDate(self.calendar.yearShown(),
                    self.calendar.monthShown(), 1)

            while firstFriday.dayOfWeek() != Qt.Friday:
                firstFriday = firstFriday.addDays(1)

            firstFridayFormat = QTextCharFormat()
            firstFridayFormat.setForeground(Qt.blue)

            self.calendar.setDateTextFormat(firstFriday, firstFridayFormat)

        # May 1st in Red takes precedence.
        if self.mayFirstCheckBox.isChecked():
            mayFirst = QDate(self.calendar.yearShown(), 5, 1)

            mayFirstFormat = QTextCharFormat()
            mayFirstFormat.setForeground(Qt.red)

            self.calendar.setDateTextFormat(mayFirst, mayFirstFormat)
camera.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def updateLockStatus(self, status, reason):
        indicationColor = Qt.black

        if status == QCamera.Searching:
            self.ui.statusbar.showMessage("Focusing...")
            self.ui.lockButton.setText("Focusing...")
            indicationColor = Qt.yellow
        elif status == QCamera.Locked:
            self.ui.lockButton.setText("Unlock")
            self.ui.statusbar.showMessage("Focused", 2000)
            indicationColor = Qt.darkGreen
        elif status == QCamera.Unlocked:
            self.ui.lockButton.setText("Focus")

            if reason == QCamera.LockFailed:
                self.ui.statusbar.showMessage("Focus Failed", 2000)
                indicationColor = Qt.red

        palette = self.ui.lockButton.palette()
        palette.setColor(QPalette.ButtonText, indicationColor)
        self.ui.lockButton.setPalette(palette)
spreadsheetitem.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def data(self, role):
        if role in (Qt.EditRole, Qt.StatusTipRole):
            return self.formula()
        if role == Qt.DisplayRole:
            return self.display()
        t = str(self.display())
        try:
            number = int(t)
        except ValueError:
            number = None
        if role == Qt.TextColorRole:
            if number is None:
                return QColor(Qt.black)
            elif number < 0:
                return QColor(Qt.red)
            return QColor(Qt.blue)

        if role == Qt.TextAlignmentRole:
            if t and (t[0].isdigit() or t[0] == '-'):
                return Qt.AlignRight | Qt.AlignVCenter
        return super(SpreadSheetItem, self).data(role)
schema.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def moveCursor(self, line, column):
        self.instanceEdit.moveCursor(QTextCursor.Start)

        for i in range(1, line):
            self.instanceEdit.moveCursor(QTextCursor.Down)

        for i in range(1, column):
            self.instanceEdit.moveCursor(QTextCursor.Right)

        extraSelections = []
        selection = QTextEdit.ExtraSelection()

        lineColor = QColor(Qt.red).lighter(160)
        selection.format.setBackground(lineColor)
        selection.format.setProperty(QTextFormat.FullWidthSelection, True)
        selection.cursor = self.instanceEdit.textCursor()
        selection.cursor.clearSelection()
        extraSelections.append(selection)

        self.instanceEdit.setExtraSelections(extraSelections)

        self.instanceEdit.setFocus()
calendarwidget.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def reformatCalendarPage(self):
        if self.firstFridayCheckBox.isChecked():
            firstFriday = QDate(self.calendar.yearShown(),
                    self.calendar.monthShown(), 1)

            while firstFriday.dayOfWeek() != Qt.Friday:
                firstFriday = firstFriday.addDays(1)

            firstFridayFormat = QTextCharFormat()
            firstFridayFormat.setForeground(Qt.blue)

            self.calendar.setDateTextFormat(firstFriday, firstFridayFormat)

        # May 1st in Red takes precedence.
        if self.mayFirstCheckBox.isChecked():
            mayFirst = QDate(self.calendar.yearShown(), 5, 1)

            mayFirstFormat = QTextCharFormat()
            mayFirstFormat.setForeground(Qt.red)

            self.calendar.setDateTextFormat(mayFirst, mayFirstFormat)
camera.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def updateLockStatus(self, status, reason):
        indicationColor = Qt.black

        if status == QCamera.Searching:
            self.ui.statusbar.showMessage("Focusing...")
            self.ui.lockButton.setText("Focusing...")
            indicationColor = Qt.yellow
        elif status == QCamera.Locked:
            self.ui.lockButton.setText("Unlock")
            self.ui.statusbar.showMessage("Focused", 2000)
            indicationColor = Qt.darkGreen
        elif status == QCamera.Unlocked:
            self.ui.lockButton.setText("Focus")

            if reason == QCamera.LockFailed:
                self.ui.statusbar.showMessage("Focus Failed", 2000)
                indicationColor = Qt.red

        palette = self.ui.lockButton.palette()
        palette.setColor(QPalette.ButtonText, indicationColor)
        self.ui.lockButton.setPalette(palette)
seat_angle_main.py 文件源码 项目:Osdag 作者: osdag-admin 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def color_oldDB_sections(self, old_section, intg_section, combo_section):
        """display old sections in red color.

        Args:
            old_section(str): Old sections from IS 808 1984
            intg_section(str): Revised sections from IS 808 2007
            combo_section(QcomboBox): Beam/Column dropdown list

        Returns:

        """
        for col in old_section:
            if col in intg_section:
                indx = intg_section.index(str(col))
                combo_section.setItemData(indx, QBrush(QColor("red")), Qt.TextColorRole)

        duplicate = [i for i, x in enumerate(intg_section) if intg_section.count(x) > 1]
        for i in duplicate:
            combo_section.setItemData(i, QBrush(QColor("red")), Qt.TextColorRole)
seat_angle_main.py 文件源码 项目:Osdag 作者: osdag-admin 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def check_range(self, widget, lblwidget, min_value, max_value):
        """(QlineEdit, QLabel, Number, Number)---> NoneType
        Validating F_u(ultimate Strength) and F_y (Yield Strength) textfields
        """
        textStr = widget.text()
        val = int(textStr)
        if val < min_value or val > max_value:
            QMessageBox.about(self, 'Error', 'Please Enter a value between %s-%s' % (min_value, max_value))
            widget.clear()
            widget.setFocus()
            palette = QPalette()
            palette.setColor(QPalette.Foreground, Qt.red)
            lblwidget.setPalette(palette)
        else:
            palette = QPalette()
            lblwidget.setPalette(palette)
finPlateMain.py 文件源码 项目:Osdag 作者: osdag-admin 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def color_oldDB_sections(self, old_section, intg_section, combo_section):
        """display old sections in red color.

        Args:
            old_section(str): Old sections from IS 808 1984
            intg_section(str): Revised sections from IS 808 2007
            combo_section(QcomboBox): Beam/Column dropdown list

        Returns:

        """
        for col in old_section:
            if col in intg_section:
                indx = intg_section.index(str(col))
                combo_section.setItemData(indx, QBrush(QColor("red")), Qt.TextColorRole)

        duplicate = [i for i, x in enumerate(intg_section) if intg_section.count(x) > 1]
        for i in duplicate:
            combo_section.setItemData(i, QBrush(QColor("red")), Qt.TextColorRole)
endPlateMain.py 文件源码 项目:Osdag 作者: osdag-admin 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def color_oldDB_sections(self, old_section, intg_section, combo_section):
        """display old sections in red color.

        Args:
            old_section(str): Old sections from IS 808 1984
            intg_section(str): Revised sections from IS 808 2007
            combo_section(QcomboBox): Beam/Column dropdown list

        Returns:

        """
        for col in old_section:
            if col in intg_section:
                indx = intg_section.index(str(col))
                combo_section.setItemData(indx, QBrush(QColor("red")), Qt.TextColorRole)

        duplicate = [i for i, x in enumerate(intg_section) if intg_section.count(x) > 1]
        for i in duplicate:
            combo_section.setItemData(i, QBrush(QColor("red")), Qt.TextColorRole)
endPlateMain.py 文件源码 项目:Osdag 作者: osdag-admin 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def check_range(self, widget, lblwidget, min_val, max_val):

        '''(QlineEdit,QLable,Number,Number)---> NoneType
        Validating F_u(ultimate Strength) and F_y (Yeild Strength) textfields
        '''
        text_str = widget.text()
        val = int(text_str)
        if(val < min_val or val > max_val):
            QMessageBox.about(self, 'Error', 'Please Enter a value between %s-%s' % (min_val, max_val))
            widget.clear()
            widget.setFocus()
            palette = QPalette()
            palette.setColor(QPalette.Foreground, Qt.red)
            lblwidget.setPalette(palette)
        else:
            palette = QPalette()
            lblwidget.setPalette(palette)
cleatAngleMain.py 文件源码 项目:Osdag 作者: osdag-admin 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def color_oldDB_sections(self, old_section, intg_section, combo_section):
        """display old sections in red color.

        Args:
            old_section(str): Old sections from IS 808 1984
            intg_section(str): Revised sections from IS 808 2007
            combo_section(QcomboBox): Beam/Column dropdown list

        Returns:

        """
        for col in old_section:
            if col in intg_section:
                indx = intg_section.index(str(col))
                combo_section.setItemData(indx, QBrush(QColor("red")), Qt.TextColorRole)
        duplicate = [i for i, x in enumerate(intg_section) if intg_section.count(x) > 1]
        for i in duplicate:
            combo_section.setItemData(i, QBrush(QColor("red")), Qt.TextColorRole)
spreadsheetitem.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def data(self, role):
        if role in (Qt.EditRole, Qt.StatusTipRole):
            return self.formula()
        if role == Qt.DisplayRole:
            return self.display()
        t = str(self.display())
        try:
            number = int(t)
        except ValueError:
            number = None
        if role == Qt.TextColorRole:
            if number is None:
                return QColor(Qt.black)
            elif number < 0:
                return QColor(Qt.red)
            return QColor(Qt.blue)

        if role == Qt.TextAlignmentRole:
            if t and (t[0].isdigit() or t[0] == '-'):
                return Qt.AlignRight | Qt.AlignVCenter
        return super(SpreadSheetItem, self).data(role)
schema.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def moveCursor(self, line, column):
        self.instanceEdit.moveCursor(QTextCursor.Start)

        for i in range(1, line):
            self.instanceEdit.moveCursor(QTextCursor.Down)

        for i in range(1, column):
            self.instanceEdit.moveCursor(QTextCursor.Right)

        extraSelections = []
        selection = QTextEdit.ExtraSelection()

        lineColor = QColor(Qt.red).lighter(160)
        selection.format.setBackground(lineColor)
        selection.format.setProperty(QTextFormat.FullWidthSelection, True)
        selection.cursor = self.instanceEdit.textCursor()
        selection.cursor.clearSelection()
        extraSelections.append(selection)

        self.instanceEdit.setExtraSelections(extraSelections)

        self.instanceEdit.setFocus()
i18n.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.centralWidget = QWidget()
        self.setCentralWidget(self.centralWidget)

        self.createGroupBox()

        listWidget = QListWidget()

        for le in MainWindow.listEntries:
            listWidget.addItem(self.tr(le))

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.groupBox)
        mainLayout.addWidget(listWidget)
        self.centralWidget.setLayout(mainLayout)

        exitAction = QAction(self.tr("E&xit"), self,
                triggered=QApplication.instance().quit)

        fileMenu = self.menuBar().addMenu(self.tr("&File"))
        fileMenu.setPalette(QPalette(Qt.red))
        fileMenu.addAction(exitAction)

        self.setWindowTitle(self.tr("Language: %s") % self.tr("English"))
        self.statusBar().showMessage(self.tr("Internationalization Example"))

        if self.tr("LTR") == "RTL":
            self.setLayoutDirection(Qt.RightToLeft)
calendarwidget.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def reformatCalendarPage(self):
        if self.firstFridayCheckBox.isChecked():
            firstFriday = QDate(self.calendar.yearShown(),
                    self.calendar.monthShown(), 1)

            while firstFriday.dayOfWeek() != Qt.Friday:
                firstFriday = firstFriday.addDays(1)

            firstFridayFormat = QTextCharFormat()
            firstFridayFormat.setForeground(Qt.blue)

            self.calendar.setDateTextFormat(firstFriday, firstFridayFormat)

        # May 1st in Red takes precedence.
        if self.mayFirstCheckBox.isChecked():
            mayFirst = QDate(self.calendar.yearShown(), 5, 1)

            mayFirstFormat = QTextCharFormat()
            mayFirstFormat.setForeground(Qt.red)

            self.calendar.setDateTextFormat(mayFirst, mayFirstFormat)
camera.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def updateLockStatus(self, status, reason):
        indicationColor = Qt.black

        if status == QCamera.Searching:
            self.ui.statusbar.showMessage("Focusing...")
            self.ui.lockButton.setText("Focusing...")
            indicationColor = Qt.yellow
        elif status == QCamera.Locked:
            self.ui.lockButton.setText("Unlock")
            self.ui.statusbar.showMessage("Focused", 2000)
            indicationColor = Qt.darkGreen
        elif status == QCamera.Unlocked:
            self.ui.lockButton.setText("Focus")

            if reason == QCamera.LockFailed:
                self.ui.statusbar.showMessage("Focus Failed", 2000)
                indicationColor = Qt.red

        palette = self.ui.lockButton.palette()
        palette.setColor(QPalette.ButtonText, indicationColor)
        self.ui.lockButton.setPalette(palette)
launch_gui.py 文件源码 项目:spyking-circus 作者: spyking-circus 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def process_errored(self):
        try:
            exit_code = self.process.exitCode()
        except Exception:
            exit_code = 0
        format = self.ui.edit_stdout.currentCharFormat()
        format.setFontWeight(QFont.Bold)
        format.setForeground(Qt.red)
        self.ui.edit_stdout.setCurrentCharFormat(format)
        self.ui.edit_stdout.appendPlainText('Process exited with exit code' % exit_code)
        self.restore_gui()
        self.ui.edit_stdout.setTextInteractionFlags(Qt.TextSelectableByMouse |
                                                    Qt.TextSelectableByKeyboard)
        self.process = None
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def initUI(self):

        # QToolTip.setFont(QFont('SansSerif', 9))

        self.cwidget = GUICenterWidget()
        self.setCentralWidget(self.cwidget)

        # self.setToolTip('This is a <b>QWidget</b> widget')

        self.statusBar().showMessage('Ready')

        self.center()
        self.setWindowTitle('Coliform Control GUI')

        self.onewiretimer = QTimer(self)
        self.onewiretimer.timeout.connect(self.cwidget.onewireOn)
        self.onewiretimer.start(1000)

        # self.p = QPalette(self.palette())
        # self.p.setColor(QPalette.Window, QColor(53, 53, 53))
        # self.p.setColor(QPalette.WindowText, Qt.white)
        # self.p.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ToolTipBase, Qt.white)
        # self.p.setColor(QPalette.ToolTipText, Qt.white)
        # self.p.setColor(QPalette.Button, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ButtonText, Qt.white)
        # self.p.setColor(QPalette.BrightText, Qt.red)
        # self.p.setColor(QPalette.Highlight, QColor(142, 45, 197).lighter())
        # self.p.setColor(QPalette.HighlightedText, Qt.black)
        # self.setPalette(self.p)

        self.show()
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def initUI(self):

        # QToolTip.setFont(QFont('SansSerif', 9))

        self.cwidget = CameraCenterWidget()
        self.setCentralWidget(self.cwidget)

        # self.setToolTip('This is a <b>QWidget</b> widget')

        self.center()
        self.setWindowTitle('Camera Control GUI')

        self.statusBarTimer = QTimer(self)
        self.statusBarTimer.timeout.connect(self.statusUpdate)
        self.statusBarTimer.start(100)

        # self.p = QPalette(self.palette())
        # self.p.setColor(QPalette.Window, QColor(53, 53, 53))
        # self.p.setColor(QPalette.WindowText, Qt.white)
        # self.p.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ToolTipBase, Qt.white)
        # self.p.setColor(QPalette.ToolTipText, Qt.white)
        # self.p.setColor(QPalette.Button, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ButtonText, Qt.white)
        # self.p.setColor(QPalette.BrightText, Qt.red)
        # self.p.setColor(QPalette.Highlight, QColor(142, 45, 197).lighter())
        # self.p.setColor(QPalette.HighlightedText, Qt.black)
        # self.setPalette(self.p)

        self.show()
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def initUI(self):

        # QToolTip.setFont(QFont('SansSerif', 9))

        self.cwidget = RGBCenterWidget()
        self.setCentralWidget(self.cwidget)

        # self.setToolTip('This is a <b>QWidget</b> widget')

        self.center()
        self.setWindowTitle('RGB Sensor GUI')

        self.statusBarTimer = QTimer(self)
        self.statusBarTimer.timeout.connect(self.statusUpdate)
        self.statusBarTimer.start(100)

        # self.p = QPalette(self.palette())
        # self.p.setColor(QPalette.Window, QColor(53, 53, 53))
        # self.p.setColor(QPalette.WindowText, Qt.white)
        # self.p.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ToolTipBase, Qt.white)
        # self.p.setColor(QPalette.ToolTipText, Qt.white)
        # self.p.setColor(QPalette.Button, QColor(53, 53, 53))
        # self.p.setColor(QPalette.ButtonText, Qt.white)
        # self.p.setColor(QPalette.BrightText, Qt.red)
        # self.p.setColor(QPalette.Highlight, QColor(142, 45, 197).lighter())
        # self.p.setColor(QPalette.HighlightedText, Qt.black)
        # self.setPalette(self.p)

        self.show()
__init__.py 文件源码 项目:binja_dynamics 作者: nccgroup 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def highlight_bytes_at_address(self, segment, address, length, color=Qt.red, name="*"):
        """ Helper function for highlighting """
        self.get_widget(segment).highlight_address(address, length, color, name)
__init__.py 文件源码 项目:binja_dynamics 作者: nccgroup 项目源码 文件源码 阅读 59 收藏 0 点赞 0 评论 0
def highlight_instr_pointer(self, ip):
        """ Removes old instruction pointer highlights and creates a new one """
        if self.instr_pointer is not None:
            self.get_widget('stack').clear_highlight(self.instr_pointer)
        self.highlight_bytes_at_address('stack', ip, 1, Qt.red)
        self.instr_pointer = ip
radar.py 文件源码 项目:echolocation 作者: hgross 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _add_latest_input_line(self, angle):
        """Adds a line to the graphic scene that visualizes a scanned angle"""
        mx, my = self._get_middle()
        angle_rad = deg2rad(angle)
        angle_1_rad = deg2rad(angle - self.measurement_angle/2.0)
        angle_2_rad = deg2rad(angle + self.measurement_angle/2.0)
        length = max(self.width(), self.height())

        start_point = (mx, my)
        p1 = (mx + length * math.cos(angle_1_rad), my + length * math.sin(angle_1_rad))
        p2 = (mx + length * math.cos(angle_2_rad), my + length * math.sin(angle_2_rad))

        gradient_start_point, gradient_end_point = (mx, my), (mx + length * math.cos(angle_rad), my + length * math.sin(angle_rad))
        gradient = QLinearGradient(*gradient_start_point, *gradient_end_point)
        gradient.setColorAt(0, Qt.transparent)
        gradient.setColorAt(0.8, Qt.red)
        gradient.setColorAt(1, Qt.darkRed)

        triangle = QPolygonF()
        triangle.append(QPointF(*start_point))
        triangle.append(QPointF(*p1))
        triangle.append(QPointF(*p2))
        triangle.append(QPointF(*start_point))

        self.scene.addPolygon(triangle, pen=QPen(Qt.transparent), brush=QBrush(gradient))


问题


面经


文章

微信
公众号

扫码关注公众号