本文整理汇总了Python中PySide.QtGui.QPalette方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QPalette方法的具体用法?Python QtGui.QPalette怎么用?Python QtGui.QPalette使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QPalette方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showAbout
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def showAbout(self):
widget = QtGui.QDialog(self)
widget.setWindowTitle("About PySimulator")
p = QtGui.QPalette()
p.setColor(QtGui.QPalette.Background, QtGui.QColor("white"))
widget.setPalette(p)
layout = QtGui.QGridLayout(widget)
widget.setLayout(layout)
pixmap = QtGui.QPixmap(self.rootDir + "/Icons/dlr-splash.png")
iconLabel = QtGui.QLabel()
iconLabel.setPixmap(pixmap)
layout.addWidget(iconLabel, 0, 0)
layout.addWidget(QtGui.QLabel("Copyright (C) 2011-2015 German Aerospace Center DLR (Deutsches Zentrum fuer Luft- und Raumfahrt e.V.),\nInstitute of System Dynamics and Control. All rights reserved.\n\nPySimulator is free software: You can redistribute it and/or modify\nit under the terms of the GNU Lesser General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nPySimulator is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License\nalong with PySimulator. If not, see www.gnu.org/licenses."), 1, 0)
layout.addWidget(QtGui.QLabel("PySimulator Version: " + str(version)), 2, 0)
button = QtGui.QPushButton("OK")
button.clicked.connect(widget.close)
layout.addWidget(button, 3, 0)
widget.show()
示例2: _newPlotContainer
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def _newPlotContainer(self):
''' Create a new plot and add it to the current tab '''
plotContainer = plotWidget.plotContainer(self.mdi)
# defaultWidget = plotWidget.DefaultPlotWidget(self, self.plotMenuCallbacks)
# plotContainer.addRight(defaultWidget)
plotContainer.addFirst(self, self.plotMenuCallbacks)
self.plotContainers.append(plotContainer)
plotContainer.activeWidgetChanged.connect(self._currentPlotChanged)
plotContainer.closed.connect(self._removePlotContainer)
window = self.mdi.addSubWindow(plotContainer)
self.plotWindowNr += 1
window.setWindowTitle("Tab " + str(self.plotWindowNr))
p = QtGui.QPalette()
p.setColor(QtGui.QPalette.Background, QtGui.QColor("white"))
window.setPalette(p)
window.setWindowIcon(QtGui.QIcon(self.rootDir + '/Icons/office-chart-line-stacked.png'))
window.showMaximized()
return plotContainer
示例3: initUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def initUI(self):
# container = QWidget(self)
# container.resize(200, 100);
# container.setStyleSheet("background-color:black;")
font_size = QLabel('Font Size')
font_size.fillColor = QColor(30, 30, 30, 120)
font_size.penColor = QColor("#333333")
grid = QGridLayout()
grid.setContentsMargins(50, 10, 10, 10)
grid.addWidget(font_size, 0, 0)
self.setLayout(grid)
# palette = QPalette(self.palette())
# palette.setColor(self.backgroundRole(), Qt.black)
# palette.setColor(palette.Background, Qt.transparent)
# self.setPalette(palette)
# def paintEvent(self, event):
# painter = QPainter()
# painter.begin(self)
# # painter.setRenderHint(QPainter.Antialiasing)
# painter.fillRect(event.rect(), QBrush(QColor(255, 255, 255, 127)))
# painter.drawLine(self.width() / 8, self.height() / 8, 7 * self.width() / 8, 7 * self.height() / 8)
# painter.drawLine(self.width() / 8, 7 * self.height() / 8, 7 * self.width() / 8, self.height() / 8)
# # painter.setPen(QPen(Qt.NoPen))
示例4: setReadOnlyStyle
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def setReadOnlyStyle(self, state):
if state == 1:
mainWindowBgColor = QtGui.QPalette().color(QtGui.QPalette.Window)
self.setStyleSheet('QPlainTextEdit[readOnly="true"] { background-color: %s;} QFrame {border: 0px}' % mainWindowBgColor.name() )
self.setHighlight(0)
else:
self.setStyleSheet('')
self.setHighlight(1)
示例5: comboBox_Changed
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def comboBox_Changed(text_combo):
global ui
say(text_combo)
if text_combo not in shaderColors.named_colors:
return
if len(shaderColors.named_colors)>1:
pal = QtGui.QPalette()
bgc = QtGui.QColor(*shaderColors.named_colors[text_combo].getDiffuseInt())
pal.setColor(QtGui.QPalette.Base, bgc)
ui.plainTextEdit_2.viewport().setPalette(pal)
###
示例6: comboBox_Changed
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def comboBox_Changed(text_combo):
global ui
#say(text_combo)
if text_combo not in shaderColors.named_colors:
return
if len(shaderColors.named_colors)>1:
pal = QtGui.QPalette()
bgc = QtGui.QColor(*shaderColors.named_colors[text_combo].getDiffuseInt())
pal.setColor(QtGui.QPalette.Base, bgc)
ui.plainTextEdit_2.viewport().setPalette(pal)
###
示例7: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def __init__(self, parent, numberedModelName, variable):
self.numberedModelName = numberedModelName
self.variable = variable
QtGui.QLineEdit.__init__(self)
self.setFrame(True)
''' Set background to white as default
'''
self._palette = QtGui.QPalette()
self._palette.setColor(self.backgroundRole(), QtGui.QColor(255, 255, 255))
self.setPalette(self._palette)
self.editingFinished.connect(self._relay)
self.textEdited.connect(self._edited)
示例8: _loadingFileInfo
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def _loadingFileInfo(self):
''' Shows a label 'Loading file...' '''
w = QtGui.QWidget(None)
w.resize(300, 100)
w.move(self.pos().x() + self.size().width() / 2 - 300 / 2, self.pos().y() + self.size().height() / 2 - 100 / 2)
p = QtGui.QPalette()
p.setColor(QtGui.QPalette.Background, QtGui.QColor("white"))
w.setPalette(p)
l = QtGui.QLabel(w)
l.setText("<b>Loading file...</b>")
l.move(50, 50)
w.setWindowFlags(QtCore.Qt.FramelessWindowHint)
w.show()
app = QtGui.QApplication.instance()
app.processEvents()
示例9: determineColors
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def determineColors(Gui, objects, know_material_substitutions=None):
global ui
if know_material_substitutions is None:
know_material_substitutions={}
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
ui.comboBox.addItems(["as is"]+shaderColors.named_colors.keys())
material="as is"
objs = []
for obj in objects:
freecad_object = Gui.ActiveDocument.getObject(obj.Name)
face_colors = []
for color in freecad_object.DiffuseColor:
color = color[:-1]
if color not in know_material_substitutions:
say(color)
pal = QtGui.QPalette()
bgc = QtGui.QColor(color[0]*255, color[1]*255, color[2]*255)
pal.setColor(QtGui.QPalette.Base, bgc)
ui.plainTextEdit.viewport().setPalette(pal)
#ui.comboBox.addItems(color_list)
reply=Dialog.exec_()
#Dialog.exec_()
#say(reply)
if reply==1:
retval = str(ui.comboBox.currentText())
if retval == "as is":
material = color
else:
material = retval
else:
#material="as is"
material=color
know_material_substitutions.update({color:material})
#say(material)
face_colors.append(material)
else:
face_colors.append(know_material_substitutions[color])
objs.append(exportObject(freecad_object = obj,
shape_color=face_colors[0],
face_colors=face_colors))
return (objs, getNamedColors(know_material_substitutions.values()))
示例10: determineColors
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QPalette [as 别名]
def determineColors(Gui, objects, know_material_substitutions=None):
global ui
if know_material_substitutions is None:
know_material_substitutions={}
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
#ui.comboBox.addItems(["as is"]+shaderColors.named_colors.keys())
ui.comboBox.addItems(["as is"]+list(shaderColors.named_colors))
material="as is"
objs = []
for obj in objects:
freecad_object = Gui.ActiveDocument.getObject(obj.Name)
face_colors = []
for color in freecad_object.DiffuseColor:
color = color[:-1]
if color not in know_material_substitutions:
#say(color)
pal = QtGui.QPalette()
bgc = QtGui.QColor(color[0]*255, color[1]*255, color[2]*255)
pal.setColor(QtGui.QPalette.Base, bgc)
ui.plainTextEdit.viewport().setPalette(pal)
#ui.comboBox.addItems(color_list)
reply=Dialog.exec_()
#Dialog.exec_()
#say(reply)
if reply==1:
retval = str(ui.comboBox.currentText())
if retval == "as is":
material = color
else:
material = retval
else:
#material="as is"
material=color
know_material_substitutions.update({color:material})
#say(material)
face_colors.append(material)
else:
face_colors.append(know_material_substitutions[color])
objs.append(exportObject(freecad_object = obj,
shape_color=face_colors[0],
face_colors=face_colors))
return (objs, getNamedColors(know_material_substitutions.values()))