def setQuickColor( self, color ): """ Sets the quick color for the palette to the given color. :param color | <QColor> """ colorset = XPaletteColorSet() colorset.setPalette(QPalette(color)) self.setColorSet(colorset)
def reset(self): """ Resets the values to the current application information. """ self.setValue('colorSet', XPaletteColorSet()) self.setValue('font', QApplication.font()) self.setValue('fontSize', QApplication.font().pointSize())
registerDataType('int', lambda pyvalue: int(pyvalue), lambda qvariant: qt.unwrapVariant(qvariant, 0)) registerDataType('float', lambda pyvalue: float(pyvalue), lambda qvariant: qt.unwrapVariant(qvariant, 0.0)) registerDataType('str', lambda pyvalue: str(pyvalue), lambda qvariant: str(qt.unwrapVariant(qvariant, ''))) registerDataType('unicode', lambda pyvalue: unicode(pyvalue), lambda qvariant: unicode(qt.unwrapVariant(qvariant, ''))) def decodeFont(qvariant): font = QtGui.QFont() font.fromString(qt.unwrapVariant(qvariant)) return font registerDataType('QFont', lambda pyvalue: str(pyvalue.toString()), decodeFont) registerDataType( 'XColorSet', lambda pyvalue: pyvalue.toString(), lambda qvariant: XColorSet.fromString(qt.unwrapVariant(qvariant, ''))) registerDataType( 'XPaletteColorSet', lambda pyvalue: pyvalue.toString(), lambda qvariant: XPaletteColorSet.fromString(qt.unwrapVariant( qvariant, '')))
lambda qvariant: unwrapVariant(qvariant, 0)) registerDataType('float', lambda pyvalue: float(pyvalue), lambda qvariant: unwrapVariant(qvariant, 0.0)) registerDataType('str', lambda pyvalue: nativestring(pyvalue), lambda qvariant: nativestring(unwrapVariant(qvariant, ''))) registerDataType('unicode', lambda pyvalue: unicode(pyvalue), lambda qvariant: unicode(unwrapVariant(qvariant, ''))) def decodeFont(qvariant): font = QtGui.QFont() font.fromString(unwrapVariant(qvariant)) return font registerDataType('QFont', lambda pyvalue: nativestring(pyvalue.toString()), decodeFont) registerDataType('XColorSet', lambda pyvalue: pyvalue.toString(), lambda qvariant: XColorSet.fromString(unwrapVariant(qvariant, ''))) registerDataType('XPaletteColorSet', lambda pyvalue: pyvalue.toString(), lambda qvariant: XPaletteColorSet.fromString(unwrapVariant(qvariant, '')))
def __init__(self, *args, **defaults): defaults.setdefault('colorSet', XPaletteColorSet()) defaults.setdefault('font', QApplication.font()) defaults.setdefault('fontSize', QApplication.font().pointSize()) super(XScheme, self).__init__(*args, **defaults)