You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.9 KiB
52 lines
1.9 KiB
13 years ago
|
from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL, TQColor, TQSizePolicy, TQLabel
|
||
13 years ago
|
from tdecore import i18n
|
||
|
from tdeui import KPushButton, KGradientSelector, KTextEdit, KDualColorButton, KColorPatch
|
||
13 years ago
|
|
||
|
iconName = 'colors'
|
||
|
labelText = 'KGradientSelector'
|
||
13 years ago
|
docParts = ('tdeui', 'KGradientSelector')
|
||
13 years ago
|
helpText = ("An example of the KGradientSelector widget."
|
||
|
"\n"
|
||
|
"Change the start and finish colors with the dual color button."
|
||
|
)
|
||
|
|
||
|
|
||
13 years ago
|
class MainFrame(TQFrame):
|
||
13 years ago
|
def __init__(self, parent=None):
|
||
13 years ago
|
TQFrame.__init__(self, parent)
|
||
13 years ago
|
self.help = KTextEdit(helpText, '', self)
|
||
|
self.selector = KGradientSelector(self)
|
||
13 years ago
|
self.dualLabel = TQLabel('Select Colors:', self)
|
||
13 years ago
|
|
||
13 years ago
|
self.startColor = TQColor('red')
|
||
|
self.finishColor = TQColor('blue')
|
||
13 years ago
|
|
||
|
self.selector.setColors(self.startColor, self.finishColor)
|
||
|
self.selector.setText('Start', 'Finish')
|
||
|
|
||
|
self.dualButton = KDualColorButton(self.startColor, self.finishColor, self)
|
||
13 years ago
|
self.dualButton.setSizePolicy(TQSizePolicy(TQSizePolicy.Maximum,
|
||
|
TQSizePolicy.Maximum))
|
||
13 years ago
|
|
||
13 years ago
|
layout = TQVBoxLayout(self, 4)
|
||
13 years ago
|
layout.addWidget(self.help, 20)
|
||
|
|
||
13 years ago
|
buttonLayout = TQHBoxLayout(layout, 4)
|
||
13 years ago
|
buttonLayout.addWidget(self.dualLabel, 0)
|
||
|
buttonLayout.addWidget(self.dualButton, 1)
|
||
|
|
||
|
layout.addWidget(self.selector, 10)
|
||
|
|
||
|
|
||
13 years ago
|
self.connect(self.dualButton, SIGNAL('fgChanged(const TQColor &)'),
|
||
13 years ago
|
self.selector.setFirstColor)
|
||
13 years ago
|
self.connect(self.dualButton, SIGNAL('bgChanged(const TQColor &)'),
|
||
13 years ago
|
self.selector.setSecondColor)
|
||
|
self.connect(self.selector, SIGNAL('valueChanged(int)'),
|
||
|
self.updateValue)
|
||
|
|
||
|
|
||
|
def updateValue(self, value):
|
||
|
## this should be extended to update a color swatch
|
||
|
pass
|