summaryrefslogtreecommitdiffstats
path: root/superkaramba/examples/bar
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch)
tree8d927b7b47a90c4adb646482a52613f58acd6f8c /superkaramba/examples/bar
downloadtdeutils-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/bar')
-rw-r--r--superkaramba/examples/bar/bar.py93
-rw-r--r--superkaramba/examples/bar/bar.theme26
-rw-r--r--superkaramba/examples/bar/hor.pngbin0 -> 300 bytes
-rw-r--r--superkaramba/examples/bar/ver.pngbin0 -> 321 bytes
4 files changed, 119 insertions, 0 deletions
diff --git a/superkaramba/examples/bar/bar.py b/superkaramba/examples/bar/bar.py
new file mode 100644
index 0000000..b018fe8
--- /dev/null
+++ b/superkaramba/examples/bar/bar.py
@@ -0,0 +1,93 @@
+#this import statement allows access to the karamba functions
+import karamba
+
+bars = [0,0,0,0,0,0,0,0]
+b = 0
+
+#this is called when you widget is initialized
+def initWidget(widget):
+ global bars, b
+ bars[0] = karamba.getThemeBar(widget, "bar0")
+ bars[1] = karamba.getThemeBar(widget, "bar1")
+ bars[2] = karamba.getThemeBar(widget, "bar2")
+ bars[3] = karamba.getThemeBar(widget, "bar3")
+ bars[4] = karamba.getThemeBar(widget, "bar4")
+ bars[5] = karamba.getThemeBar(widget, "bar5")
+ bars[6] = karamba.getThemeBar(widget, "bar6")
+ bars[7] = karamba.getThemeBar(widget, "bar7")
+
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ global bars, b
+
+ # vertical & bitmap
+ b = karamba.getBarVertical(widget, bars[7])
+ print "getVertical: " + str(b)
+ bmp = karamba.getBarImage(widget, bars[7])
+ print "getBitmap: " + str(bmp)
+ b = (b+1)%2
+ karamba.setBarVertical(widget, bars[7], b)
+ if(b):
+ karamba.setBarImage(widget, bars[7], "ver.png")
+ karamba.resizeBar(widget, bars[7], 20, 200)
+ else:
+ karamba.setBarImage(widget, bars[7], "hor.png")
+ karamba.resizeBar(widget, bars[7], 200, 20)
+
+ # size & resize
+ size = karamba.getBarSize(widget, bars[1])
+ print "getBarSize: " + str(size)
+ size = ((b * 100) + 100, size[1])
+ karamba.resizeBar(widget, bars[1], size[0], size[1])
+
+ # pos & move
+ pos = karamba.getBarPos(widget, bars[2])
+ print "getBarPos: " + str(pos)
+ pos = (b * 200, pos[1])
+ karamba.moveBar(widget, bars[2], pos[0], pos[1])
+
+ # Hide & Show
+ if(b):
+ karamba.hideBar(widget, bars[3])
+ else:
+ karamba.showBar(widget, bars[3])
+
+ # Value
+ v = karamba.getBarValue(widget, bars[5])
+ print "getBarValue: ", v
+ v = (v + 10) % 110
+ karamba.setBarValue(widget, bars[5], v)
+
+ # Min Max
+ minmax = karamba.getBarMinMax(widget, bars[6])
+ print "getBarMinMax: " + str(minmax)
+ minmax = (0, (b * 100) + 100)
+ karamba.setBarMinMax(widget, bars[6], minmax[0], minmax[1])
+
+ # Sensor
+ sensor = karamba.getBarSensor(widget, bars[4])
+ print "getSensor: " + str(sensor)
+ if(b):
+ karamba.setBarSensor(widget, bars[4], 'SENSOR=SENSOR TYPE="cpu_temp"')
+ else:
+ karamba.setBarSensor(widget, bars[4], 'SENSOR=CPU')
+
+ # Create & delete
+ if(bars[0]):
+ karamba.deleteBar(widget, bars[0])
+ bars[0] = 0
+ else:
+ bars[0] = karamba.createBar(widget, 0, 20, 200, 20)
+ karamba.setBarImage(widget, bars[0], "hor.png")
+ karamba.setBarValue(widget, bars[0], 100)
+
+def widgetClicked(widget, x, y, button):
+ pass
+
+def widgetMouseMoved(widget, x, y, button):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded Bar test python extension!"
diff --git a/superkaramba/examples/bar/bar.theme b/superkaramba/examples/bar/bar.theme
new file mode 100644
index 0000000..ec569e9
--- /dev/null
+++ b/superkaramba/examples/bar/bar.theme
@@ -0,0 +1,26 @@
+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="createBar & deleteBar" name=text0
+BAR x=0 Y=20 w=200 h=20 path=hor.png value=100 min=0 max=100 name=bar0
+
+TEXT x=0 Y=45 w=600 h=20 VALUE="getBarSize & resizeBar" name=text1
+BAR x=0 Y=65 w=100 h=20 path=hor.png value=100 min=0 max=100 name=bar1
+
+TEXT x=0 Y=90 w=600 h=20 VALUE="getBarPos & moveBar" name=text2
+BAR x=0 Y=110 w=200 h=20 path=hor.png value=100 min=0 max=100 name=bar2
+
+TEXT x=0 Y=135 w=600 h=20 VALUE="hideBar & showBar" name=text3
+BAR x=0 Y=155 w=200 h=20 path=hor.png value=100 min=0 max=100 name=bar3
+
+TEXT x=0 Y=180 w=600 h=20 VALUE="getBarSensor & setBarSensor" name=text4
+BAR x=0 Y=200 w=200 h=20 path=hor.png value=50 min=0 max=100 name=bar4
+
+TEXT x=0 Y=225 w=600 h=20 VALUE="getBarValue & setBarValue" name=text5
+BAR x=0 Y=245 w=200 h=20 path=hor.png value=50 min=0 max=100 name=bar5
+
+TEXT x=0 Y=270 w=600 h=20 VALUE="getBarMinMax & setBarMinMax" name=text6
+BAR x=0 Y=290 w=200 h=20 path=hor.png value=50 min=0 max=100 name=bar6
+
+TEXT x=0 Y=315 w=600 h=20 VALUE="getBarVertical, setBarVertical, setBarImage & getBarImage" name=text7
+BAR x=0 Y=335 w=200 h=20 path=hor.png value=100 min=0 max=100 name=bar7
diff --git a/superkaramba/examples/bar/hor.png b/superkaramba/examples/bar/hor.png
new file mode 100644
index 0000000..56dbbc0
--- /dev/null
+++ b/superkaramba/examples/bar/hor.png
Binary files differ
diff --git a/superkaramba/examples/bar/ver.png b/superkaramba/examples/bar/ver.png
new file mode 100644
index 0000000..928b869
--- /dev/null
+++ b/superkaramba/examples/bar/ver.png
Binary files differ