summaryrefslogtreecommitdiffstats
path: root/examples/pytde-sampler/misc/gradientselect.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pytde-sampler/misc/gradientselect.py')
-rw-r--r--examples/pytde-sampler/misc/gradientselect.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/examples/pytde-sampler/misc/gradientselect.py b/examples/pytde-sampler/misc/gradientselect.py
new file mode 100644
index 0000000..0adb2ea
--- /dev/null
+++ b/examples/pytde-sampler/misc/gradientselect.py
@@ -0,0 +1,51 @@
+from qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL, TQColor, TQSizePolicy, TQLabel
+from tdecore import i18n
+from tdeui import KPushButton, KGradientSelector, KTextEdit, KDualColorButton, KColorPatch
+
+iconName = 'colors'
+labelText = 'KGradientSelector'
+docParts = ('tdeui', 'KGradientSelector')
+helpText = ("An example of the KGradientSelector widget."
+ "\n"
+ "Change the start and finish colors with the dual color button."
+ )
+
+
+class MainFrame(TQFrame):
+ def __init__(self, parent=None):
+ TQFrame.__init__(self, parent)
+ self.help = KTextEdit(helpText, '', self)
+ self.selector = KGradientSelector(self)
+ self.dualLabel = TQLabel('Select Colors:', self)
+
+ self.startColor = TQColor('red')
+ self.finishColor = TQColor('blue')
+
+ self.selector.setColors(self.startColor, self.finishColor)
+ self.selector.setText('Start', 'Finish')
+
+ self.dualButton = KDualColorButton(self.startColor, self.finishColor, self)
+ self.dualButton.setSizePolicy(TQSizePolicy(TQSizePolicy.Maximum,
+ TQSizePolicy.Maximum))
+
+ layout = TQVBoxLayout(self, 4)
+ layout.addWidget(self.help, 20)
+
+ buttonLayout = TQHBoxLayout(layout, 4)
+ buttonLayout.addWidget(self.dualLabel, 0)
+ buttonLayout.addWidget(self.dualButton, 1)
+
+ layout.addWidget(self.selector, 10)
+
+
+ self.connect(self.dualButton, SIGNAL('fgChanged(const TQColor &)'),
+ self.selector.setFirstColor)
+ self.connect(self.dualButton, SIGNAL('bgChanged(const TQColor &)'),
+ 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