本文整理汇总了Python中PyQt4.QtGui.QPalette.setColor方法的典型用法代码示例。如果您正苦于以下问题:Python QPalette.setColor方法的具体用法?Python QPalette.setColor怎么用?Python QPalette.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QPalette
的用法示例。
在下文中一共展示了QPalette.setColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_normalizationComboBoxChanged
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def on_normalizationComboBoxChanged(self):
selection = str(self.normalizationComboBox.currentText())
if selection == "No Normalization":
self.normalizationMethod = 0
elif selection == "Change range from":
self.normalizationMethod = 1
elif selection == "Auto Normalization":
self.normalizationMethod = 2 #Currently not implemented
p = QPalette()
if self.normalizationMethod == 0:
p.setColor(QPalette.Base,Qt.gray)
p.setColor(QPalette.Text,Qt.gray)
self.inputValueRange.setPalette(p)
self.inputValueRange.setEnabled(False)
self.outputValueRange.setPalette(p)
self.outputValueRange.setEnabled(False)
else:
self.setLayerValueRangeInfo()
p.setColor(QPalette.Base,Qt.white)
p.setColor(QPalette.Text,Qt.black)
self.inputValueRange.setPalette(p)
self.inputValueRange.setEnabled(True)
self.outputValueRange.setPalette(p)
self.outputValueRange.setEnabled(True)
self.validateInputValueRange()
示例2: test_gui_cv
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def test_gui_cv():
sleep(1)
import threading
import sys
import os
import logging
from setting import config
from setting.configs.tool import update_config_by_name, SAFE_ARGVS
from .testcases import knife_into_cv
project_name = "cvoffline"
config_info = update_config_by_name(project_name)
config.SIMULATOR_IMG_SERVER_COFIG = [
"127.0.0.1",
9883,
"randomImg",
"IMG/G652/0912R/"
]
log_level = getattr(logging, config.LOG_LEVEL, logging.ERROR)
log_dir = getattr(config, "LOG_DIR", False)
if log_dir == "print":
logging.basicConfig(format="%(asctime)s-%(name)s-%(levelname)s-%(message)s",
level=log_level)
else:
logging.basicConfig(filename="setting\\testlog.log",
filemode="a", format="%(asctime)s-%(name)s-%(levelname)s-%(message)s",
level=log_level)
logger = logging.getLogger(__name__)
logger.error(config_info)
from PyQt4.QtGui import QPalette, QColor, QApplication
from GUI.view.view import get_view
from GUI.controller import get_controller
from util.loadfile import loadStyleSheet
try:
label = config.VIEW_LABEL # label为AutomaticCV
logger.error(" main info: {} {} \n{}".format(label, project_name, sys.argv[0]))
app = QApplication(sys.argv)
app.setStyleSheet(loadStyleSheet('main'))
pt = QPalette()
pt.setColor(QPalette.Background, QColor(4, 159, 241))
app.setPalette(pt)
controller = get_controller(label)
view = get_view(label)
# print view.__dict__, type(view)
c = controller(view())
threading.Thread(target=knife_into_cv, args=(c, app)).start() # unittest thread insert
c.show()
# sys.stdout = sys.__stdout__
sys.exit(app.exec_())
except SystemExit:
# print "system exit\n",sys._getframe(1).f_code
sleep(3)
except Exception as e:
raise e
示例3: __init__
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def __init__(self, parent: QWidget=None):
ContainerWidget.__init__(self, parent)
pal = QPalette(self.palette())
self.setMinimumSize(250, 250)
pal.setColor(QPalette.Background, QColor(55, 50, 47))
self.setAutoFillBackground(True)
self.setPalette(pal)
示例4: __init__
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def __init__(self, parent, codigo_inicial=None):
super(InterpreteLanas, self).__init__()
self.ventana = parent
self.refreshMarker = False
self.multiline = False
self.command = ''
self.history = []
self.historyIndex = -1
self.interpreterLocals = {'raw_input': self.raw_input,
'input': self.input,
'sys': sys,
'help': help,
'ayuda': self.help}
palette = QPalette()
palette.setColor(QPalette.Text, QColor(0, 0, 0))
self.setPalette(palette)
if codigo_inicial:
self.insertar_codigo_falso(codigo_inicial)
self.marker()
self.setUndoRedoEnabled(False)
self.setContextMenuPolicy(Qt.NoContextMenu)
self.timer_cursor = QTimer()
self.timer_cursor.start(1000)
self.timer_cursor.timeout.connect(self.marker_si_es_necesario)
示例5: _staticDataInit
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def _staticDataInit(self):
u"""
Class initialization: building pixmaps, palettes… only once.
"""
normalpalette = QPalette(self.palette())
redpalette = QPalette( normalpalette )
redpalette.setColor( QPalette.Base, QColor("#FF9D9F") )
greenpalette = QPalette(normalpalette)
greenpalette.setColor(QPalette.Base, QColor("#B0FF86") )
size = QSize(16, 16)
ServiceStatusItem.pix_n_colors = {
ServiceStatusValues.RUNNING: (
QPixmap(":/icons/status_on").scaled(size),
greenpalette,
'<b><font color="green">%s</font></b>.' % 'running'),
ServiceStatusValues.STOPPED: (
QPixmap(":/icons/status_off").scaled(size),
redpalette,
'<b><font color="red">%s</font></b>.' % 'stopped'),
ServiceStatusValues.NOT_LOADED: (
QPixmap(":/icons/status_na").scaled(size),
normalpalette,
'<b>%s</b>.' % 'not loaded'),
ServiceStatusValues.POLLING: (
QPixmap(":/icons/status_refresh"),
normalpalette,
'%s.' % 'polling')
}
示例6: __init__
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def __init__(self, parent = None):
QDialog.__init__(self, parent = parent)
self.setWindowModality(False)
self._open_instances.append(self)
self.ui = UiDialog()
self.ui.setupUi(self)
self.parent = parent
self.ui.folder_error.setVisible(False)
palette = QPalette()
palette.setColor(QPalette.Foreground, Qt.red)
self.ui.folder_error.setPalette(palette)
o_loaded_ascii = ReducedAsciiLoader(parent = parent,
ascii_file_name = '',
is_live_reduction = True)
if parent.o_stitching_ascii_widget is None:
o_stitching_ascii_widget = StitchingAsciiWidget(parent = self.parent,
loaded_ascii = o_loaded_ascii)
parent.o_stitching_ascii_widget = o_stitching_ascii_widget
# retrieve gui parameters
_export_stitching_ascii_settings = ExportStitchingAsciiSettings()
self.dq0 = str(_export_stitching_ascii_settings.fourth_column_dq0)
self.dq_over_q = str(_export_stitching_ascii_settings.fourth_column_dq_over_q)
self.is_with_4th_column_flag = bool(_export_stitching_ascii_settings.fourth_column_flag)
self.use_lowest_error_value_flag = bool(_export_stitching_ascii_settings.use_lowest_error_value_flag)
self.ui.dq0Value.setText(self.dq0)
self.ui.dQoverQvalue.setText(self.dq_over_q)
self.ui.output4thColumnFlag.setChecked(self.is_with_4th_column_flag)
self.ui.usingLessErrorValueFlag.setChecked(self.use_lowest_error_value_flag)
self.ui.usingMeanValueFalg.setChecked(not self.use_lowest_error_value_flag)
示例7: __init__
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def __init__(self, direction):
self.dns_lookup_id = 0
QDialog.__init__(self)
self.setupUi(self)
if (direction == 'OUT'):
text = 'is trying to connect to'
if (direction == 'IN'):
text = 'is being connected to from'
self.setWindowTitle("Leopard Flower firewall")
self.label_text.setText(text)
self.pushButton_allow.clicked.connect(self.allowClicked)
self.pushButton_deny.clicked.connect(self.denyClicked)
self.pushButton_hide.setVisible(False)
self.tableWidget_details.setVisible(False)
self.rejected.connect(self.escapePressed)
self.finished.connect(self.dialogFinished)
fullpath_text = QTableWidgetItem("Full path")
self.tableWidget_details.setItem(0,0,fullpath_text)
pid_text = QTableWidgetItem("Process ID")
self.tableWidget_details.setItem(1,0,pid_text)
remoteip_text = QTableWidgetItem("Remote IP")
self.tableWidget_details.setItem(2,0,remoteip_text)
remotedomain_text = QTableWidgetItem("Remote domain")
self.tableWidget_details.setItem(3,0,remotedomain_text)
remoteport_text = QTableWidgetItem("Remote port")
self.tableWidget_details.setItem(4,0,remoteport_text)
localport_text = QTableWidgetItem("Local port")
self.tableWidget_details.setItem(5,0,localport_text)
#make the incoming dialog stand out. It is not common to receive incoming connections
if (direction == 'IN'):
pal = QPalette()
col = QColor(255, 0, 0, 127)
pal.setColor(QPalette.Window, col)
self.setPalette(pal)
示例8: initSubWidget
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def initSubWidget(self):
self.linesPath = None
self.widthtwo = 0
self.widthseven = 0
self.heightone = 0
self.heightfive = 0
self.copyLabel = QLabel(self)
self.copyLabel.setFixedWidth(400)
self.copyLabel.setAlignment(Qt.AlignCenter)
self.nameLabel = QLabel(self)
self.nameLabel.setFixedWidth(400)
self.nameLabel.setAlignment(Qt.AlignCenter)
self.copyLabel.setFont(QFont("simhei",9))
self.nameLabel.setFont(QFont("simhei",15))
self.netLabel = QLabel(self)
self.netLabel.setFixedWidth(800)
self.netLabel.setFixedHeight(20)
#self.netLabel.setAlignment(Qt.AlignLeft)
self.netLabel.setAlignment(Qt.AlignCenter)
self.netLabel.setText(self.tr("Can not connect to server, please check network and server address!"))
self.netLabel.setFont(QFont("simhei",12,QFont.Bold))
pe = QPalette()
pe.setColor(QPalette.WindowText,Qt.red)
self.netLabel.setPalette(pe)
self.netLabel.hide()
#self.updateTimer = QTimer(self)
#self.connect(self.updateTimer, SIGNAL("timeout"),self.updateWidgetInfo)
#self.updateTimer.start(10)
#主窗口
self.mainwindow = MainWindow(self)
#关于对话框
self.aboutWidget = AboutWidget(self)
self.aboutWidget.hide()
#self.showDlg = SettingWidget(self.mainwindow)
#日志窗口
#self.recordWidget = RecordWidget(self)
#self.recordWidget.mythread.stop()
#self.recordWidget.hide()
#self.toolWidget = ToolWidget()
#self.toolWidget.hide()
#创建action
#self.action_showRecord_A = QAction(self)
#self.action_closeRecord_B = QAction(self)
#self.action_showRecord_A.setShortcut(QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_B))
#self.action_closeRecord_B.setShortcut(QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_C))
#self.addAction(self.action_showRecord_A)
#self.addAction(self.action_closeRecord_B)
self.udpClient = UdpClient()
self.connect(self.udpClient, SIGNAL("start"),self.startB)
self.connect(self.udpClient, SIGNAL("stop"),self.stopB)
示例9: __init__
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def __init__(self, c, *args, **kwargs):
QwtDialNeedle.__init__(self, *args, **kwargs)
palette = QPalette()
for i in range(QPalette.NColorGroups): # ( int i = 0; i < QPalette.NColorGroups; i++ )
palette.setColor(i, palette.Text, c)
palette.setColor(QPalette.Base, QColor(0,0,0))
self.setPalette(palette)
示例10: __init__
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def __init__(self, container_widget=None, target_method=None):
QWidget.__init__(self, container_widget)
self.container_widget = container_widget
self.target_method = target_method
palette = QPalette(self.palette())
palette.setColor(palette.Background, Qt.transparent)
self.setPalette(palette)
示例11: change_palette
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def change_palette(self, color):
'''Sets the global tooltip background to the given color and initializes reset'''
p = QPalette(self.default_palette)
p.setColor(QPalette.All, QPalette.ToolTipBase, color)
QToolTip.setPalette(p)
self.timer = QTimer()
self.timer.timeout.connect(self.try_reset_palette)
self.timer.start(300) #short enough not to flicker a wrongly colored tooltip
示例12: set_palette
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def set_palette(self, background, foreground):
"""
Set text editor palette colors:
background color and caret (text cursor) color
"""
palette = QPalette()
palette.setColor(QPalette.Base, background)
palette.setColor(QPalette.Text, foreground)
self.setPalette(palette)
示例13: initColorStyle
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def initColorStyle(self):
self.colorStyle = Styles[self.styleIndex]
pal = QPalette(self.tabWidget_2.palette())
#print pal.color(QPalette.Base).name()
#print pal.color(QPalette.Window).name()
pal.setColor(QPalette.Base,self.colorStyle.paper)
pal.setColor(QPalette.Text,self.colorStyle.color)
self.tabWidget_2.setPalette(pal)
self.tabWidget_3.setPalette(pal)
示例14: initUI
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def initUI(self):
self.setWindowTitle('Scroll PDF and reveal another one')
p = QPalette()
p.setColor(QPalette.Background, QtCore.Qt.black);
self.setPalette(p)
self.showMaximized()
self.show()
示例15: __init__
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import setColor [as 别名]
def __init__(self, text, parent=None):
FLabel.__init__(self, text, parent)
font = QFont()
self.setFont(font)
red = QColor(Qt.red)
palette = QPalette()
palette.setColor(QPalette.WindowText, red)
self.setPalette(palette)
self.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)