当前位置: 首页>>代码示例>>Python>>正文


Python QPalette.Text方法代码示例

本文整理汇总了Python中PyQt5.QtGui.QPalette.Text方法的典型用法代码示例。如果您正苦于以下问题:Python QPalette.Text方法的具体用法?Python QPalette.Text怎么用?Python QPalette.Text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtGui.QPalette的用法示例。


在下文中一共展示了QPalette.Text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def __init__(self):
        super(VideoStyleLight, self).__init__()
        palette = qApp.palette()
        palette.setColor(QPalette.Window, QColor(239, 240, 241))
        palette.setColor(QPalette.WindowText, QColor(49, 54, 59))
        palette.setColor(QPalette.Base, QColor(252, 252, 252))
        palette.setColor(QPalette.AlternateBase, QColor(239, 240, 241))
        palette.setColor(QPalette.ToolTipBase, QColor(239, 240, 241))
        palette.setColor(QPalette.ToolTipText, QColor(49, 54, 59))
        palette.setColor(QPalette.Text, QColor(49, 54, 59))
        palette.setColor(QPalette.Button, QColor(239, 240, 241))
        palette.setColor(QPalette.ButtonText, QColor(49, 54, 59))
        palette.setColor(QPalette.BrightText, QColor(255, 255, 255))
        palette.setColor(QPalette.Link, QColor(41, 128, 185))
        # palette.setColor(QPalette.Highlight, QColor(126, 71, 130))
        # palette.setColor(QPalette.HighlightedText, Qt.white)
        palette.setColor(QPalette.Disabled, QPalette.Light, Qt.white)
        palette.setColor(QPalette.Disabled, QPalette.Shadow, QColor(234, 234, 234))
        qApp.setPalette(palette) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:21,代码来源:videostyle.py

示例2: paint

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def paint(self, painter, option, index):
        super().paint(painter, option, index)

        # draw a line under each row
        text_color = option.palette.color(QPalette.Text)
        if text_color.lightness() > 150:
            non_text_color = text_color.darker(140)
        else:
            non_text_color = text_color.lighter(150)
        non_text_color.setAlpha(30)
        pen = QPen(non_text_color)
        painter.setPen(pen)
        bottom_left = option.rect.bottomLeft()
        bottom_right = option.rect.bottomRight()
        if index.model().columnCount() - 1 == index.column():
            bottom_right = QPoint(bottom_right.x() - 10, bottom_right.y())
        if index.column() == 0:
            bottom_left = QPoint(bottom_left.x() + 10, bottom_right.y())
        painter.drawLine(bottom_left, bottom_right) 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:21,代码来源:songs.py

示例3: openFileFromMenu

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def openFileFromMenu(self):
        options = QFileDialog.Options()

        filenames, _ = QFileDialog.getOpenFileNames(
            self,
            "Open a file",
            "",
            "All Files (*);;Python Files (*.py);;Text Files (*.txt)",
            options=options,
        )

        if filenames:  # If file is selected, we can open it
            filename = filenames[0]
            if filename[-3:] in ["gif", "png", "jpg", "bmp"] or filename[-4:] in [
                "jpeg"
            ]:
                self.pic_opened = True
            self.cleanOpen(filename, self.pic_opened) 
开发者ID:CountryTk,项目名称:Hydra,代码行数:20,代码来源:main.py

示例4: dark_theme

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def dark_theme(app: QApplication):
    app.setStyle('Fusion')
    style = os.path.abspath("assets/styles/dark/style.css")
    with open(style, "r") as f:
        app.setStyleSheet(f.read())
    palette = QPalette()
    palette.setColor(QPalette.Window, QColor(0, 0, 0))
    palette.setColor(QPalette.WindowText, QtCore.Qt.white)
    palette.setColor(QPalette.Base, QColor(15, 15, 15))
    palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
    palette.setColor(QPalette.ToolTipBase, QtCore.Qt.white)
    palette.setColor(QPalette.ToolTipText, QtCore.Qt.white)
    palette.setColor(QPalette.Text, QtCore.Qt.white)
    palette.setColor(QPalette.Button, QColor(20, 20, 20))
    palette.setColor(QPalette.ButtonText, QtCore.Qt.white)
    palette.setColor(QPalette.BrightText, QtCore.Qt.red)
    palette.setColor(QPalette.Highlight, QColor(239, 74, 40).lighter())
    palette.setColor(QPalette.HighlightedText, QtCore.Qt.black)
    app.setPalette(palette) 
开发者ID:haruiz,项目名称:CvStudio,代码行数:21,代码来源:cvstudio.py

示例5: cvstudio_theme

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def cvstudio_theme(app: QApplication):
    app.setStyle('Fusion')
    app.setStyle('Fusion')
    style = os.path.abspath("assets/styles/cvstudio/style.css")
    with open(style, "r") as f:
        app.setStyleSheet(f.read())
    palette = QPalette()
    palette.setColor(QPalette.Window, QColor(0, 0, 0))
    palette.setColor(QPalette.WindowText, QtCore.Qt.white)
    palette.setColor(QPalette.Base, QColor(15, 15, 15))
    palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
    palette.setColor(QPalette.ToolTipBase, QtCore.Qt.white)
    palette.setColor(QPalette.ToolTipText, QtCore.Qt.white)
    palette.setColor(QPalette.Text, QtCore.Qt.white)
    palette.setColor(QPalette.Button, QColor(20, 20, 20))
    palette.setColor(QPalette.ButtonText, QtCore.Qt.white)
    palette.setColor(QPalette.BrightText, QtCore.Qt.red)
    palette.setColor(QPalette.Highlight, QColor(169, 3, 252).lighter())
    palette.setColor(QPalette.HighlightedText, QtCore.Qt.black)
    app.setPalette(palette) 
开发者ID:haruiz,项目名称:CvStudio,代码行数:22,代码来源:cvstudio.py

示例6: onSave

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def onSave(self):
        if self.ui.signatureTextEdt.document().isEmpty():
            mess = "Nothing to save. Sign message first."
            myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - no signature', mess)
            return
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getSaveFileName(self.main_wnd, "Save signature to file", "sig.txt",
                                                  "All Files (*);; Text Files (*.txt)", options=options)
        try:
            if fileName:
                save_file = open(fileName, 'w')
                save_file.write(self.ui.signatureTextEdt.toPlainText())
                save_file.close()
                myPopUp_sb(self.main_wnd, QMessageBox.Information, 'SPMT - saved', "Signature saved to file")
                return
        except Exception as e:
            err_msg = "error writing signature to file"
            printException(getCallerName(), getFunctionName(), err_msg, e.args)
        myPopUp_sb(self.main_wnd, QMessageBox.Warning, 'SPMT - NOT saved', "Signature NOT saved to file") 
开发者ID:PIVX-Project,项目名称:PIVX-SPMT,代码行数:22,代码来源:dlg_signmessage.py

示例7: onSaveConsole

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def onSaveConsole(self):
        timestamp = strftime('%Y-%m-%d_%H-%M-%S', gmtime(now()))
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getSaveFileName(self,"Save Logs to file","SPMT_Logs_%s.txt" % timestamp,"All Files (*);; Text Files (*.txt)", options=options)
        try:
            if fileName:
                printOK("Saving logs to %s" % fileName)
                log_file = open(fileName, 'w+')
                log_text = self.consoleArea.toPlainText()
                log_file.write(log_text)
                log_file.close()

        except Exception as e:
            err_msg = "error writing Log file"
            printException(getCallerName(), getFunctionName(), err_msg, e.args) 
开发者ID:PIVX-Project,项目名称:PIVX-SPMT,代码行数:18,代码来源:mainWindow.py

示例8: __init__

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def __init__(self):
        application = QtWidgets.QApplication(sys.argv)
        application.processEvents()
        loginWindow = client.LoginWindow()
        if settings.darkMode:
            application.setStyle("Fusion")
            palette = QPalette()
            palette.setColor(QPalette.Window, QColor(53, 53, 53))
            palette.setColor(QPalette.WindowText, QColor(255, 255, 255))
            palette.setColor(QPalette.Base, QColor(25, 25, 25))
            palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
            palette.setColor(QPalette.ToolTipBase, QColor(255, 255, 255))
            palette.setColor(QPalette.ToolTipText, QColor(255, 255, 255))
            palette.setColor(QPalette.Text, QColor(255, 255, 255))
            palette.setColor(QPalette.Button, QColor(53, 53, 53))
            palette.setColor(QPalette.ButtonText, QColor(255, 255, 255))
            palette.setColor(QPalette.BrightText, QColor(255, 0, 0))
            palette.setColor(QPalette.Link, QColor(42, 130, 218))
            palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
            palette.setColor(QPalette.HighlightedText, QColor(0, 0, 0))
            application.setPalette(palette)
        loginWindow.show()


        #new = rawscriptsmenu.ScriptsMenu()
        #new.show()
        sys.exit(application.exec_())
        client.safeDisconnect() 
开发者ID:HA6Bots,项目名称:Automatic-Youtube-Reddit-Text-To-Speech-Video-Generator-and-Uploader,代码行数:30,代码来源:init.py

示例9: main

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def main():

    app = QApplication(sys.argv)
    app.setStyle(QtWidgets.QStyleFactory.create("Fusion"))
    p = app.palette()
    p.setColor(QPalette.Base, QColor(40, 40, 40))
    p.setColor(QPalette.Window, QColor(55, 55, 55))
    p.setColor(QPalette.Button, QColor(49, 49, 49))
    p.setColor(QPalette.Highlight, QColor(135, 135, 135))
    p.setColor(QPalette.ButtonText, QColor(155, 155, 155))
    p.setColor(QPalette.WindowText, QColor(155, 155, 155))
    p.setColor(QPalette.Text, QColor(155, 155, 155))
    p.setColor(QPalette.Disabled, QPalette.Base, QColor(49, 49, 49))
    p.setColor(QPalette.Disabled, QPalette.Text, QColor(90, 90, 90))
    p.setColor(QPalette.Disabled, QPalette.Button, QColor(42, 42, 42))
    p.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90))
    p.setColor(QPalette.Disabled, QPalette.Window, QColor(49, 49, 49))
    p.setColor(QPalette.Disabled, QPalette.WindowText, QColor(90, 90, 90))
    app.setPalette(p)
    QApplication.addLibraryPath(QApplication.applicationDirPath() + "/../PlugIns")
    main = Window()
    main.setWindowTitle('Detection')
    main.setWindowIcon(QtGui.QIcon('assets/icon.png'))
    main.show()
    try:
        sys.exit(app.exec_())
    except KeyboardInterrupt:
        pass 
开发者ID:xsyann,项目名称:detection,代码行数:30,代码来源:detection.py

示例10: __init__

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def __init__(self):
        super().__init__()
        self.setColor(QPalette.Window, QColor(56, 56, 56))

        self.setColor(QPalette.WindowText, Qt.white)

        self.setColor(QPalette.Base, QColor(56, 56, 56))

        self.setColor(QPalette.AlternateBase, QColor(63, 63, 63))
        self.setColor(QPalette.ToolTipBase, Qt.white)
        self.setColor(QPalette.ToolTipText, Qt.white)

        self.setColor(QPalette.Text, Qt.white)

        self.setColor(QPalette.Button, QColor(56, 56, 56))

        self.setColor(QPalette.ButtonText, Qt.white)

        self.setColor(QPalette.BrightText, QColor(0, 128, 152))

        self.setColor(QPalette.Link, QColor(42, 130, 218))

        self.setColor(QPalette.Highlight, QColor(0, 128, 152))

        self.setColor(QPalette.HighlightedText, Qt.white)

        self.setColor(QPalette.Disabled, QPalette.Window, QColor(51, 51, 51))

        self.setColor(QPalette.Disabled, QPalette.ButtonText,
                      QColor(111, 111, 111))

        self.setColor(QPalette.Disabled, QPalette.Text, QColor(122, 118, 113))

        self.setColor(QPalette.Disabled, QPalette.WindowText,
                      QColor(122, 118, 113))

        self.setColor(QPalette.Disabled, QPalette.Base, QColor(32, 32, 32)) 
开发者ID:persepolisdm,项目名称:persepolis,代码行数:39,代码来源:palettes.py

示例11: deepl

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def deepl(text):
	l1 = config.lang_from.upper()
	l2 = config.lang_to.upper()

	if len(text) > 5000:
		return 'Text too long (limited to 5000 characters).'

	parameters = {
		'jsonrpc': '2.0',
		'method': 'LMT_handle_jobs',
		'params': {
			'jobs': [
				{
					'kind':'default',
					'raw_en_sentence': text
				}
			],
			'lang': {

				'source_lang_user_selected': l1,
				'target_lang': l2
			}
		}
	}

	response = requests.post('https://www2.deepl.com/jsonrpc', json=parameters).json()
	print(response)
	if 'result' not in response:
		return 'DeepL call resulted in a unknown result.'

	translations = response['result']['translations']

	if len(translations) == 0 \
			or translations[0]['beams'] is None \
			or translations[0]['beams'][0]['postprocessed_sentence'] is None:
		return 'No translations found.'

	return translations[0]['beams'][0]['postprocessed_sentence'] 
开发者ID:oltodosel,项目名称:interSubs,代码行数:40,代码来源:interSubs.py

示例12: draw_text_n_outline

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def draw_text_n_outline(self, painter: QPainter, x, y, outline_width, outline_blur, text):
		outline_color = QColor(config.outline_color)

		font = self.font()
		text_path = QPainterPath()
		if config.R2L_from_B:
			text_path.addText(x, y, font, ' ' + r2l(text.strip()) + ' ')
		else:
			text_path.addText(x, y, font, text)

		# draw blur
		range_width = range(outline_width, outline_width + outline_blur)
		# ~range_width = range(outline_width + outline_blur, outline_width, -1)

		for width in range_width:
			if width == min(range_width):
				alpha = 200
			else:
				alpha = (max(range_width) - width) / max(range_width) * 200

			blur_color = QColor(outline_color.red(), outline_color.green(), outline_color.blue(), alpha)
			blur_brush = QBrush(blur_color, Qt.SolidPattern)
			blur_pen = QPen(blur_brush, width, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)

			painter.setPen(blur_pen)
			painter.drawPath(text_path)

		# draw outline
		outline_color = QColor(outline_color.red(), outline_color.green(), outline_color.blue(), 255)
		outline_brush = QBrush(outline_color, Qt.SolidPattern)
		outline_pen = QPen(outline_brush, outline_width, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)

		painter.setPen(outline_pen)
		painter.drawPath(text_path)

		# draw text
		color = self.palette().color(QPalette.Text)
		painter.setPen(color)
		painter.drawText(x, y, text) 
开发者ID:oltodosel,项目名称:interSubs,代码行数:41,代码来源:interSubs.py

示例13: loadQSS

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def loadQSS(theme) -> None:
        filename = ':/styles/{}.qss'.format(theme)
        if QFileInfo(filename).exists():
            qssfile = QFile(filename)
            qssfile.open(QFile.ReadOnly | QFile.Text)
            content = QTextStream(qssfile).readAll()
            qApp.setStyleSheet(content) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:9,代码来源:videostyle.py

示例14: paint

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def paint(self, painter, option, index):
        painter.save()
        options = QStyleOptionViewItem(option)
        self.initStyleOption(options, index)
        self.doc.setHtml(options.text)
        options.text = ""  # 原字符
        style = QApplication.style() if options.widget is None else options.widget.style()
        style.drawControl(QStyle.CE_ItemViewItem, options, painter)

        ctx = QAbstractTextDocumentLayout.PaintContext()

        if option.state & QStyle.State_Selected:
            ctx.palette.setColor(QPalette.Text, option.palette.color(
                QPalette.Active, QPalette.HighlightedText))
        else:
            ctx.palette.setColor(QPalette.Text, option.palette.color(
                QPalette.Active, QPalette.Text))

        text_rect = style.subElementRect(QStyle.SE_ItemViewItemText, options)

        the_fuck_your_shit_up_constant = 3  #  ̄へ ̄ #
        margin = (option.rect.height() - options.fontMetrics.height()) // 2
        margin = margin - the_fuck_your_shit_up_constant
        text_rect.setTop(text_rect.top() + margin)

        painter.translate(text_rect.topLeft())
        painter.setClipRect(text_rect.translated(-text_rect.topLeft()))
        self.doc.documentLayout().draw(painter, ctx)

        painter.restore() 
开发者ID:rachpt,项目名称:lanzou-gui,代码行数:32,代码来源:others.py

示例15: launch

# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Text [as 别名]
def launch():
    # from utils.install_punkt import install_punkt

    # install_punkt()

    app = QApplication(sys.argv)

    try:
        file = sys.argv[1]
    except IndexError:  # File not given
        file = get_last_file()
    app.setStyle("Fusion")
    palette = QPalette()
    editor = configs[choiceIndex]["editor"]

    ex = Main(app, palette, editor)
    palette.setColor(QPalette.Window, QColor(editor["windowColor"]))
    palette.setColor(QPalette.WindowText, QColor(editor["windowText"]))
    palette.setColor(QPalette.Base, QColor(editor["editorColor"]))
    palette.setColor(QPalette.AlternateBase, QColor(editor["alternateBase"]))
    palette.setColor(QPalette.ToolTipBase, QColor(editor["ToolTipBase"]))
    palette.setColor(QPalette.ToolTipText, QColor(editor["ToolTipText"]))
    palette.setColor(QPalette.Text, QColor(editor["editorText"]))
    palette.setColor(QPalette.Button, QColor(editor["buttonColor"]))
    palette.setColor(QPalette.ButtonText, QColor(editor["buttonTextColor"]))
    palette.setColor(QPalette.Highlight, QColor(editor["HighlightColor"]).lighter())
    palette.setColor(QPalette.HighlightedText, QColor(editor["HighlightedTextColor"]))
    app.setPalette(palette)
    app.setStyleSheet(material_blue)  # uncomment this to have a material blue theme
    ex.show()
    if file is not None:
        ex.cleanOpen(file)
        ex.openProjectWithPath(os.getcwd())

    sys.exit(app.exec_()) 
开发者ID:CountryTk,项目名称:Hydra,代码行数:37,代码来源:main.py


注:本文中的PyQt5.QtGui.QPalette.Text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。