diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch) | |
tree | 8d927b7b47a90c4adb646482a52613f58acd6f8c /superkaramba/examples/image | |
download | tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'superkaramba/examples/image')
-rw-r--r-- | superkaramba/examples/image/flag.png | bin | 0 -> 1072 bytes | |||
-rw-r--r-- | superkaramba/examples/image/flag2.png | bin | 0 -> 2130 bytes | |||
-rw-r--r-- | superkaramba/examples/image/image.py | 121 | ||||
-rw-r--r-- | superkaramba/examples/image/image.theme | 34 | ||||
-rwxr-xr-x | superkaramba/examples/image/test1.sh | 2 | ||||
-rwxr-xr-x | superkaramba/examples/image/test2.sh | 2 |
6 files changed, 159 insertions, 0 deletions
diff --git a/superkaramba/examples/image/flag.png b/superkaramba/examples/image/flag.png Binary files differnew file mode 100644 index 0000000..0e3c9b5 --- /dev/null +++ b/superkaramba/examples/image/flag.png diff --git a/superkaramba/examples/image/flag2.png b/superkaramba/examples/image/flag2.png Binary files differnew file mode 100644 index 0000000..4946213 --- /dev/null +++ b/superkaramba/examples/image/flag2.png diff --git a/superkaramba/examples/image/image.py b/superkaramba/examples/image/image.py new file mode 100644 index 0000000..97656eb --- /dev/null +++ b/superkaramba/examples/image/image.py @@ -0,0 +1,121 @@ +#this import statement allows access to the karamba functions +import karamba + +images = [0,0,0,0,0,0,0,0,0,0,0,0,0,0] +c = 0 + +#this is called when you widget is initialized +def initWidget(widget): + global images + images[0] = karamba.getThemeImage(widget, "image0") + images[1] = karamba.getThemeImage(widget, "image1") + images[2] = karamba.getThemeImage(widget, "image2") + images[3] = karamba.getThemeImage(widget, "image3") + images[4] = karamba.getThemeImage(widget, "image4") + images[5] = karamba.getThemeImage(widget, "image5") + images[6] = karamba.getThemeImage(widget, "image6") + images[7] = karamba.getThemeImage(widget, "image7") + images[8] = karamba.getThemeImage(widget, "image8") + images[9] = karamba.getThemeImage(widget, "image9") + images[10] = karamba.getThemeImage(widget, "image10") + images[11] = karamba.getThemeImage(widget, "image11") + images[12] = karamba.getThemeImage(widget, "image12") + images[13] = karamba.getThemeImage(widget, "image13") + +#this is called everytime your widget is updated +#the update inverval is specified in the .theme file +def widgetUpdated(widget): + global images, c + + b = c%2 + + # Create & delete + if(images[0]): + karamba.deleteImage(widget, images[0]) + images[0] = 0 + else: + images[0] = karamba.createImage(widget, 0, 20, "flag.png") + + # Hide & Show + if(b): + karamba.hideImage(widget, images[1]) + else: + karamba.showImage(widget, images[1]) + + # size & resize + size = karamba.getImageSize(widget, images[1]) + print "getImageSize: " + str(size) + print "getImageWidth: " + str(karamba.getImageWidth(widget, images[1])) + print "getImageHeight: " + str(karamba.getImageHeight(widget, images[1])) + # Auto size + #size = ((b * 200) + 200, size[1]) + #karamba.resizeImage(widget, images[1], size[0], size[1]) + + # pos & move + pos = karamba.getImagePos(widget, images[2]) + print "getImagePos: " + str(pos) + pos = (b * 200, pos[1]) + karamba.moveImage(widget, images[2], pos[0], pos[1]) + + # Sensor + sensor = karamba.getImageSensor(widget, images[3]) + print "getSensor: " + str(sensor) + if(b): + karamba.setImageSensor(widget, images[3], 'SENSOR=PROGRAM PROGRAM="/tmp/test1.sh"') + else: + karamba.setImageSensor(widget, images[3], 'SENSOR=PROGRAM PROGRAM="/tmp/test2.sh"') + + # Value + v = karamba.getImagePath(widget, images[4]) + print "getImagePath: ", v + if(b): + v = 'flag.png' + else: + v = 'flag2.png' + karamba.setImagePath(widget, images[4], v) + + if((c % 10) == 0): + karamba.removeImageEffects(widget, images[5]) + karamba.removeImageEffects(widget, images[6]) + karamba.removeImageEffects(widget, images[7]) + else: + karamba.changeImageIntensity(widget, images[5], (float(c%10) / 5 - 1.0)) + karamba.changeImageChannelIntensity(widget, images[6], (float(c%10) / 5 - 1.0), 'blue') + karamba.changeImageToGray(widget, images[7], 0) + + if((c % 9) == 0): + karamba.removeImageTransformations(widget, images[8]) + karamba.removeImageTransformations(widget, images[9]) + karamba.removeImageTransformations(widget, images[10]) + else: + karamba.rotateImage(widget, images[8], (c%9)*20 + 45) + karamba.resizeImage(widget, images[9], 50 + (c%5)*10, size[1]) + karamba.resizeImageSmooth(widget, images[10], 50 + (c%5)*10, size[1]) + + if((c % 10) == 0): + karamba.addImageTooltip(widget, images[11], str(c)) + + if((c % 20) == 0): + if(images[12]): + karamba.deleteImage(widget, images[12]) + images[12] = 0 + else: + images[12] = karamba.createBackgroundImage(widget, 0, 340, "flag.png") + + if(images[13]): + karamba.deleteImage(widget, images[13]) + images[13] = 0 + else: + tlist = karamba.getTaskList(widget) + images[13] = karamba.createTaskIcon(widget, 50, 340, tlist[c % len(tlist)]) + + c += 1 + +def widgetClicked(widget, x, y, button): + pass + +def widgetMouseMoved(widget, x, y, button): + pass + +# This will be printed when the widget loads. +print "Loaded Image test python extension!" diff --git a/superkaramba/examples/image/image.theme b/superkaramba/examples/image/image.theme new file mode 100644 index 0000000..99a3974 --- /dev/null +++ b/superkaramba/examples/image/image.theme @@ -0,0 +1,34 @@ +KARAMBA x=100 y=10 w=600 h=580 INTERVAL=1000 LOCKED=true +DEFAULTFONT font="Bitstream Vera Sans" fontsize=16 color=200,200,200 + +TEXT x=0 Y=0 w=600 h=20 VALUE="createImage & deleteImage" name=ttext0 +IMAGE x=0 Y=20 path="flag.png" name=image0 + +TEXT x=0 Y=40 w=600 h=20 VALUE="showImage & hideImage" name=ttext1 +IMAGE x=0 Y=60 path="flag.png" name=image1 + +TEXT x=0 Y=80 w=600 h=20 VALUE="getImagePos & moveImage" name=ttext2 +IMAGE x=0 Y=100 path="flag.png" name=image2 + +TEXT x=0 Y=120 w=600 h=20 VALUE="getImageSensor & setImageSensor" name=ttext3 +IMAGE x=0 Y=140 path="flag.png" name=image3 + +TEXT x=0 Y=160 w=600 h=20 VALUE="getImagePath & setImagePath" name=ttext4 +IMAGE x=0 Y=180 path="flag.png" name=image4 + +TEXT x=0 Y=200 w=600 h=20 VALUE="removeImageEffects, changeImageIntensity, changeImageChannelIntensity, changeImageToGray" name=ttext5 fontsize=10 +IMAGE x=0 Y=220 path="flag.png" name=image5 +IMAGE x=50 Y=220 path="flag.png" name=image6 +IMAGE x=100 Y=220 path="flag.png" name=image7 + +TEXT x=0 Y=240 w=600 h=20 VALUE="removeImageTransformations, rotateImage, resizeImageSmooth, resizeImage" name=ttext6 fontsize=10 +IMAGE x=0 Y=260 path="flag.png" name=image8 +IMAGE x=80 Y=260 path="flag.png" name=image9 +IMAGE x=160 Y=260 path="flag.png" name=image10 + +TEXT x=0 Y=280 w=600 h=20 VALUE="addImageTooltip" name=ttext7 +IMAGE x=0 Y=300 path="flag.png" name=image11 + +TEXT x=0 Y=320 w=600 h=20 VALUE="createBackgroundImage & createTaskIcon" name=ttext7 +IMAGE x=0 Y=340 path="flag.png" name=image12 BACKGROUND=1 +IMAGE x=50 Y=340 path="flag.png" name=image13 diff --git a/superkaramba/examples/image/test1.sh b/superkaramba/examples/image/test1.sh new file mode 100755 index 0000000..28b1c79 --- /dev/null +++ b/superkaramba/examples/image/test1.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo flag.png diff --git a/superkaramba/examples/image/test2.sh b/superkaramba/examples/image/test2.sh new file mode 100755 index 0000000..c3b75c6 --- /dev/null +++ b/superkaramba/examples/image/test2.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo flag2.png |