本文整理汇总了Python中PyQt4.QtGui.QPalette类的典型用法代码示例。如果您正苦于以下问题:Python QPalette类的具体用法?Python QPalette怎么用?Python QPalette使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPalette类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: __init__
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)
示例3: updateFilledCircle
def updateFilledCircle(self, s):
size = s * self.zoom
pixmap = QPixmap(self.width(), self.height())
pixmap.fill(Qt.transparent)
#painter filled ellipse
p = QPalette()
painter = QPainter()
painter.begin(pixmap)
painter.setRenderHint(QPainter.Antialiasing)
brush = QBrush(p.link().color())
painter.setBrush(brush)
painter.setOpacity(0.4)
painter.drawEllipse(QRect(self.width()/2 - size/2, self.height()/2 - size/2, size, size))
painter.end()
#painter ellipse 2
painter2 = QPainter()
painter2.begin(pixmap)
painter2.setRenderHint(QPainter.Antialiasing)
pen2 = QPen(Qt.green)
pen2.setWidth(1)
painter2.setPen(pen2)
painter2.drawEllipse(QRect(self.width()/2 - size/2, self.height()/2 - size/2, size, size))
painter2.end()
self.ellipseLabel.setPixmap(QPixmap(pixmap))
self.lastSize = s
示例4: test_gui_cv
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
示例5: initUI
def initUI(self):
# title
title = QLabel(self)
title.setText("User Instruction")
title.setAlignment(Qt.AlignCenter)
# user instruction
groupBox = QGroupBox()
text = QLabel(self)
text.setText("Create image montages and histograms from the interface:\nChoose option No. 1 to 5 on main interface.\nClick Enter to select the paths for input and output locations.\nEnjoy using the interface!")
self.setStyleSheet("QLabel { color: #8B4513; font-size: 16px;font-family: cursive, sans-serif;}")
title.setStyleSheet("QLabel { color: #8B4513; font-weight: 600;}")
# set layout
sbox = QVBoxLayout(self)
sbox.addWidget(text)
groupBox.setLayout(sbox)
vBoxLayout = QVBoxLayout()
vBoxLayout.addSpacing(15)
vBoxLayout.addWidget(title)
vBoxLayout.addWidget(groupBox)
vBoxLayout.addSpacing(15)
self.setLayout(vBoxLayout)
# set background as transparent
palette = QPalette()
palette.setBrush(QPalette.Background,QBrush(QPixmap()))
self.setPalette(palette)
示例6: __init__
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)
示例7: __init__
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)
示例8: on_normalizationComboBoxChanged
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()
示例9: __init__
def __init__(self, parent=None):
super(AbstractTraitDots, self).__init__(parent)
self.__minimum = 0
self.__maximum = 5
self.__readOnly = False
self.__value = 0
# Es gibt anfangs keine verbotenen Werte, also nur eine leere Liste erstellen
self.__forbiddenValues = []
# Standardwerte setzen
self.setMinimum( 0)
self.setMaximum( 5)
# setValue() muß nach dem Füllen der MyAllowedValues-Liste aufgurefen werden, damit die List Einträge besitzt, bevort sie abgefragt wird.
self.setValue(0)
# Widget darf nur proportional in seiner Größe verändert werden?
# Minimalgröße festlegen
self.__minimumSizeY = 8
minimumSizeX = self.__minimumSizeY * self.__maximum
self.setMinimumSize( minimumSizeX, self.__minimumSizeY)
self.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Fixed )
# Setze Farben abhängig von der verwendeten Palette.
__palette = QPalette()
self._colorEmpty = __palette.text().color()
self._colorFull = __palette.highlight().color()
self._colorFrame = __palette.highlight().color()
self.maximumChanged.connect(self.resetMinimumSize)
示例10: initSubWidget
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)
示例11: __init__
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)
示例12: __init__
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)
示例13: change_palette
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
示例14: set_palette
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)
示例15: __init__
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)