This is THE most important function. After you do a bunch of other calls
+ (moving images, adding images or text, etc), you call this to update the
+ widget display area. You will not see your changes until you call this.
+ Redraws widget background.
+
This will change the color of a text widget (only ones you created
+ through python currently). textToChange is the reference to the text
+ object to change that you saved from the createText() call. r, g, b are
+ ints from 0 to 255 that represent red, green, and blue.
+
This will change the font of a text widget (only ones you created
+ through python currently). textToChange is the reference to the text
+ object to change that you saved from the createText() call. newFont is a
+ string the the name of the font to use.
+
This will change the shadow size of a text widget (only ones you
+ created through python currently). textToChange is the reference to the
+ text object to change that you saved from the createText() call. size
+ is the offset of the shadow in pixels. 1 or 2 is a good value in most
+ cases. Get current sensor string
+
This will change the font size of a text widget (only ones you created
+ through python currently). textToChange is the reference to the text
+ object to change that you saved from the createText() call. size is the
+ new font point size.
+
This creates a text at x,y with width and height w,h. You need to save
+ the return value of this function to call other functions on your text
+ field, such as changeText()
+
This removes a text object from memory. Please do not call functions on
+ "text" after calling deleteText, as it does not exist anymore and that
+ could cause crashes in some cases.
+
You can reference text in your python code that was created in the
+ theme file. Basically, you just add a NAME= value to the TEXT line in
+ the .theme file. Then if you want to use that object, instead of calling
+ createText, you can call this function.
+
+
+
The name you pass to the function is the same one that you gave it for
+ the NAME= parameter in the .theme file.
+
This returns all of the info about a certain starting task in the form of
+ a Python List. widget is a reference to the current widget. task is a
+ reference to the window you want info about which you obtain by calling
+ getStartupList().
+
+
ARGUMENTS
+
long widget -- karamba
+
+
long task -- pointer to task
+
+
+
+
RETURN VALUE
+
Here is the format of the returned list by index value:
+
+
0 = Task name (The full name of the window)
+
+
1 = Icon name
+
+
2 = Executable name
+
+
3 = A reference back to the task you got info on
+
This returns a Python List object with references to all the current
+ windows that are in the process of loading on this system. You can then
+ call getStartupInfo() on any of the entries in the list.
+
This returns all of the info about a certain task in the form of a Python
+ List. widget is a reference to the current widget. task is a reference to
+ the window you want info about which you obtain by calling getTaskList().
+
+
ARGUMENTS
+
long widget -- karamba
+
+
long task -- pointer to task
+
+
+
+
RETURN VALUE
+
Here is the format of the returned list by index value:
+
+
0 = Task name (The full name of the window)
+
+
1 = Icon name
+
+
2 = Class name - This is for grouping tasks. All tasks with the same
+ name can be grouped together because they are instances of the same
+ program.
+
+
3 = Desktop number - The desktop number this window is on
+
+
4 = Is this window maximized? 0=no, 1=yes
+
+
5 = Is this window iconified (minimized)? 0=no, 1=yes
+
+
6 = Is this window shaded (rolled up)? 0=no, 1=yes
+
+
7 = Is this window focused? 0=no, 1=yes
+
+
8 = A reference back to the task you got info on
+
This returns a Python List object with references to all the current
+ windows open on this system. You can then call performTaskAction() or
+ getTaskInfo() on any of the entries in the list.
+
This returns a Python List containing the String names of all open
+ windows on the system. This is for convience if you want to list open
+ windows or see if a window by a certain name exists. Anything else
+ requires the reference to the window you would obtain from getTaskList()
+
This peforms the given action on a task object. widget is a reference to
+ the current widget. task is a reference to a task object you got from
+ getTaskList(). Action is a number from 1 to 10. See the list below.
+
+
+
Possible actions:
+
+
1 = Maximize the window
+
+
2 = Restore the window (use on iconified windows)
+
+
3 = Iconify the window (minimize it)
+
+
4 = Close the window
+
+
5 = Activate (give focus to) the window
+
+
6 = Raise the window
+
+
7 = Lower the window
+
+
8 = Smart Focus/Minimize - This will what the KDE taskbar does when you
+ click on a window. If it is iconified, raise it. If it has focus,
+ iconify it.
+
+
9 = Toggle whether this window is always on top
+
+
10 = Toggle wheter this window is shaded (rolled up)
+
This will change the contents of a rich text widget. richText is the
+ reference to the text object to change that you saved from the
+ createRichText() call. text is a string containing the new value for the
+ rich text object.
+
+
+
The differance between Rich Text and a regular text field is that rich
+ text fields can display HTML code embedded in your text.
+
+
+
In a <a href="command"> ... </a> tag command is executed if the link is
+ click with the left mouse button.
+
+
+
Except if command starts with an '#' (ie: href="#value" ) the callback
+ meterClicked is called with value (without the #) as the meter argument.
+
+
+
Also inline images work. Unfortunatly currently only when using absolute
+ paths.
+
long createRichText(widget, text, underlineLinks)
+
+
DESCRIPTION
+
This creates creates a rich text string. underlineLinks is a boolean that
+ determines if html links will be automatically underlined so that the
+ user knows that the links can be clicked on. You need to save the return
+ value of this function to call other functions on your rich text field,
+ such as changeRichText().
+
+
+
The differance between Rich Text and a regular text field is that rich
+ text fields can display HTML code embedded in your text.
+
+
+
In a <a href="command"> ... </a> tag command is executed if the link is
+ click with the left mouse button.
+
+
+
Except if command starts with an '#' (ie: href="#value" ) the callback
+ meterClicked is called with value (without the #) as the meter argument.
+
+
+
Also inline images work. Unfortunatly currently only when using absolute
+ paths.
+
+
ARGUMENTS
+
long widget -- karamba
+
+
string text -- text for richtext
+
+
long underlineLinks -- should the links be underlined
+
This removes a richt text object from memory. Please do not call
+ functions on "text" after calling deleteRichText, as it does not exist
+ anymore and that could cause crashes in some cases.
+
You can reference richtext in your python code that was created in the
+ theme file. Basically, you just add a NAME= value to the GRAPH line in
+ the .theme file. Then if you want to use that object, instead of calling
+ createRichText, you can call this function.
+
+
+
The name you pass to the function is the same one that you gave it for
+ the NAME= parameter in the .theme file.
+
Calling this enables your widget to receive Drop events. In other words,
+ the user will be able to drag icons from her desktop and drop them on
+ your widget. The "itemDropped" callback is called as a result with the
+ data about the icon that was dropped on your widget. This allows, for
+ example, icon bars where items are added to the icon bar by Drag and
+ Drop.
+
It is possible to attach a clickarea to a meter (image or text field),
+ which is moved and resized correctly if the meter is moved or resized.
+
+
+
There is also a callback meterClicked(widget, meter, button) which is
+ called whenever a meter is clicked (if something is attached to it).
+ Given an Image or a TextLabel, this call makes it clickable. When a mouse
+ click is detected, the callback meterClicked is called.
+
+
+
lB, mB, and rB are strings that specify what command is executed when
+ this meter is clicked with the left mouse button, middle mouse button,
+ and right mouse button respectively. If given, the appropriate command is
+ executed when the mouse click is received.
+
+
+
The keyword arguments are all optional. If command is an empty string
+ nothing is executed.
+
+
+
For now the command given to RightButton has obviosly no effect (because
+ that brings up the SuperKaramba menu).
+
long createClickArea(widget, x, y, w, h, cmd_to_run)
+
+
DESCRIPTION
+
This creates a clickable area at x,y with width and height w,h. When
+ this area is clicked, cmd_to_run will be executed. The mouse will change
+ to the clickable icon when over this area.
+
This command simply executes a program or command on the system. This is
+ just for convience (IE you could accomplish this directly through python,
+ but sometimes threading problems crop up that way). The only option is a
+ string containing the command to execute.
+
This command executes a program or command on the system. But it allows
+ you to get any text that the program outputs. Futhermore, it won't freeze
+ up your widget while the command executes.
+
+
+
To use it, call executeInteractive with the reference to your widget and
+ a list of command options. The array is simply a list that contains the
+ command as the first entry, and each option as a seperate list entry.
+ Output from the command is returned via the commandOutput callback.
+
+
+
The command returns the process number of the command. This is useful if
+ you want to run more than one program at a time. The number will allow
+ you to figure out which program is outputting in the commandOutput
+ callback.
+
This shows/hides the current desktop just like the Show Desktop button on
+ kicker. Basically, it minimizes all the windows on the current desktop.
+ Call it once to show the desktop and again to hide it.
+
This adds an entry to the given menu with label text and with given icon.
+ icon can be just an application name in which case the user's current
+ icon set is used, or can be a path to a 16x16 png file.
+
+
+
The function returns the id of the menu item, which identifies that popup
+ menu item uniquely among popupmenu items application-wide or returns 0
+ if the given menu doesn't exist.
+
This pops up the given menu at the given co-ordinates. The co-ordinates
+ are relative to the widget, not the screen. You can use negative
+ co-ordinates to make a menu appear to the right of or above your theme.
+
+
ARGUMENTS
+
long widget -- karamba
+
+
long menu -- pointer to menu
+
+
long x -- x coordinate
+
+
long y -- y coordinate
+
+
+
+
RETURN VALUE
+
1 if the menu existed and was popped up, returns 0 otherwise.
+
This creats a tooltip for image with tooltip_text.
+
+
+
Note:
+
+
If you move the image, the tooltip does not move! It stays! Do not
+ create a tooltip if the image is off-screen because you will not be
+ able to ever see it.
+
long changeImageIntensity(widget, image, ratio, millisec)
+
+
DESCRIPTION
+
Changes the "intensity" of the image, which is similar to it's
+ brightness. ratio is a floating point number from -1.0 to 1.0 that
+ determines how much to brighten or darken the image. Millisec specifies
+ how long in milliseconds before the image is restored to it's original
+ form. This is useful for "mouse over" type animations. Using 0 for
+ millisec disables this feature and leaves the image permanently
+ affected.
+
+
ARGUMENTS
+
long widget -- karamba
+
+
long image -- pointer to image
+
+
float ratio -- -1.0 to 1.0 (dark to bright)
+
+
long millisec -- milliseconds before the image is restored
+
Turns the given image into a grayscale image. Millisec specifies how
+ long in milliseconds before the image is restored to it's original form.
+ This is useful for "mouse over" type animations. Using 0 for millisec
+ disables this feature and leaves the image permanently affected.
+
+
ARGUMENTS
+
long widget -- karamba
+
+
long image -- pointer to image
+
+
long millisec -- milliseconds before the image is restored
+
long createBackgroundImage(widget, x, y, w, h, image)
+
+
DESCRIPTION
+
This creates an background image on your widget at x, y. The filename
+ should be given as the path parameter. In theory the image could be
+ local or could be a url. It works just like adding an image in your
+ theme file. You will need to save the return value to be able to call
+ other functions on your image, such as moveImage()
+
This creates an image on your widget at x, y. The filename should be
+ given as the path parameter. In theory the image could be local or could
+ be a url. It works just like adding an image in your theme file. You
+ will need to save the return value to be able to call other functions on
+ your image, such as moveImage()
+
This removes image from memory. Please do not call functions on "image"
+ after calling deleteImage, as it does not exist anymore and that could
+ cause crashes in some cases.
+
This returns the width of an image. This is useful if you have rotated
+ an image and its size changed, so you do not know how big it is anymore. // ARGUMENTS
+ * long widget -- karamba
+ * long image -- pointer to image
+
You can reference an image in your python code that was created in the
+ .theme file. Basically, you just add a NAME= value to the IMAGE line in
+ the .theme file. Then if you want to use that object, instead of calling
+ createImage, you can call this function.
+
+
+
The name you pass to the function is the same one that you gave it for
+ the NAME= parameter in the .theme file.
+
This moves an image to a new x, y relative to your widget. In other
+ words, (0,0) is the top corner of your widget, not the screen. The
+ imageToMove parameter is a reference to the image to move that you saved
+ as the return value from createImage()
+
If you have called image effect commands on your image (ex:
+ changeImageIntensity), you can call this to restore your image to it's
+ original form.
+
This resizes your image to width, height. The imageToResize parameter is
+ a reference to an image that you saved as the return value from
+ createImage()
+
DEPRECATED: resizeImage now allows the user to pick whether to use fast
+ or smooth resizing from the SuperKaramba menu - This resizes your image
+ to width, height. The imageToResize parameter is a reference to an
+ image that you saved as the return value from createImage()
+
This rotates your image to by the specified amount of degrees. The
+ imageToRotate parameter is a reference to an image that you saved as the
+ return value from createImage()
+
You can reference graph in your python code that was created in the
+ theme file. Basically, you just add a NAME= value to the GRAPH line in
+ the .theme file. Then if you want to use that object, instead of calling
+ createGraph, you can call this function.
+
+
+
The name you pass to the function is the same one that you gave it for
+ the NAME= parameter in the .theme file.
+
SuperKaramba supports a simplistic configuration pop-up menu. This menu
+ appears when you right-click on a widget and choose Configure Theme.
+ Basically, it allows you to have check-able entrys in the menu to allow
+ the user to enable or disable features in your theme.
+
+
+
Before you use any configuration menu stuff, you NEED to add a new
+ callback to your script:
+
+
+
def menuOptionChanged(widget, key, value):
+
+
+
This will get called whenever a config menu option is changed. Now you
+ can add items to the config menu:
+
Key is the name of a key value where the value will be saved
+ automatically into the widget's config file. Name is the actual text that
+ will show up in the config menu.
+
+
+
For example, I could allow the user to enable or disable a clock showing
+ up in my theme:
+
+
+
karamba.addMenuConfigOption(widget, "showclock", "Display a clock")
+
This sets whether or not the given option is checked in the theme's
+ Configure Theme menu. Value should be 0 if key should not be checked and
+ 1 if key should be checked.
+
SuperKaramba automatically supports configuration files for each theme.
+ These files will be saved in /your/home/dir/.superkaramba/ and will be
+ named themenamerc where themename is the name of the theme.
+
+
+
This function writes an entry into the config file with the given key and
+ value.
+
+
+
For example, to save my favorite color, I would do
+ karamba.writeConfigEntry(widget, "FavColor", "Red")
+
You can reference bar in your python code that was created in the
+ theme file. Basically, you just add a NAME= value to the BAR line in
+ the .theme file. Then if you want to use that object, instead of calling
+ createBar, you can call this function.
+
+
+
The name you pass to the function is the same one that you gave it for
+ the NAME= parameter in the .theme file.
+
This shows an bar. In other words, during subsequent calls to
+ widgetUpdate(), this bar will be drawn.
+
+
ARGUMENTS
+
long widget -- karamba
+
+
long bar -- pointer to bar
+
+
+
+
RETURN VALUE
+
1 if successful
+
+
+
+
diff --git a/superkaramba/examples/autoHide/main.py b/superkaramba/examples/autoHide/main.py
new file mode 100644
index 0000000..85e2b37
--- /dev/null
+++ b/superkaramba/examples/autoHide/main.py
@@ -0,0 +1,62 @@
+#this import statement allows access to the karamba functions
+import karamba
+
+hidden = 0
+counter = 0
+
+def initWidget(widget):
+ global hidden
+ hidden = 0
+
+def widgetUpdated(widget):
+ global hidden
+ global counter
+ if hidden == 0:
+ counter = counter + 1
+
+ if (counter > 5):
+ hidden = 1
+ karamba.moveWidget(widget, 0, -210)
+
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetClicked(widget, x, y, button):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ #Warning: Don't do anything too intensive here
+ #You don't want to run some complex piece of code everytime the mouse moves
+ global hidden
+ global counter
+ if (hidden==1):
+ karamba.moveWidget(widget, 0, 0)
+ hidden = 0
+ counter = 0
+
+
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
+
diff --git a/superkaramba/examples/autoHide/main.theme b/superkaramba/examples/autoHide/main.theme
new file mode 100644
index 0000000..fd924dc
--- /dev/null
+++ b/superkaramba/examples/autoHide/main.theme
@@ -0,0 +1,42 @@
+KARAMBA X=0 Y=0 W=390 H=220 LOCKED=true INTERVAL=1000 ONTOP=false
+
+IMAGE X=0 Y=0 PATH="pics/calendar.png"
+
+ X=10 Y=-15
+#CPU
+GRAPH X=5 Y=49 W=293 H=36 SENSOR=CPU POINTS=100 COLOR=100,100,100 INTERVAL=1000
+IMAGE X=0 Y=47 PATH="pics/label3.png"
+BAR X=0 Y=47 W=300 H=40 PATH="pics/bar3.png" SENSOR=CPU
+TEXT X=310 Y=56 SENSOR=CPU FORMAT="%v%" COLOR=200,200,200 FONTSIZE=10 FONT="arial" SHADOW=1
+
+#time
+TEXT X=2 Y=27 SENSOR=TIME COLOR=200,200,200 FONTSIZE=10 FONT="arial" SHADOW=1
+
+#date
+TEXT X=50 Y=31 SENSOR=TIME FORMAT="ddd d MMM" COLOR=180,180,180 FONTSIZE=8 FONT="arial"
+
+#mem
+IMAGE X=0 Y=97 PATH="pics/label3.png"
+BAR X=0 Y=97 W=300 H=40 PATH="pics/bar3.png" SENSOR=MEMORY INTERVAL=2000
+TEXT X=310 Y=106 SENSOR=MEMORY FORMAT="%fmMB" COLOR=200,200,200 FONTSIZE=10 FONT="arial" SHADOW=1
+
+
+#swap
+IMAGE X=0 Y=147 PATH="pics/label4.png"
+BAR X=0 Y=147 W=300 H=20 PATH="pics/bar4.png" SENSOR=MEMORY FORMAT="%us"
+TEXT X=310 Y=151 SENSOR=MEMORY FORMAT="%fsMB" COLOR=170,170,170 FONTSIZE=8 FONT="arial"
+
+
+#network
+GRAPH X=2 Y=179 W=296 H=36 SENSOR=NETWORK FORMAT="%in" POINTS=100 COLOR=100,100,100 MAX=250 INTERVAL=1000
+GRAPH X=2 Y=179 W=296 H=36 SENSOR=NETWORK FORMAT="%out" POINTS=100 COLOR=80,80,80 MAX=250
+IMAGE X=0 Y=177 PATH="pics/label3.png"
+BAR X=0 Y=177 W=300 H=40 PATH="pics/bar3.png" SENSOR=NETWORK FORMAT="%in" MAX=250
+BAR X=0 Y=177 W=300 H=40 PATH="pics/bar3.png" SENSOR=NETWORK FORAMT="%out" MAX=250
+TEXT X=310 Y=182 SENSOR=NETWORK COLOR=200,200,200 FORMAT="%inKBs" FONTSIZE=9 FONT="arial" DECIMALS=1
+TEXT X=310 Y=200 SENSOR=NETWORK COLOR=200,200,200 FORMAT="%outKBs" FONTSIZE=9 FONT="arial" DECIMALS=1
+
+#uptime
+TEXT X=240 Y=32 SENSOR=UPTIME COLOR=190,190,190 FONTSIZE=7 FONT="arial"
+
+
diff --git a/superkaramba/examples/autoHide/pics/MSN-64x64.png b/superkaramba/examples/autoHide/pics/MSN-64x64.png
new file mode 100644
index 0000000..3dc0e39
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/MSN-64x64.png differ
diff --git a/superkaramba/examples/autoHide/pics/MSN-96x96.png b/superkaramba/examples/autoHide/pics/MSN-96x96.png
new file mode 100644
index 0000000..bf0f63a
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/MSN-96x96.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_House-64x64.png b/superkaramba/examples/autoHide/pics/Tux_House-64x64.png
new file mode 100644
index 0000000..c0b657e
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_House-64x64.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_House-96x96.png b/superkaramba/examples/autoHide/pics/Tux_House-96x96.png
new file mode 100644
index 0000000..dc217f3
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_House-96x96.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_Mail-64x64.png b/superkaramba/examples/autoHide/pics/Tux_Mail-64x64.png
new file mode 100644
index 0000000..4e29c4d
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_Mail-64x64.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_Mail-96x96.png b/superkaramba/examples/autoHide/pics/Tux_Mail-96x96.png
new file mode 100644
index 0000000..9de2596
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_Mail-96x96.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_Mozilla-64x64.png b/superkaramba/examples/autoHide/pics/Tux_Mozilla-64x64.png
new file mode 100644
index 0000000..d2413cd
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_Mozilla-64x64.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_Mozilla-96x96.png b/superkaramba/examples/autoHide/pics/Tux_Mozilla-96x96.png
new file mode 100644
index 0000000..5f24afb
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_Mozilla-96x96.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_Sherlock-64x64.png b/superkaramba/examples/autoHide/pics/Tux_Sherlock-64x64.png
new file mode 100644
index 0000000..e883671
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_Sherlock-64x64.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_Sherlock-96x96.png b/superkaramba/examples/autoHide/pics/Tux_Sherlock-96x96.png
new file mode 100644
index 0000000..20628f1
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_Sherlock-96x96.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_Terminal-64x64.png b/superkaramba/examples/autoHide/pics/Tux_Terminal-64x64.png
new file mode 100644
index 0000000..066c318
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_Terminal-64x64.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_Terminal-96x96.png b/superkaramba/examples/autoHide/pics/Tux_Terminal-96x96.png
new file mode 100644
index 0000000..5eedfe1
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_Terminal-96x96.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_iPhoto-64x64.png b/superkaramba/examples/autoHide/pics/Tux_iPhoto-64x64.png
new file mode 100644
index 0000000..9906efc
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_iPhoto-64x64.png differ
diff --git a/superkaramba/examples/autoHide/pics/Tux_iPhoto-96x96.png b/superkaramba/examples/autoHide/pics/Tux_iPhoto-96x96.png
new file mode 100644
index 0000000..aa6450c
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/Tux_iPhoto-96x96.png differ
diff --git a/superkaramba/examples/autoHide/pics/bar3.png b/superkaramba/examples/autoHide/pics/bar3.png
new file mode 100644
index 0000000..c6d4b9e
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/bar3.png differ
diff --git a/superkaramba/examples/autoHide/pics/bar4.png b/superkaramba/examples/autoHide/pics/bar4.png
new file mode 100644
index 0000000..9e87bff
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/bar4.png differ
diff --git a/superkaramba/examples/autoHide/pics/calendar.png b/superkaramba/examples/autoHide/pics/calendar.png
new file mode 100644
index 0000000..fc0e466
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/calendar.png differ
diff --git a/superkaramba/examples/autoHide/pics/ctrl center-64x64.png b/superkaramba/examples/autoHide/pics/ctrl center-64x64.png
new file mode 100644
index 0000000..3c6d78f
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/ctrl center-64x64.png differ
diff --git a/superkaramba/examples/autoHide/pics/ctrl center-96x96.png b/superkaramba/examples/autoHide/pics/ctrl center-96x96.png
new file mode 100644
index 0000000..43e7f3d
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/ctrl center-96x96.png differ
diff --git a/superkaramba/examples/autoHide/pics/iconbarback.png b/superkaramba/examples/autoHide/pics/iconbarback.png
new file mode 100644
index 0000000..8a1f2f5
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/iconbarback.png differ
diff --git a/superkaramba/examples/autoHide/pics/label3.png b/superkaramba/examples/autoHide/pics/label3.png
new file mode 100644
index 0000000..613ae17
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/label3.png differ
diff --git a/superkaramba/examples/autoHide/pics/label4.png b/superkaramba/examples/autoHide/pics/label4.png
new file mode 100644
index 0000000..d6de907
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/label4.png differ
diff --git a/superkaramba/examples/autoHide/pics/osxbarback.png b/superkaramba/examples/autoHide/pics/osxbarback.png
new file mode 100644
index 0000000..cb26088
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/osxbarback.png differ
diff --git a/superkaramba/examples/autoHide/pics/osxbarbackBig.png b/superkaramba/examples/autoHide/pics/osxbarbackBig.png
new file mode 100644
index 0000000..07c6971
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/osxbarbackBig.png differ
diff --git a/superkaramba/examples/autoHide/pics/pointer.png b/superkaramba/examples/autoHide/pics/pointer.png
new file mode 100644
index 0000000..379079a
Binary files /dev/null and b/superkaramba/examples/autoHide/pics/pointer.png differ
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
Binary files /dev/null and b/superkaramba/examples/bar/hor.png differ
diff --git a/superkaramba/examples/bar/ver.png b/superkaramba/examples/bar/ver.png
new file mode 100644
index 0000000..928b869
Binary files /dev/null and b/superkaramba/examples/bar/ver.png differ
diff --git a/superkaramba/examples/change_interval/interval.py b/superkaramba/examples/change_interval/interval.py
new file mode 100644
index 0000000..6c3422a
--- /dev/null
+++ b/superkaramba/examples/change_interval/interval.py
@@ -0,0 +1,60 @@
+#
+# Written by Luke Kenneth Casson Leighton
+
+# This theme is demonstrates the interval timer changing.
+
+#this import statement allows access to the karamba functions
+import karamba
+
+seq = 0
+text = None
+
+#this is called when you widget is initialized
+def initWidget(widget):
+
+ karamba.redrawWidget(widget)
+
+# sequence drops down to zero and changes the time interval to 1 second.
+# keeps counting down thereafter...
+
+def widgetUpdated(widget):
+ global seq
+ global text
+
+ seq -= 1
+
+ if seq <= 0:
+ karamba.changeInterval(widget, 1000)
+
+ if seq <= 0:
+ message = "biding-time seq:%d" % -seq
+ else:
+ message = "wiggle seq:%d" % seq
+
+ # delete previous text if exists.
+ if text is not None:
+ karamba.deleteText(widget, text)
+
+ # display new message
+ text = karamba.createText(widget, 0, 20, 300, 20, message)
+ karamba.changeTextColor(widget, text, 252,252,252)
+
+ karamba.redrawWidget(widget)
+
+# wiggle the mouse over the widget to get the sequence number increased more.
+# also set the refresh rate to 50ms so that the theme has to fight against
+# the wiggling.
+
+def widgetMouseMoved(widget, x, y, button):
+ global seq
+
+ if seq <= 0:
+ seq = 0
+ karamba.changeInterval(widget, 50)
+
+ seq += 1
+
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
+
diff --git a/superkaramba/examples/change_interval/interval.theme b/superkaramba/examples/change_interval/interval.theme
new file mode 100644
index 0000000..5711ece
--- /dev/null
+++ b/superkaramba/examples/change_interval/interval.theme
@@ -0,0 +1,2 @@
+KARAMBA x=200 y=100 w=300 h=40 INTERVAL=200 LOCKED=true
+TEXT x=0 y=0 w=300 h=20 value="wiggle the mouse over me" color=200,252,200
diff --git a/superkaramba/examples/control_management/mgmt.py b/superkaramba/examples/control_management/mgmt.py
new file mode 100644
index 0000000..eae98c2
--- /dev/null
+++ b/superkaramba/examples/control_management/mgmt.py
@@ -0,0 +1,49 @@
+#
+# Written by Luke Kenneth Casson Leighton
+
+#this import statement allows access to the karamba functions
+import karamba
+
+do_nothing_txt = None
+mgmt_txt = None
+
+
+#this is called when you widget is initialized
+def initWidget(widget):
+ global do_nothing_txt
+ global do_something_txt
+
+ # display new message
+ do_nothing_txt = karamba.createText(widget, 0, 00, 300, 20,
+ "Right mouse click me!")
+ karamba.changeTextColor(widget, do_nothing_txt, 252,252,252)
+ mgmt_txt = karamba.createText(widget, 0, 20, 300, 20,
+ "Righ mouse click me too!")
+ karamba.changeTextColor(widget, mgmt_txt, 252,252,252)
+
+ karamba.redrawWidget(widget)
+
+ karamba.setWantRightButton(widget, 1)
+
+def widgetUpdated(widget):
+ karamba.redrawWidget(widget)
+
+def widgetClicked(widget, x, y, button):
+ global do_nothing_txt
+
+ if y < 20:
+ if do_nothing_txt is not None:
+ karamba.deleteText(widget, do_nothing_txt)
+ do_nothing_txt = karamba.createText(widget,
+ 0, 0, 300, 20, "I don't do anything when clicking here.")
+ karamba.changeTextColor(widget, do_nothing_txt,
+ 255,200,200)
+ karamba.redrawWidget(widget)
+ return
+
+ karamba.managementPopup(widget)
+
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
+
diff --git a/superkaramba/examples/control_management/mgmt.theme b/superkaramba/examples/control_management/mgmt.theme
new file mode 100644
index 0000000..f54c88f
--- /dev/null
+++ b/superkaramba/examples/control_management/mgmt.theme
@@ -0,0 +1 @@
+KARAMBA x=200 y=100 w=300 h=40 INTERVAL=200 LOCKED=true
diff --git a/superkaramba/examples/disableRightClickMenu/disable_menu.py b/superkaramba/examples/disableRightClickMenu/disable_menu.py
new file mode 100644
index 0000000..6c524dd
--- /dev/null
+++ b/superkaramba/examples/disableRightClickMenu/disable_menu.py
@@ -0,0 +1,176 @@
+#this import statement allows access to the karamba functions
+import karamba
+
+
+#this is called when your widget is initialized
+def initWidget(widget):
+ global clicked, text2
+ text2 = 0
+ text = 'This theme demonstrates how to manipulate the \nright click menu option.'
+ text += '\nClick the theme with your left mouse button \nto disable and then re-enable the right click menu.'
+ karamba.createText(widget,5,5,400,20,text)
+ clicked = False
+ karamba.redrawWidget(widget)
+
+#This is called when your widget is closed. You can use this to clean
+#up open files, etc. You don't need to delete text and images in your
+#theme. That is done automatically. This callback is just for cleaning up
+#external things. Most people don't need to put anything here.
+def widgetClosed(widget):
+ pass
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ global clicked,text2
+ if clicked and button == 1:
+ clicked = False
+ karamba.setWantRightButton(widget, False)
+ newText = "Enabling the SuperKaramba right click \nconfiguration menu."
+ if text2:
+ karamba.deleteText(widget,text2)
+ text2 = karamba.createText(widget,5,70,400,20,newText)
+ print newText
+ elif not clicked and button == 1:
+ clicked = True
+ karamba.setWantRightButton(widget, True)
+ newText = "Disabling the SuperKaramba right click \nconfiguration menu."
+ if text2:
+ karamba.deleteText(widget,text2)
+ text2 = karamba.createText(widget,5,70,400,20,newText)
+ print newText
+ if button == 3:
+ print "Clicking the right mouse button is recognized now."
+ karamba.redrawWidget(widget)
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ #Warning: Don't do anything too intensive here
+ #You don't want to run some complex piece of code everytime the mouse moves
+ pass
+
+
+#This gets called when an item is clicked in a popup menu you have created.
+# menu = a reference to the menu
+# id = the number of the item that was clicked.
+def menuItemClicked(widget, menu, id):
+ pass
+
+#This gets called when an item is clicked in the theme CONFIGURATION menu,
+#not the popup menus that you create.
+# key = the reference to the configuration key that was changed
+# value = the new value (true or false) that was selected
+def menuOptionChanged(widget, key, value):
+ pass
+
+#This gets called when a meter (image, text, etc) is clicked.
+# NOTE you must use attachClickArea() to make a meter
+# clickable.
+# widget = reference to your theme
+# meter = the meter clicked
+# button = the button clicked (see widgetClicked for button numbers)
+def meterClicked(widget, meter, button):
+ pass
+
+#This gets called when a command you have executed with executeInteractive() outputs something
+#to stdout. This way you can get the output of for example kdialog without freezing up the widget
+#waiting for kdialog to end.
+# widget = reference to your theme
+# pid = process number of the program outputting (use this if you execute more than out process)
+# output = the text the program outputted to stdout
+def commandOutput(widget, pid, output):
+ pass
+
+#This gets called when an item is dropped on this widget.
+# NOTE you have to call acceptDrops() before your widget will accept drops.
+# widget = reference to your theme
+# dropText = the text of the dropped item (probably a URL to it's location in KDE)
+def itemDropped(widget, dropText):
+ pass
+
+
+#This gets called when a new program is LOADING in KDE. When it is done
+#loading, startupRemoved() is called, followed by taskAdded().
+# widget = reference to your widget
+# task = A refence to the task that is starting.
+def startupAdded(widget, startup):
+ pass
+
+#This gets called when a new program is done LOADING in KDE.
+# widget = reference to your widget
+# task = A refence to the task that just finished loading.
+def startupRemoved(widget, startup):
+ pass
+
+#This is called every time a new task (program) is started in KDE.
+# widget = reference to your widget
+# task = A refence to the new task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def taskAdded(widget, task):
+ pass
+
+#This is called everytime a task (program) is closed in KDE.
+# widget = reference to your widget
+# task = A refence to the task.
+def taskRemoved(widget, task):
+ pass
+
+#This is called everytime a different task gains focus (IE, the user clicks
+#on a different window).
+# widget = reference to your widget
+# task = A refence to the task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def activeTaskChanged(widget, task):
+ pass
+
+#This is called everytime the systray you created with createSystray() is updated
+def systrayUpdated(widget):
+ pass
+
+#This is called everytime the current desktop changes
+# widget = reference to your widget
+# desktop = the current desktop
+def desktopChanged(widget, desktop):
+ pass
+
+#This is called everytime the wallpaper changes on a desktop
+# widget = reference to your widget
+# desktop = the desktop whose wallpaper changed
+def wallpaperChanged(widget, desktop):
+ pass
+
+#This is called everytime there is a key press in any focused input field
+# widget = reference to your widget
+# meter = reference to an input box
+# char = the key that was pressed
+def keyPressed(widget, meter, char):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
diff --git a/superkaramba/examples/disableRightClickMenu/disable_menu.theme b/superkaramba/examples/disableRightClickMenu/disable_menu.theme
new file mode 100644
index 0000000..cbd905a
--- /dev/null
+++ b/superkaramba/examples/disableRightClickMenu/disable_menu.theme
@@ -0,0 +1 @@
+karamba x=0 y=0 w=300 h=100 locked=true
diff --git a/superkaramba/examples/globalMouse/README b/superkaramba/examples/globalMouse/README
new file mode 100644
index 0000000..758ce4b
--- /dev/null
+++ b/superkaramba/examples/globalMouse/README
@@ -0,0 +1,29 @@
+
+Karamba Eyes 0.6 by Wilfried.Huss@gmx.at
+----------------------------------------
+
+Karamba Eyes is a implementation of the classic xeyes for superkaramba.
+
+
+INSTALLATION:
+ Karamba Eyes needs a small Python extension module named xcursor
+ which is implemented in the file extension/xcursor.c.
+
+ To build it go to the extension subdirectory and type
+
+ python setup.py build
+
+ (The Python develop package needs to be installed)
+
+ This creates the shared library xcursor.so, probably in a subdirectory
+ named build. This file needs to be copied in the same directory as the
+ eyes.theme and eyes.py file.
+
+ A precompiled xcursor.so file is included (Compiled on Mandrake 9.1).
+
+CHANGES:
+ * Moving the theme now works as it should.
+ * Widget Mask added
+
+TODO:
+ Add Theme Support
diff --git a/superkaramba/examples/globalMouse/extension/setup.py b/superkaramba/examples/globalMouse/extension/setup.py
new file mode 100644
index 0000000..f33f8a6
--- /dev/null
+++ b/superkaramba/examples/globalMouse/extension/setup.py
@@ -0,0 +1,12 @@
+from distutils.core import setup, Extension
+
+module1 = Extension('xcursor',
+ include_dirs = ['/usr/X11R6/include'],
+ libraries = ['X11'],
+ library_dirs = ['/usr/X11R6/lib'],
+ sources = ['xcursor.c'])
+
+setup (name = 'XMouseCursor',
+ version = '1.0',
+ description = 'Determines the position of the X mouse cursor',
+ ext_modules = [module1])
diff --git a/superkaramba/examples/globalMouse/extension/xcursor.c b/superkaramba/examples/globalMouse/extension/xcursor.c
new file mode 100644
index 0000000..8dad240
--- /dev/null
+++ b/superkaramba/examples/globalMouse/extension/xcursor.c
@@ -0,0 +1,104 @@
+/*
+ * This module is based on code by found in comp.lang.python:
+ * http://groups.google.at/groups?q=%22Re:+X+Gurus%22+group:comp.lang.python.*&hl=de&lr=&ie=UTF-8&selm=imnv4.314%24qL4.17232%40newsread1.prod.itd.earthlink.net&rnum=2
+ *
+ * Build with:
+ * python setup.py build
+ *
+ * Copyright (C) 2003 Hans Karlsson
+ * Copyright (C) 2003-2004 Adam Geitgey
+ * Copyright (c) 2005 Ryan Nickell
+ *
+ * This file is part of Superkaramba.
+ *
+ * Superkaramba is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Superkaramba is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Superkaramba; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ ****************************************************************************/
+
+#include
+
+#include
+#include
+#include
+#include
+
+static Display* display = 0;
+static Window root;
+static int screen;
+
+
+static PyObject* xcursor_position(self, args)
+ PyObject* self;
+ PyObject* args;
+{
+ /* Determine X Cursor coordinates */
+ Window root_return, child_return;
+ char* display_name;
+ int root_x_return, root_y_return;
+ int win_x_return, win_y_return;
+ unsigned int mask_return;
+
+ if (! (display_name = getenv("DISPLAY")) )
+ {
+ /* add error handling! */
+
+ /*
+ * fprintf(stderr,"environment variable DISPLAY must be set\n");
+ * exit(-1);
+ */
+
+ return NULL;
+ }
+
+ if ( display == 0)
+ {
+ if (! (display = XOpenDisplay(display_name)) )
+ {
+ /* add error handling! */
+
+ /*
+ * fprintf(stderr,"%s: Cannot open display %s\n", argv[0],
+ * display_name);
+ * exit(-1);
+ */
+
+ return NULL;
+ }
+
+ screen = DefaultScreen(display);
+ root = RootWindow(display, screen);
+ }
+
+ XQueryPointer(display, root, &root_return, &child_return,
+ &root_x_return, &root_y_return,
+ &win_x_return, &win_y_return,
+ &mask_return);
+
+ /* return Python Object */
+ return Py_BuildValue("(i,i)", root_x_return, root_y_return);
+}
+
+/* Method Table */
+static PyMethodDef xcursorMethods[] =
+{
+ {"position", xcursor_position, METH_VARARGS, "Query X Cursor Coordinates"},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+void initxcursor(void)
+{
+ (void) Py_InitModule("xcursor", xcursorMethods);
+}
+
+
diff --git a/superkaramba/examples/globalMouse/eyes.py b/superkaramba/examples/globalMouse/eyes.py
new file mode 100644
index 0000000..b95f86d
--- /dev/null
+++ b/superkaramba/examples/globalMouse/eyes.py
@@ -0,0 +1,192 @@
+#this import statement allows access to the karamba functions
+import karamba
+
+#import os
+import string
+import math
+import re
+
+import xcursor
+
+linkePupille = ""
+rechtePupille = ""
+
+init = 0
+
+#old curser pos
+x_old = -1
+y_old = -1
+
+#widget size
+w_width = 167
+w_height = 111
+
+#widget pos
+w_x = 10
+w_y = 850
+
+#eye center
+lx, ly = 39, 55
+rx, ry = 126, 55
+
+#eye size
+la, lb = 25, 38
+ra, rb = 25, 38
+
+#pupille size
+lp_width, lp_height = 11, 17
+rp_width, rp_height = 11, 17
+
+def pupille(mouse_x, mouse_y, eye_center_x, eye_center_y, eye_a, eye_b, widget_x, widget_y):
+ x = mouse_x - eye_center_x - widget_x
+ y = mouse_y - eye_center_y - widget_y
+ #print x, y
+
+ r = math.sqrt(x * x + y * y)
+ phi = math.atan2(y, x)
+ #print phi * math.pi
+
+ eye_x = eye_a * math.cos(phi)
+ eye_y = eye_b * math.sin(phi)
+
+ eye_r = math.sqrt(eye_x * eye_x + eye_y * eye_y)
+
+ if eye_r < r:
+ return int(eye_x + eye_center_x), int(eye_y + eye_center_y)
+
+ return int(x + eye_center_x), int(y + eye_center_y)
+
+
+#this is called when you widget is initialized
+def initWidget(widget):
+ pass
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ global init
+ global linkePupille
+ global rechtePupille
+
+ global w_width
+ global w_height
+
+ global w_x
+ global w_y
+
+ global lx
+ global ly
+ global la
+ global lb
+
+ global lp_width
+ global lp_height
+
+ global rx
+ global ry
+ global ra
+ global rb
+
+ global rp_width
+ global rp_height
+
+ global x_old
+ global y_old
+
+ if init == 0:
+ theme_path = karamba.getThemePath(widget) + "/"
+
+ # read widget coordinates from eyes.theme
+ # f = open(theme_path + "eyes.theme")
+
+ # karamba_line = ""
+ #while re.compile('KARAMBA').search(karamba_line) == None:
+ # karamba_line = f.readline()
+
+ #w_x = int(re.compile('X=([0-9]+)').search(karamba_line).group(1))
+ #w_y = int(re.compile('Y=([0-9]+)').search(karamba_line).group(1))
+
+ #f.close()
+
+ #karamba.createWidgetMask(widget, theme_path + "pics/mask.png")
+
+ linkePupille = karamba.createImage(widget, 15, 30, theme_path + "pics/pupille.png")
+ rechtePupille = karamba.createImage(widget, 100, 30, theme_path + "pics/pupille.png")
+ init = 1
+
+ karamba.redrawWidget(widget)
+
+ # query mouse-cursor position
+ x, y = xcursor.position()
+
+ #fp = os.popen("./xpos")
+ #output = fp.read()
+ #x, y = output.split()
+
+ #print x, y
+
+ if x != x_old or y != y_old:
+ x_old, y_old = x, y
+ # Get Widget Position
+ w_x, w_y = karamba.getWidgetPosition(widget)
+
+ # Calc left pupille
+ xp, yp = pupille (int(x), int(y), lx, ly, la, lb, w_x, w_y)
+
+ xp = xp - lp_width / 2
+ yp = yp - lp_height / 2
+ #print xp, yp
+
+ karamba.moveImage(widget, linkePupille, xp, yp)
+
+ # Calc right pupille
+ xp, yp = pupille (int(x), int(y), rx, ry, ra, rb, w_x, w_y)
+
+ xp = xp - rp_width / 2
+ yp = yp - rp_height / 2
+ #print xp, yp
+
+ karamba.moveImage(widget, rechtePupille, xp, yp)
+
+ karamba.redrawWidget(widget)
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ #Warning: Don't do anything too intensive here
+ #You don't want to run some complex piece of code everytime the mouse moves
+ pass
+ #global linkePupille
+
+ #karamba.moveImage(widget, linkePupille, x, y)
+ #karamba.redrawWidget(widget)
+
+
+# This will be printed when the widget loads.
+print "Loaded Karamba Eyes"
+
diff --git a/superkaramba/examples/globalMouse/eyes.theme b/superkaramba/examples/globalMouse/eyes.theme
new file mode 100644
index 0000000..4f2417b
--- /dev/null
+++ b/superkaramba/examples/globalMouse/eyes.theme
@@ -0,0 +1,3 @@
+KARAMBA X=5 Y=850 W=167 H=111 MASK="pics/mask.png" LOCKED=false INTERVAL=100
+
+IMAGE X=0 Y=0 PATH="pics/eyes.png"
diff --git a/superkaramba/examples/globalMouse/pics/eyes.png b/superkaramba/examples/globalMouse/pics/eyes.png
new file mode 100644
index 0000000..50823d0
Binary files /dev/null and b/superkaramba/examples/globalMouse/pics/eyes.png differ
diff --git a/superkaramba/examples/globalMouse/pics/eyes.xcf b/superkaramba/examples/globalMouse/pics/eyes.xcf
new file mode 100644
index 0000000..3f097d1
Binary files /dev/null and b/superkaramba/examples/globalMouse/pics/eyes.xcf differ
diff --git a/superkaramba/examples/globalMouse/pics/mask.png b/superkaramba/examples/globalMouse/pics/mask.png
new file mode 100644
index 0000000..cf8fc03
Binary files /dev/null and b/superkaramba/examples/globalMouse/pics/mask.png differ
diff --git a/superkaramba/examples/globalMouse/pics/pupille.png b/superkaramba/examples/globalMouse/pics/pupille.png
new file mode 100644
index 0000000..11d971b
Binary files /dev/null and b/superkaramba/examples/globalMouse/pics/pupille.png differ
diff --git a/superkaramba/examples/globalMouse/xcursor.so b/superkaramba/examples/globalMouse/xcursor.so
new file mode 100755
index 0000000..1ff08d5
Binary files /dev/null and b/superkaramba/examples/globalMouse/xcursor.so differ
diff --git a/superkaramba/examples/graph/graph.py b/superkaramba/examples/graph/graph.py
new file mode 100644
index 0000000..5798612
--- /dev/null
+++ b/superkaramba/examples/graph/graph.py
@@ -0,0 +1,89 @@
+#this import statement allows access to the karamba functions
+import karamba
+
+graphs = [0,0,0,0,0,0,0,0]
+b = 0
+
+#this is called when you widget is initialized
+def initWidget(widget):
+ global graphs
+ graphs[0] = karamba.getThemeGraph(widget, "graph0")
+ graphs[1] = karamba.getThemeGraph(widget, "graph1")
+ graphs[2] = karamba.getThemeGraph(widget, "graph2")
+ graphs[3] = karamba.getThemeGraph(widget, "graph3")
+ graphs[4] = karamba.getThemeGraph(widget, "graph4")
+ graphs[5] = karamba.getThemeGraph(widget, "graph5")
+ graphs[6] = karamba.getThemeGraph(widget, "graph6")
+ graphs[7] = karamba.getThemeGraph(widget, "graph7")
+
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ global graphs, b
+
+ b = (b+1)%2
+
+ # Create & delete
+ if(graphs[0]):
+ karamba.deleteGraph(widget, graphs[0])
+ graphs[0] = 0
+ print "Deleted graph."
+ else:
+ graphs[0] = karamba.createGraph(widget, 0, 20, 400, 30, 400)
+ print "Created graph: " + str(graphs[0])
+
+ # size & resize
+ size = karamba.getGraphSize(widget, graphs[1])
+ print "getGraphSize: " + str(size)
+ size = ((b * 200) + 200, size[1])
+ karamba.resizeGraph(widget, graphs[1], size[0], size[1])
+
+ # pos & move
+ pos = karamba.getGraphPos(widget, graphs[2])
+ print "getGraphPos: " + str(pos)
+ pos = (b * 200, pos[1])
+ karamba.moveGraph(widget, graphs[2], pos[0], pos[1])
+
+ # Hide & Show
+ if(b):
+ karamba.hideGraph(widget, graphs[3])
+ else:
+ karamba.showGraph(widget, graphs[3])
+
+ # Sensor
+ sensor = karamba.getGraphSensor(widget, graphs[4])
+ print "getSensor: " + str(sensor)
+ if(b):
+ karamba.setGraphSensor(widget, graphs[4], 'SENSOR=NETWORK FORMAT="%in"')
+ else:
+ karamba.setGraphSensor(widget, graphs[4], 'SENSOR=CPU')
+
+ # Min Max
+ minmax = karamba.getGraphMinMax(widget, graphs[5])
+ print "getGraphMinMax: " + str(minmax)
+ minmax = (0, (b * 25) + 25)
+ karamba.setGraphMinMax(widget, graphs[5], minmax[0], minmax[1])
+
+ # Value
+ v = karamba.getGraphValue(widget, graphs[6])
+ print "getGraphValue: ", v
+ v = (v + 1) % 30
+ karamba.setGraphValue(widget, graphs[6], v)
+
+ # Color
+ c = karamba.getGraphColor(widget, graphs[7])
+ print "getGraphColor: ", c
+ r = (c[0] + 10) % 255
+ g = (c[1] + 10) % 255
+ bl = (c[2] + 10) % 255
+ karamba.setGraphColor(widget, graphs[7], r, g, bl)
+
+def widgetClicked(widget, x, y, button):
+ pass
+
+def widgetMouseMoved(widget, x, y, button):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded Graph test python extension!"
diff --git a/superkaramba/examples/graph/graph.theme b/superkaramba/examples/graph/graph.theme
new file mode 100644
index 0000000..d16c8b3
--- /dev/null
+++ b/superkaramba/examples/graph/graph.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="createGraph & deleteGraph" name=text0
+GRAPH X=0 Y=20 W=400 H=30 POINTS=400 SENSOR=NETWORK FORMAT="%in" COLOR=192,192,192 MAX=50 NAME=graph0
+
+TEXT x=0 Y=50 w=600 h=20 VALUE="getGraphSize & resizeGraph" name=text1
+GRAPH X=0 Y=70 W=400 H=30 POINTS=200 SENSOR=NETWORK FORMAT="%in" COLOR=192,192,192 MAX=50 NAME=graph1
+
+TEXT x=0 Y=100 w=600 h=20 VALUE="getGraphPos & moveGraph" name=text2
+GRAPH X=0 Y=120 W=200 H=30 POINTS=200 SENSOR=NETWORK FORMAT="%in" COLOR=192,192,192 MAX=50 NAME=graph2
+
+TEXT x=0 Y=150 w=600 h=20 VALUE="hideGraph & showGraph" name=text3
+GRAPH X=0 Y=170 W=200 H=30 POINTS=200 SENSOR=NETWORK FORMAT="%in" COLOR=192,192,192 MAX=50 NAME=graph3
+
+TEXT x=0 Y=200 w=600 h=20 VALUE="getGraphSensor & setGraphSensor" name=text4
+GRAPH X=0 Y=220 W=200 H=30 POINTS=200 SENSOR=NETWORK FORMAT="%in" COLOR=192,192,192 MAX=50 NAME=graph4
+
+TEXT x=0 Y=250 w=600 h=20 VALUE="getGraphMinMax & setGraphMinMax" name=text5
+GRAPH X=0 Y=270 W=200 H=30 POINTS=200 SENSOR=NETWORK FORMAT="%in" COLOR=192,192,192 MAX=50 NAME=graph5
+
+TEXT x=0 Y=300 w=600 h=20 VALUE="getGraphValue & setGraphValue" name=text6
+GRAPH X=0 Y=320 W=200 H=30 POINTS=200 COLOR=192,192,192 NAME=graph6 MAX=30
+
+TEXT x=0 Y=350 w=600 h=20 VALUE="getGraphColor & setGraphColor" name=text7
+GRAPH X=0 Y=370 W=200 H=30 POINTS=200 SENSOR=NETWORK FORMAT="%in" COLOR=192,192,192 MAX=50 NAME=graph7
diff --git a/superkaramba/examples/image/flag.png b/superkaramba/examples/image/flag.png
new file mode 100644
index 0000000..0e3c9b5
Binary files /dev/null and b/superkaramba/examples/image/flag.png differ
diff --git a/superkaramba/examples/image/flag2.png b/superkaramba/examples/image/flag2.png
new file mode 100644
index 0000000..4946213
Binary files /dev/null and b/superkaramba/examples/image/flag2.png differ
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
diff --git a/superkaramba/examples/input_api/input_api.py b/superkaramba/examples/input_api/input_api.py
new file mode 100644
index 0000000..59dc9ba
--- /dev/null
+++ b/superkaramba/examples/input_api/input_api.py
@@ -0,0 +1,185 @@
+#this import statement allows access to the karamba functions
+import karamba
+import os
+
+input1 = 0
+input2 = 0
+output = 0
+i = 0
+fontSize = 0
+
+#this is called when your widget is initialized
+def initWidget(widget):
+ global input1, input2, output, fontSize
+ #input = karamba.getThemeInputBox(widget, "input01")
+ input1 = karamba.createInputBox(widget,0,0,50,20,"foo")
+ input2 = karamba.createInputBox(widget,0,30,50,20,"bar")
+ fontSize = karamba.getInputBoxFontSize(widget, input2)
+ output = karamba.getThemeText(widget, "output01")
+ karamba.changeTextColor(widget, output, 0, 0, 0)
+ karamba.changeTextSize(widget, output, 10)
+ karamba.redrawWidget(widget)
+
+#This is called when your widget is closed. You can use this to clean
+#up open files, etc. You don't need to delete text and images in your
+#theme. That is done automatically. This callback is just for cleaning up
+#external things. Most people don't need to put anything here.
+def widgetClosed(widget):
+ pass
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ global input1, input2, i, fontSize
+ #Change the font in the input box
+ if i == 0:
+ karamba.changeInputBoxFont(widget, input1, "times" )
+ karamba.changeInputBoxFontColor(widget, input1, 0, 0, 0)
+ karamba.changeInputBoxBackgroundColor(widget, input1, 255,255,255)
+
+ karamba.changeInputBoxFrameColor(widget, input2, 0, 0, 255)
+ karamba.changeInputBoxFontSize(widget, input2, fontSize)
+ else:
+ karamba.changeInputBoxFont(widget, input1, "luxi sans" )
+ karamba.changeInputBoxFontColor(widget, input1, 255, 0, 0)
+ karamba.changeInputBoxBackgroundColor(widget, input1, 0, 0, 0)
+
+ karamba.changeInputBoxFrameColor(widget, input2, 255, 255, 255)
+ karamba.changeInputBoxFontSize(widget, input2, 14)
+
+ i += 1
+ if i == 2:
+ i = 0
+ karamba.redrawWidget(widget)
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ #Warning: Don't do anything too intensive here
+ #You don't want to run some complex piece of code everytime the mouse moves
+ pass
+
+
+#This gets called when an item is clicked in a popup menu you have created.
+# menu = a reference to the menu
+# id = the number of the item that was clicked.
+def menuItemClicked(widget, menu, id):
+ pass
+
+#This gets called when an item is clicked in the theme CONFIGURATION menu,
+#not the popup menus that you create.
+# key = the reference to the configuration key that was changed
+# value = the new value (true or false) that was selected
+def menuOptionChanged(widget, key, value):
+ pass
+
+#This gets called when a meter (image, text, etc) is clicked.
+# NOTE you must use attachClickArea() to make a meter
+# clickable.
+# widget = reference to your theme
+# meter = the meter clicked
+# button = the button clicked (see widgetClicked for button numbers)
+def meterClicked(widget, meter, button):
+ pass
+
+#This gets called when a command you have executed with executeInteractive() outputs something
+#to stdout. This way you can get the output of for example kdialog without freezing up the widget
+#waiting for kdialog to end.
+# widget = reference to your theme
+# pid = process number of the program outputting (use this if you execute more than out process)
+# output = the text the program outputted to stdout
+def commandOutput(widget, pid, output):
+ pass
+
+#This gets called when an item is dropped on this widget.
+# NOTE you have to call acceptDrops() before your widget will accept drops.
+# widget = reference to your theme
+# dropText = the text of the dropped item (probably a URL to it's location in KDE)
+def itemDropped(widget, dropText):
+ pass
+
+
+#This gets called when a new program is LOADING in KDE. When it is done
+#loading, startupRemoved() is called, followed by taskAdded().
+# widget = reference to your widget
+# task = A refence to the task that is starting.
+def startupAdded(widget, startup):
+ pass
+
+#This gets called when a new program is done LOADING in KDE.
+# widget = reference to your widget
+# task = A refence to the task that just finished loading.
+def startupRemoved(widget, startup):
+ pass
+
+#This is called every time a new task (program) is started in KDE.
+# widget = reference to your widget
+# task = A refence to the new task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def taskAdded(widget, task):
+ pass
+
+#This is called everytime a task (program) is closed in KDE.
+# widget = reference to your widget
+# task = A refence to the task.
+def taskRemoved(widget, task):
+ pass
+
+#This is called everytime a different task gains focus (IE, the user clicks
+#on a different window).
+# widget = reference to your widget
+# task = A refence to the task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def activeTaskChanged(widget, task):
+ pass
+
+#This is called everytime the systray you created with createSystray() is updated
+def systrayUpdated(widget):
+ pass
+
+#This is called everytime the current desktop changes
+# widget = reference to your widget
+# desktop = the current desktop
+def desktopChanged(widget, desktop):
+ pass
+
+#This is called everytime the wallpaper changes on a desktop
+# widget = reference to your widget
+# desktop = the desktop whose wallpaper changed
+def wallpaperChanged(widget, desktop):
+ pass
+
+#This is called everytime there is a key press in any focused input field
+# widget = reference to your widget
+# meter = reference to an input box
+# char = the key that was pressed
+def keyPressed(widget, meter, char):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
diff --git a/superkaramba/examples/input_api/input_api.theme b/superkaramba/examples/input_api/input_api.theme
new file mode 100644
index 0000000..2cb5ee3
--- /dev/null
+++ b/superkaramba/examples/input_api/input_api.theme
@@ -0,0 +1,5 @@
+KARAMBA x=0 y=0 w=100 h=50 INTERVAL=1000 LOCKED=true
+DEFAULTFONT font="Bitstream Vera Sans" fontsize=16 color=200,200,200
+
+#INPUT x=0 y=0 w=100 h=25 name=input01
+TEXT x=0 y=30 w=100 h=25 name=output01
diff --git a/superkaramba/examples/input_example/input_example.py b/superkaramba/examples/input_example/input_example.py
new file mode 100644
index 0000000..c0145c9
--- /dev/null
+++ b/superkaramba/examples/input_example/input_example.py
@@ -0,0 +1,169 @@
+#this import statement allows access to the karamba functions
+import karamba
+import os
+
+input = 0
+output = 0
+i = 0
+
+#this is called when your widget is initialized
+def initWidget(widget):
+ global input, output
+ #input = karamba.getThemeInputBox(widget, "input01")
+ input = karamba.createInputBox(widget,0,0,50,20,"foo")
+ output = karamba.getThemeText(widget, "output01")
+ karamba.changeTextColor(widget, output, 0, 0, 0)
+ karamba.changeTextSize(widget, output, 10)
+ karamba.redrawWidget(widget)
+
+#This is called when your widget is closed. You can use this to clean
+#up open files, etc. You don't need to delete text and images in your
+#theme. That is done automatically. This callback is just for cleaning up
+#external things. Most people don't need to put anything here.
+def widgetClosed(widget):
+ pass
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ #Warning: Don't do anything too intensive here
+ #You don't want to run some complex piece of code everytime the mouse moves
+ pass
+
+
+#This gets called when an item is clicked in a popup menu you have created.
+# menu = a reference to the menu
+# id = the number of the item that was clicked.
+def menuItemClicked(widget, menu, id):
+ pass
+
+#This gets called when an item is clicked in the theme CONFIGURATION menu,
+#not the popup menus that you create.
+# key = the reference to the configuration key that was changed
+# value = the new value (true or false) that was selected
+def menuOptionChanged(widget, key, value):
+ pass
+
+#This gets called when a meter (image, text, etc) is clicked.
+# NOTE you must use attachClickArea() to make a meter
+# clickable.
+# widget = reference to your theme
+# meter = the meter clicked
+# button = the button clicked (see widgetClicked for button numbers)
+def meterClicked(widget, meter, button):
+ pass
+
+#This gets called when a command you have executed with executeInteractive() outputs something
+#to stdout. This way you can get the output of for example kdialog without freezing up the widget
+#waiting for kdialog to end.
+# widget = reference to your theme
+# pid = process number of the program outputting (use this if you execute more than out process)
+# output = the text the program outputted to stdout
+def commandOutput(widget, pid, output):
+ pass
+
+#This gets called when an item is dropped on this widget.
+# NOTE you have to call acceptDrops() before your widget will accept drops.
+# widget = reference to your theme
+# dropText = the text of the dropped item (probably a URL to it's location in KDE)
+def itemDropped(widget, dropText):
+ pass
+
+
+#This gets called when a new program is LOADING in KDE. When it is done
+#loading, startupRemoved() is called, followed by taskAdded().
+# widget = reference to your widget
+# task = A refence to the task that is starting.
+def startupAdded(widget, startup):
+ pass
+
+#This gets called when a new program is done LOADING in KDE.
+# widget = reference to your widget
+# task = A refence to the task that just finished loading.
+def startupRemoved(widget, startup):
+ pass
+
+#This is called every time a new task (program) is started in KDE.
+# widget = reference to your widget
+# task = A refence to the new task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def taskAdded(widget, task):
+ pass
+
+#This is called everytime a task (program) is closed in KDE.
+# widget = reference to your widget
+# task = A refence to the task.
+def taskRemoved(widget, task):
+ pass
+
+#This is called everytime a different task gains focus (IE, the user clicks
+#on a different window).
+# widget = reference to your widget
+# task = A refence to the task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def activeTaskChanged(widget, task):
+ pass
+
+#This is called everytime the systray you created with createSystray() is updated
+def systrayUpdated(widget):
+ pass
+
+#This is called everytime the current desktop changes
+# widget = reference to your widget
+# desktop = the current desktop
+def desktopChanged(widget, desktop):
+ pass
+
+#This is called everytime the wallpaper changes on a desktop
+# widget = reference to your widget
+# desktop = the desktop whose wallpaper changed
+def wallpaperChanged(widget, desktop):
+ pass
+
+def keyPressed(widget, meter, char):
+ global input, output
+ if meter == input:
+ print "keyPressed: key= '", char, "'"
+ text = karamba.getInputBoxValue(widget, input)
+ karamba.changeText(widget, output, "Searched: " + text)
+ try:
+ if ord(char) == 13: # Enter
+ url = "konqueror leo:" + text
+ os.system(url + "&")
+ except TypeError:
+ print "There was a type error"
+ karamba.redrawWidget(widget)
+
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
diff --git a/superkaramba/examples/input_example/input_example.theme b/superkaramba/examples/input_example/input_example.theme
new file mode 100644
index 0000000..2cb5ee3
--- /dev/null
+++ b/superkaramba/examples/input_example/input_example.theme
@@ -0,0 +1,5 @@
+KARAMBA x=0 y=0 w=100 h=50 INTERVAL=1000 LOCKED=true
+DEFAULTFONT font="Bitstream Vera Sans" fontsize=16 color=200,200,200
+
+#INPUT x=0 y=0 w=100 h=25 name=input01
+TEXT x=0 y=30 w=100 h=25 name=output01
diff --git a/superkaramba/examples/mouseDrag/karmix/images/bar.png b/superkaramba/examples/mouseDrag/karmix/images/bar.png
new file mode 100644
index 0000000..ac893be
Binary files /dev/null and b/superkaramba/examples/mouseDrag/karmix/images/bar.png differ
diff --git a/superkaramba/examples/mouseDrag/karmix/images/bg.png b/superkaramba/examples/mouseDrag/karmix/images/bg.png
new file mode 100644
index 0000000..a69b85b
Binary files /dev/null and b/superkaramba/examples/mouseDrag/karmix/images/bg.png differ
diff --git a/superkaramba/examples/mouseDrag/karmix/karmix.py b/superkaramba/examples/mouseDrag/karmix/karmix.py
new file mode 100644
index 0000000..225eefb
--- /dev/null
+++ b/superkaramba/examples/mouseDrag/karmix/karmix.py
@@ -0,0 +1,190 @@
+# Karmix 0.1
+# Written by Tian ( http://www.c-sait.net )
+# Functionality moved by Ryan Nickell (p0z3r@mail.com)
+
+# This theme is demonstrates how to use mouse buttons
+# being dragged in a theme.
+# It shows how to use it for slider bars, but you can
+# also apply this to anything you want like moving images
+# and other things programmatically.
+
+#this import statement allows access to the karamba functions
+import karamba
+
+import ossaudiodev
+
+mixer = ""
+onLeftButton = 0
+onMidButton = 0
+#this is called when you widget is initialized
+def initWidget(widget):
+ global mixer
+ mixer = ossaudiodev.openmixer()
+
+ vol_main = karamba.getThemeImage(widget, "vol_main")
+ (l, r) = mixer.get(ossaudiodev.SOUND_MIXER_VOLUME)
+ vol_main_value = max(l, r)
+ karamba.resizeImage(widget, vol_main, vol_main_value, 10)
+
+ vol_pcm = karamba.getThemeImage(widget, "vol_pcm")
+ (l, r) = mixer.get(ossaudiodev.SOUND_MIXER_PCM)
+ vol_pcm_value = max(l, r)
+ karamba.resizeImage(widget, vol_pcm, vol_pcm_value, 10)
+
+ vol_cd = karamba.getThemeImage(widget, "vol_cd")
+ (l, r) = mixer.get(ossaudiodev.SOUND_MIXER_CD)
+ vol_cd_value = max(l, r)
+ karamba.resizeImage(widget, vol_cd, vol_cd_value, 10)
+
+ vol_mic = karamba.getThemeImage(widget, "vol_mic")
+ (l, r) = mixer.get(ossaudiodev.SOUND_MIXER_MIC)
+ vol_mic_value = max(l, r)
+ karamba.resizeImage(widget, vol_mic, vol_mic_value, 10)
+
+ karamba.redrawWidget(widget)
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ global onMidButton,onLeftButton
+ global mixer
+ if(button == 1 and onLeftButton == 0):
+ # We are holding the left button here
+ if ((y>=17) and (y<=28)):
+ vol_main = karamba.getThemeImage(widget, "vol_main")
+ vol_main_value = max(min(x-40,100),0)
+ karamba.resizeImage(widget, vol_main, vol_main_value, 10)
+ mixer.set(ossaudiodev.SOUND_MIXER_VOLUME, (vol_main_value, vol_main_value))
+ karamba.redrawWidget(widget)
+
+ if ((y>=47) and (y<=58)):
+ vol_pcm = karamba.getThemeImage(widget, "vol_pcm")
+ vol_pcm_value = max(min(x-40,100),0)
+ karamba.resizeImage(widget, vol_pcm, vol_pcm_value, 10)
+ mixer.set(ossaudiodev.SOUND_MIXER_PCM, (vol_pcm_value, vol_pcm_value))
+ karamba.redrawWidget(widget)
+
+ if ((y>=77) and (y<=88)):
+ vol_cd = karamba.getThemeImage(widget, "vol_cd")
+ vol_cd_value = max(min(x-40,100),0)
+ karamba.resizeImage(widget, vol_cd, vol_cd_value, 10)
+ mixer.set(ossaudiodev.SOUND_MIXER_CD, (vol_cd_value, vol_cd_value))
+ karamba.redrawWidget(widget)
+
+ if ((y>=107) and (y<=118)):
+ vol_mic = karamba.getThemeImage(widget, "vol_mic")
+ vol_mic_value = max(min(x-40,100),0)
+ karamba.resizeImage(widget, vol_mic, vol_mic_value, 10)
+ mixer.set(ossaudiodev.SOUND_MIXER_MIC, (vol_mic_value, vol_mic_value))
+ karamba.redrawWidget(widget)
+
+ if(button == 2 and onMidButton == 0):
+ # We are holding the middle button here
+ pass
+
+#This gets called when an item is clicked in a popup menu you have created.
+# menu = a reference to the menu
+# id = the number of the item that was clicked.
+def menuItemClicked(widget, menu, id):
+ pass
+
+#This gets called when an item is clicked in the theme CONFIGURATION menu,
+#not the popup menus that you create.
+# key = the reference to the configuration key that was changed
+# value = the new value (true or false) that was selected
+def menuOptionChanged(widget, key, value):
+ pass
+
+#This gets called when a meter (image, text, etc) is clicked.
+# NOTE you must use attachClickArea() to make a meter
+# clickable.
+# widget = reference to your theme
+# meter = the meter clicked
+# button = the button clicked (see widgetClicked for button numbers)
+def meterClicked(widget, meter, button):
+ pass
+
+#This gets called when a command you have executed with executeInteractive() outputs something
+#to stdout. This way you can get the output of for example kdialog without freezing up the widget
+#waiting for kdialog to end.
+# widget = reference to your theme
+# pid = process number of the program outputting (use this if you execute more than out process)
+# output = the text the program outputted to stdout
+def commandOutput(widget, pid, output):
+ pass
+
+#This gets called when an item is dropped on this widget.
+# NOTE you have to call acceptDrops() before your widget will accept drops.
+# widget = reference to your theme
+# dropText = the text of the dropped item (probably a URL to it's location in KDE)
+def itemDropped(widget, dropText):
+ pass
+
+
+#This gets called when a new program is LOADING in KDE. When it is done
+#loading, startupRemoved() is called, followed by taskAdded().
+# widget = reference to your widget
+# task = A refence to the task that is starting.
+def startupAdded(widget, startup):
+ pass
+
+#This gets called when a new program is done LOADING in KDE.
+# widget = reference to your widget
+# task = A refence to the task that just finished loading.
+def startupRemoved(widget, startup):
+ pass
+
+#This is called every time a new task (program) is started in KDE.
+# widget = reference to your widget
+# task = A refence to the new task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def taskAdded(widget, task):
+ pass
+
+#This is called everytime a task (program) is closed in KDE.
+# widget = reference to your widget
+# task = A refence to the task.
+def taskRemoved(widget, task):
+ pass
+
+#This is called everytime a different task gains focus (IE, the user clicks
+#on a different window).
+# widget = reference to your widget
+# task = A refence to the task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def activeTaskChanged(widget, task):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
+
diff --git a/superkaramba/examples/mouseDrag/karmix/karmix.theme b/superkaramba/examples/mouseDrag/karmix/karmix.theme
new file mode 100644
index 0000000..3844663
--- /dev/null
+++ b/superkaramba/examples/mouseDrag/karmix/karmix.theme
@@ -0,0 +1,17 @@
+# Karmix 0.1
+# Written by Tian ( http://www.c-sait.net )
+
+karamba x=0 y=0 w=160 h=139 locked=true
+image x=0 y=0 path="images/bg.png"
+
+text x=10 y=15 value="Vol" color=252,252,252 fontsize=12 font="sans"
+image x=40 y=17 path="images/bar.png" name="vol_main"
+
+text x=10 y=45 value="Pcm" color=252,252,252 fontsize=12 font="sans"
+image x=40 y=47 path="images/bar.png" name="vol_pcm"
+
+text x=10 y=75 value="CD" color=252,252,252 fontsize=12 font="sans"
+image x=40 y=77 path="images/bar.png" name="vol_cd"
+
+text x=10 y=105 value="Mic" color=252,252,252 fontsize=12 font="sans"
+image x=40 y=107 path="images/bar.png" name="vol_mic"
diff --git a/superkaramba/examples/mouseDrop/mousedrop.py b/superkaramba/examples/mouseDrop/mousedrop.py
new file mode 100644
index 0000000..521f0ee
--- /dev/null
+++ b/superkaramba/examples/mouseDrop/mousedrop.py
@@ -0,0 +1,138 @@
+# Drop Detect
+# Written by Luke Kenneth Casson Leighton
+
+# This theme is demonstrates how to
+
+#this import statement allows access to the karamba functions
+import karamba
+
+drop_txt = None
+
+#this is called when you widget is initialized
+def initWidget(widget):
+
+ karamba.acceptDrops(widget)
+ karamba.redrawWidget(widget)
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ pass
+
+#This gets called when an item is clicked in a popup menu you have created.
+# menu = a reference to the menu
+# id = the number of the item that was clicked.
+def menuItemClicked(widget, menu, id):
+ pass
+
+#This gets called when an item is clicked in the theme CONFIGURATION menu,
+#not the popup menus that you create.
+# key = the reference to the configuration key that was changed
+# value = the new value (true or false) that was selected
+def menuOptionChanged(widget, key, value):
+ pass
+
+#This gets called when a meter (image, text, etc) is clicked.
+# NOTE you must use attachClickArea() to make a meter
+# clickable.
+# widget = reference to your theme
+# meter = the meter clicked
+# button = the button clicked (see widgetClicked for button numbers)
+def meterClicked(widget, meter, button):
+ pass
+
+#This gets called when a command you have executed with executeInteractive() outputs something
+#to stdout. This way you can get the output of for example kdialog without freezing up the widget
+#waiting for kdialog to end.
+# widget = reference to your theme
+# pid = process number of the program outputting (use this if you execute more than out process)
+# output = the text the program outputted to stdout
+def commandOutput(widget, pid, output):
+ pass
+
+#This gets called when an item is dropped on this widget.
+# NOTE you have to call acceptDrops() before your widget will accept drops.
+# widget = reference to your theme
+# dropText = the text of the dropped item (probably a URL to it's location in KDE)
+# x and y are coordinates of mouse where the drop occurred.
+# this you can use to e.g. detect which icon or object in your
+# theme that someone wants to "receive" the icon you were dragging
+def itemDropped(widget, dropText, x, y):
+ global drop_txt
+ # delete previous text if exists.
+ if drop_txt is not None:
+ karamba.deleteText(widget, drop_txt)
+
+ disp = "x:%d y:%d command: %s" % (x, y, dropText)
+ drop_txt = karamba.createText(widget, 10, 40, 500, 20, disp)
+ karamba.changeTextColor(widget, drop_txt, 252,252,252)
+
+ karamba.redrawWidget(widget)
+
+#This gets called when a new program is LOADING in KDE. When it is done
+#loading, startupRemoved() is called, followed by taskAdded().
+# widget = reference to your widget
+# task = A refence to the task that is starting.
+def startupAdded(widget, startup):
+ pass
+
+#This gets called when a new program is done LOADING in KDE.
+# widget = reference to your widget
+# task = A refence to the task that just finished loading.
+def startupRemoved(widget, startup):
+ pass
+
+#This is called every time a new task (program) is started in KDE.
+# widget = reference to your widget
+# task = A refence to the new task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def taskAdded(widget, task):
+ pass
+
+#This is called everytime a task (program) is closed in KDE.
+# widget = reference to your widget
+# task = A refence to the task.
+def taskRemoved(widget, task):
+ pass
+
+#This is called everytime a different task gains focus (IE, the user clicks
+#on a different window).
+# widget = reference to your widget
+# task = A refence to the task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def activeTaskChanged(widget, task):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
+
diff --git a/superkaramba/examples/mouseDrop/mousedrop.theme b/superkaramba/examples/mouseDrop/mousedrop.theme
new file mode 100644
index 0000000..6b483d3
--- /dev/null
+++ b/superkaramba/examples/mouseDrop/mousedrop.theme
@@ -0,0 +1,5 @@
+# simple test of drop receipt, including location.
+
+karamba x=0 y=0 w=600 h=140 locked=true color=0,50,0
+text x=10 y=10 value="Drag a desktop icon on me and i will tell you where" color=252,252,252 fontsize=12 font="sans"
+
diff --git a/superkaramba/examples/openCloseTheme/1.py b/superkaramba/examples/openCloseTheme/1.py
new file mode 100644
index 0000000..26281aa
--- /dev/null
+++ b/superkaramba/examples/openCloseTheme/1.py
@@ -0,0 +1,22 @@
+import dcop
+import dcopext
+import karamba
+from qt import QString, QCString
+
+def closeTheme(theme):
+ dc = dcop.DCOPClient()
+ dc.attach()
+ dc.registerAs('sk_script')
+ apps = dc.registeredApplications()
+ for app in apps:
+ s = str(app)
+ if s[:12] == 'superkaramba':
+ d = dcopext.DCOPApp(s, dc)
+ d.KarambaIface.closeTheme(theme)
+
+def initWidget(widget):
+ karamba.openTheme('2.theme')
+
+def widgetClicked(widget, x, y, button):
+ closeTheme('1')
+
diff --git a/superkaramba/examples/openCloseTheme/1.theme b/superkaramba/examples/openCloseTheme/1.theme
new file mode 100644
index 0000000..5184f0a
--- /dev/null
+++ b/superkaramba/examples/openCloseTheme/1.theme
@@ -0,0 +1,2 @@
+KARAMBA x=200 y=50 w=100 h=20 INTERVAL=1000 LOCKED=true
+TEXT x=0 Y=0 w=300 h=20 value="Theme 1"
diff --git a/superkaramba/examples/openCloseTheme/2.theme b/superkaramba/examples/openCloseTheme/2.theme
new file mode 100644
index 0000000..7298850
--- /dev/null
+++ b/superkaramba/examples/openCloseTheme/2.theme
@@ -0,0 +1,2 @@
+KARAMBA x=200 y=100 w=100 h=20 INTERVAL=1000 LOCKED=true
+TEXT x=0 Y=0 w=300 h=20 value="Theme2"
diff --git a/superkaramba/examples/popupMenu/calendar.png b/superkaramba/examples/popupMenu/calendar.png
new file mode 100644
index 0000000..fc0e466
Binary files /dev/null and b/superkaramba/examples/popupMenu/calendar.png differ
diff --git a/superkaramba/examples/popupMenu/popupMenu.png b/superkaramba/examples/popupMenu/popupMenu.png
new file mode 100644
index 0000000..330fc25
Binary files /dev/null and b/superkaramba/examples/popupMenu/popupMenu.png differ
diff --git a/superkaramba/examples/popupMenu/popupMenu.py b/superkaramba/examples/popupMenu/popupMenu.py
new file mode 100644
index 0000000..8df5aef
--- /dev/null
+++ b/superkaramba/examples/popupMenu/popupMenu.py
@@ -0,0 +1,117 @@
+#this import statement allows access to the karamba functions
+import karamba
+
+menu1 = 0
+menu2 = 0
+id1 = 0
+id2 = 0
+id3 = 0
+id4 = 0
+id5 = 0
+
+#this is called when you widget is initialized
+def initWidget(widget):
+ global menu1
+ global menu2
+ global id1
+ global id2
+ global id3
+ global id4
+ global id5
+
+ menu1 = karamba.createMenu(widget)
+ print "menu 1 created!"
+ menu2 = karamba.createMenu(widget)
+ print "menu 2 created!"
+
+ id1 = karamba.addMenuItem(widget, menu1, "menu 1 first item", "kword")
+ print "item 1 entered in menu 1"
+ id2 = karamba.addMenuItem(widget, menu1, "menu 1 second item", "kate")
+ print "item 2 entered in menu 1"
+
+ id3 = karamba.addMenuItem(widget, menu2, "menu 2 first item", "kword")
+ print "item 1 entered in menu 2"
+ id4 = karamba.addMenuItem(widget, menu2, "menu 2 second item", "kate")
+ print "item 2 entered in menu 2"
+ id5 = karamba.addMenuItem(widget, menu2, "menu 2 third item", "/opt/kde/share/icons/kdeclassic/16x16/apps/kicker.png")
+ print "item 3 entered in menu 2"
+
+
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ pass
+
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ global menu1
+ global menu2
+
+ if(button == 1):
+ karamba.popupMenu(widget, menu1, -100, -100)
+ elif(button == 2):
+ karamba.popupMenu(widget, menu2, 200, 200)
+
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ #Warning: Don't do anything too intensive here
+ #You don't want to run some complex piece of code everytime the mouse moves
+ pass
+
+
+def menuItemClicked(widget, menu, id):
+ global menu1
+ global menu2
+ global id1
+ global id2
+ global id3
+ global id4
+ global id5
+
+ if (menu == menu1):
+ if(id == id1):
+ print "item 1 in menu 1 clicked."
+ elif(id == id2):
+ print "item 2 in menu 1 clicked, removing item 2 in menu 2"
+ karamba.removeMenuItem(widget, menu2, id4)
+ elif (menu == menu2):
+ if(id == id3):
+ print "item 1 in menu 2 clicked."
+ elif(id == id4):
+ print "item 2 in menu 2 clicked, deleting menu 1 (if menu1 still exists...)"
+ karamba.deleteMenu(widget, menu1)
+ elif(id == id5):
+ print "item 3 in menu 2 clicked, removing item 2 in menu 1 (if menu1 still exists...)"
+ karamba.removeMenuItem(widget, menu1, id2)
+
+
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
+
+
diff --git a/superkaramba/examples/popupMenu/popupMenu.theme b/superkaramba/examples/popupMenu/popupMenu.theme
new file mode 100644
index 0000000..5c597f4
--- /dev/null
+++ b/superkaramba/examples/popupMenu/popupMenu.theme
@@ -0,0 +1,4 @@
+
+KARAMBA X=200 Y=200 W=390 H=220 LOCKED=true INTERVAL=1000 ONTOP=false
+
+IMAGE X=0 Y=0 PATH="popupMenu.png"
diff --git a/superkaramba/examples/richtext/info.png b/superkaramba/examples/richtext/info.png
new file mode 100644
index 0000000..43b0297
Binary files /dev/null and b/superkaramba/examples/richtext/info.png differ
diff --git a/superkaramba/examples/richtext/penguin_executive.png b/superkaramba/examples/richtext/penguin_executive.png
new file mode 100644
index 0000000..6f855d3
Binary files /dev/null and b/superkaramba/examples/richtext/penguin_executive.png differ
diff --git a/superkaramba/examples/richtext/richtext.py b/superkaramba/examples/richtext/richtext.py
new file mode 100644
index 0000000..518aa65
--- /dev/null
+++ b/superkaramba/examples/richtext/richtext.py
@@ -0,0 +1,136 @@
+#Unicode Example
+
+#For Symbol Tables look at www.unicode.org/charts/
+
+hidden = 0
+
+penguin = 0
+penguin_hidden = 1
+
+#this import statement allows access to the karamba functions
+import karamba
+
+#this is called when you widget is initialized
+def initWidget(widget):
+ global richtext
+ global penguin
+
+ karamba.resizeWidget(widget, 360, 520)
+
+ penguin = karamba.createImage(widget, 250, 150, karamba.getThemePath(widget) + "/penguin_executive.png")
+ karamba.hideImage(widget, penguin)
+
+
+ text = """
+
Richtext Example
+
A rich text object allows to display a string interpreted as rich text.
+To create a rich text object use the command:
karamba.createRichText(widget, text)
+A simple subset of HTML-tags
+is used to encode the formatting commands.
+For a complete documentation of all supported tags look at:
+
+http://doc.trolltech.com/3.0/qstylesheet.html.
+
+"""
+
+ richtext = karamba.createRichText(widget, text)
+
+ karamba.moveRichText(widget, richtext, 10, 10)
+
+ print "richText Size = ", karamba.getRichTextSize(widget, richtext)
+
+ karamba.setRichTextWidth(widget, richtext, 345)
+
+ #karamba.deleteRichText(widget, richtext)
+
+ karamba.redrawWidget(widget)
+
+
+
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ global hidden
+ global richtext
+
+ #if hidden == 0:
+ # hidden = 1
+ # karamba.hideRichText(widget, richtext)
+ #else:
+ # hidden = 0
+ # karamba.showRichText(widget, richtext)
+
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ global richtext
+ global hidden
+
+ #hidden = 0
+ #karamba.showRichText(widget, richtext)
+
+ #karamba.changeRichText(widget, richtext, "hihi\n huhu")
+
+def meterClicked(widget, meter, button):
+ global penguin
+ global penguin_hidden
+ global richtext
+
+ print "Meter clicked", meter
+ if meter == "trigger":
+ if penguin_hidden:
+ karamba.showImage(widget, penguin)
+ penguin_hidden = 0
+ else:
+ karamba.hideImage(widget, penguin)
+ penguin_hidden = 1
+ if meter == "delete":
+ karamba.deleteRichText(widget, richtext)
+
+ karamba.redrawWidget(widget)
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded Karamba Unicode Test"
diff --git a/superkaramba/examples/richtext/richtext.theme b/superkaramba/examples/richtext/richtext.theme
new file mode 100644
index 0000000..1fae0ec
--- /dev/null
+++ b/superkaramba/examples/richtext/richtext.theme
@@ -0,0 +1 @@
+KARAMBA X=80 Y=20 W=400 H=500 LOCKED=true INTERVAL=2000
diff --git a/superkaramba/examples/richtext/rtext.py b/superkaramba/examples/richtext/rtext.py
new file mode 100644
index 0000000..68c800a
--- /dev/null
+++ b/superkaramba/examples/richtext/rtext.py
@@ -0,0 +1,99 @@
+#!/usr/bin/python
+# -*- coding: latin-1 -*-
+#this import statement allows access to the karamba functions
+import karamba
+
+align = ['LEFT', 'CENTER', 'RIGHT']
+texts = [0,0,0,0,0,0,0,0,0,0,0]
+b = 0
+a = 0
+
+#this is called when you widget is initialized
+def initWidget(widget):
+ global texts, b
+ texts[0] = karamba.getThemeRichText(widget, "text0")
+ texts[1] = karamba.getThemeRichText(widget, "text1")
+ texts[2] = karamba.getThemeRichText(widget, "text2")
+ texts[3] = karamba.getThemeRichText(widget, "text3")
+ texts[4] = karamba.getThemeRichText(widget, "text4")
+ texts[5] = karamba.getThemeRichText(widget, "text5")
+ texts[7] = karamba.getThemeRichText(widget, "text7")
+ texts[9] = karamba.getThemeRichText(widget, "text9")
+
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ global texts, b, a
+
+ b = (b+1)%2
+ text = "Unicode text: Ähtärissä on Öljyä"
+
+ # Create & delete
+ if(texts[0]):
+ karamba.deleteRichText(widget, texts[0])
+ texts[0] = 0
+ else:
+ texts[0] = karamba.createRichText(widget, text)
+ karamba.moveRichText(widget, texts[0], 0, 20)
+ karamba.resizeRichText(widget, texts[0], 200, 20)
+ pos = karamba.getRichTextPos(widget, texts[0])
+ print "--getRichTextPos: " + str(pos)
+ size = karamba.getRichTextSize(widget, texts[0])
+ print "--getRichTextSize: " + str(size)
+
+ # size & resize
+ size = karamba.getRichTextSize(widget, texts[1])
+ print "getRichTextSize: " + str(size)
+ size = ((b * 200) + 200, size[1])
+ karamba.resizeRichText(widget, texts[1], size[0], size[1])
+
+ # pos & move
+ pos = karamba.getRichTextPos(widget, texts[2])
+ print "getRichTextPos: " + str(pos)
+ pos = (b * 200, pos[1])
+ karamba.moveRichText(widget, texts[2], pos[0], pos[1])
+
+ # Hide & Show
+ if(b):
+ karamba.hideRichText(widget, texts[3])
+ else:
+ karamba.showRichText(widget, texts[3])
+
+ # Sensor
+ sensor = karamba.getRichTextSensor(widget, texts[4])
+ print "getSensor: " + str(sensor)
+ if(b):
+ karamba.setRichTextSensor(widget, texts[4], 'SENSOR=SENSOR TYPE="cpu_temp"')
+ else:
+ karamba.setRichTextSensor(widget, texts[4], 'SENSOR=CPU')
+
+ # Value
+ v = karamba.getRichTextValue(widget, texts[5])
+ print "getRichTextValue: ", v
+ v += '.'
+ karamba.changeRichText(widget, texts[5], v)
+
+ # Font size
+ v = karamba.getRichTextFontSize(widget, texts[7])
+ print "getRichTextFontSize: ", v
+ v = 10 + ((v-10)+1)%10;
+ karamba.changeRichTextSize(widget, texts[7], v)
+
+ # RichText Font
+ v = karamba.getRichTextFont(widget, texts[9])
+ print "getRichTextFont: ", v
+ if(b):
+ v = 'Bitstream Vera Sans'
+ else:
+ v = 'Bitstream Vera Serif'
+ karamba.changeRichTextFont(widget, texts[9], v)
+
+def widgetClicked(widget, x, y, button):
+ pass
+
+def widgetMouseMoved(widget, x, y, button):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded RichText test python extension!"
diff --git a/superkaramba/examples/richtext/rtext.theme b/superkaramba/examples/richtext/rtext.theme
new file mode 100644
index 0000000..487065d
--- /dev/null
+++ b/superkaramba/examples/richtext/rtext.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="createRichText & deleteRichText" name=ttext0
+RICHTEXT x=0 Y=20 w=200 h=20 value="RichText meter" min=0 max=100 name=text0
+
+TEXT x=0 Y=45 w=600 h=20 VALUE="getRichTextSize & resizeRichText" name=ttext1
+RICHTEXT x=0 Y=65 w=200 h=20 value="The quick brown fox jumps over the lazy dog" min=0 max=100 name=text1
+
+TEXT x=0 Y=90 w=600 h=20 VALUE="getRichTextPos & moveRichText" name=ttext2
+RICHTEXT x=0 Y=110 w=200 h=20 value="RichText meter" min=0 max=100 name=text2
+
+TEXT x=0 Y=135 w=600 h=20 VALUE="hideRichText & showRichText" name=ttext3
+RICHTEXT x=0 Y=155 w=200 h=20 value="RichText meter" min=0 max=100 name=text3
+
+TEXT x=0 Y=180 w=600 h=20 VALUE="getRichTextSensor & setRichTextSensor" name=ttext4
+RICHTEXT x=0 Y=200 w=200 h=20 value=50 min=0 max=100 name=text4
+
+TEXT x=0 Y=225 w=600 h=20 VALUE="getRichTextValue & setRichTextValue" name=ttext5
+RICHTEXT x=0 Y=245 w=200 h=20 value="." min=0 max=100 name=text5
+
+TEXT x=0 Y=315 w=600 h=20 VALUE="setRichTextSize & getRichTextSize" name=ttext7
+RICHTEXT x=0 Y=335 w=200 h=20 value="RichText meter" min=0 max=100 name=text7
+
+TEXT x=0 Y=405 w=600 h=20 VALUE="setRichTextFont & getRichTextFont" name=ttext9
+RICHTEXT x=0 Y=425 w=400 h=20 value="The quick brown fox jumps over the lazy dog" min=0 max=100 name=text9
diff --git a/superkaramba/examples/service_group/service_group.py b/superkaramba/examples/service_group/service_group.py
new file mode 100644
index 0000000..276b9c8
--- /dev/null
+++ b/superkaramba/examples/service_group/service_group.py
@@ -0,0 +1,143 @@
+# Service Groups demo
+# Written by Luke Kenneth Casson Leighton
+
+# This theme is demonstrates how to parse service groups.
+# it's done recursively to give a complete dump of your menu
+# that you will also be able to double-check against kmenuedit
+# and also the KDE Start button.
+#
+# for a real-live usage, see kroller.sez (try searching kde-look.org),
+# which fires off a sub-theme with the service-group menu options when
+# you click on a service group on the "main" bar.
+
+#this import statement allows access to the karamba functions
+import karamba
+
+# simple function to display
+
+def create_text(widget, line, depth, disp, name=None, command=None, icon=None):
+
+ x = depth*30
+ y = line*7
+ width = 400
+ height = 8
+ drop_txt = karamba.createText(widget, x, y, width, height, disp)
+ karamba.changeTextSize(widget, drop_txt, 7)
+ karamba.changeTextColor(widget, drop_txt, 252,252,252)
+
+ # create a (very narrow! only an 8-pixel-high area!)
+ # service click area to demonstrate that commands get
+ # executed correctly.
+
+ if name:
+ karamba.createServiceClickArea( widget,
+ x,y,width,height,
+ name, command, icon)
+
+
+# okay. you really should be looking up the KDE Developer documentation
+# on service groups. here is a _brief_ explanation of what they contain.
+#
+# getServiceGroups returns a list of menu options.
+# you can either have a subgroup, or you can have an executable program.
+# if a list item is a subgroup, then (0, dict) is returned, where
+# dict is a dictionary containing information describing the subgroup.
+# if a list item is an executable menu option, then (1, dict) is returned,
+# where dict is a dictionary containing information describing the menu option.
+#
+# the information (keys in the dictionary) returned about a subgroup comprises:
+# relpath - the fully qualified path of that subgroup, and
+# calling getServiceGroups (again) with that path will get
+# you all of the menu options in that subgroup, hurrah.
+# icon - the name of an icon (a png, usually) which you can, if you
+# so wish, use as the filename argument to createImage().
+# caption - i get confused as to which is which, but
+# and you can always run this program in combination
+# comment with kmenuedit to find out!
+#
+# the information (keys in the dictionary) returned about an
+# executable option comprises:
+# exec - obviously the most important bit: the name of the command
+# to be executed.
+# icon - the filename of the icon (usually a png) which should be
+# displayed for this command.
+# name - not to be confused with genericname, neither of which i
+# am sure about, and if you really want to know, run
+# kmenuedit and experiment, or look at the KDE Developer source
+# code.
+# menuid - don't know what it is for. it's just... there.
+#
+# how to use the service group info:
+#
+# the simplest way to get commands actually executed is to hand
+# over the name, the command and the icon filename to a
+# ServiceClickArea (karamba.createServiceClickArea()).
+#
+# other than making sure that you put the service click area in
+# the right place, you don't have to worry about much else.
+#
+# or, you could always run it manually, yourself, by using
+# karamba.Run(name, command, icon). personally, i prefer
+# the service click areas. no, karamba.Run() is not like
+# karamba.execute() - if you use karamba.Run() you get to say which
+# bouncing icon is used, whereas if you use karamba.execute() you
+# always get a superkaramba bouncing icon...
+#
+# do look out for kroller.sez on http://kde-look.org or other locations
+# for a more complex and comprehensive usage of service groups.
+
+def display_svc_group(widget, rel_path, line, depth):
+
+ grps = karamba.getServiceGroups(rel_path)
+
+ for (type, d) in grps:
+
+ if type is 0:
+
+ # it's a
+
+ sub_relpath = d['relpath']
+ icon = d.get('icon', 'unknown')
+ caption = d.get('caption', None)
+ comment = d.get('comment', None)
+ cmt = ''
+
+ # get at least something to display
+ if comment:
+ cmt = comment
+ elif caption:
+ cmt = caption
+
+ msg = "SVCGRP: %s %s" % (icon, cmt)
+ create_text(widget, line, depth, msg)
+ line += 1
+ line = display_svc_group(widget, sub_relpath,
+ line, depth+1)
+
+ elif type is 1 and d.has_key('menuid'):
+
+ relpath = d.get('relpath', '')
+ cmd = d['exec']
+ icon = d.get('icon', 'unknown')
+ name = d.get('name', None)
+ genericname = d.get('genericname', None)
+ cmt = ''
+
+ # get at least something to display
+ if genericname:
+ cmt = genericname
+ elif name:
+ cmt = name
+
+ msg = "%s %s %s" % (cmd, icon, cmt)
+ create_text(widget, line, depth, msg, name, cmd, icon)
+ line += 1
+
+ return line
+
+#this is called when you widget is initialized
+def initWidget(widget):
+
+ display_svc_group(widget, "", 0, 0)
+ karamba.redrawWidget(widget)
+
diff --git a/superkaramba/examples/service_group/service_group.theme b/superkaramba/examples/service_group/service_group.theme
new file mode 100644
index 0000000..e52a689
--- /dev/null
+++ b/superkaramba/examples/service_group/service_group.theme
@@ -0,0 +1,4 @@
+# simple test of service group stuff. displays your kde menu.
+
+karamba x=0 y=0 w=600 h=800 locked=true
+
diff --git a/superkaramba/examples/setIncomingData/1.py b/superkaramba/examples/setIncomingData/1.py
new file mode 100644
index 0000000..8422de2
--- /dev/null
+++ b/superkaramba/examples/setIncomingData/1.py
@@ -0,0 +1,27 @@
+import karamba
+
+sequence_num = 0
+
+def initWidget(widget):
+ karamba.openTheme('2.theme')
+
+# pass over a sequence number as well - the reason is to
+# make it possible to identify the clicks uniquely.
+#
+# unfortunately, the recipient has to do "polling"
+# by calling getIncomingData - see 2.py for more info
+
+def widgetClicked(widget, x, y, button):
+
+ # do as you wish, but this is a good way:
+ # compact your stuff with repr() it can cope
+ # with pretty much any basic types - dictionaries, lists -
+ # and then use eval() at the other end.
+
+ global sequence_num
+ sequence_num += 1
+
+ vars = (sequence_num, x, y, button)
+ message = repr(vars)
+ karamba.setIncomingData(widget, "2", message)
+
diff --git a/superkaramba/examples/setIncomingData/1.theme b/superkaramba/examples/setIncomingData/1.theme
new file mode 100644
index 0000000..2e4bfcf
--- /dev/null
+++ b/superkaramba/examples/setIncomingData/1.theme
@@ -0,0 +1,2 @@
+KARAMBA x=200 y=50 w=100 h=20 INTERVAL=1000 LOCKED=true
+TEXT x=0 Y=0 w=300 h=20 value="Click me!"
diff --git a/superkaramba/examples/setIncomingData/2.py b/superkaramba/examples/setIncomingData/2.py
new file mode 100644
index 0000000..a411b60
--- /dev/null
+++ b/superkaramba/examples/setIncomingData/2.py
@@ -0,0 +1,78 @@
+#
+# Written by Luke Kenneth Casson Leighton
+
+# This theme is demonstrates how to
+
+#this import statement allows access to the karamba functions
+import karamba
+
+drop_txt = None
+
+#this is called when you widget is initialized
+def initWidget(widget):
+
+ # this resets the text to "" so we know we've never
+ # received anything yet from the other theme
+ name = karamba.getPrettyThemeName(widget)
+ print "2.py name: ", name
+ karamba.setIncomingData(widget, name, "")
+
+ karamba.redrawWidget(widget)
+
+# this is a pain. in order to avoid memory-related threading problems,
+# and also locking, with the communication between themes, the
+# communication is done asynchronously. so you have to POLL for the
+# information, by reading getIncomingData().
+#
+# therefore, you must set an interval=time_in_ms in your receiving .theme
+# file (see 2.theme) and then call getIncomingData() in here.
+#
+# it's not ideal - but it works.
+#
+# NOTE: the data received - by getIncomingData - is NOT, i repeat NOT
+# deleted when you call getIncomingData.
+# so, obviously, you need to take care to not activate repeatedly.
+# you could do this in several ways. one of them is to send, in
+# the calling theme (the one that calls setIncomingData) a sequential
+# number as part of the message.
+#
+# alternatively, you could reset the text to "" (see above)
+
+
+expected_seq = 0
+
+def widgetUpdated(widget):
+
+ global expected_seq # i hate globals. please write better code than this example.
+
+ # get the "message"...
+ disp = karamba.getIncomingData(widget)
+ if disp == "":
+ return
+
+ # decode it...
+ (seq, x, y, button) = eval(disp)
+
+ # if it's been seen before, skip it...
+ if seq <= expected_seq:
+ pass
+
+ expected_seq += 1
+
+ message = "seq:%d x:%d y:%d btn:%d" % (seq, x, y, button)
+ # delete previous text if exists.
+ global drop_txt
+ if drop_txt is not None:
+ karamba.deleteText(widget, drop_txt)
+
+ # display it...
+ drop_txt = karamba.createText(widget, 0, 20, 300, 20, message)
+ karamba.changeTextColor(widget, drop_txt, 252,252,252)
+
+ karamba.redrawWidget(widget)
+
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded my python 2.py extension!"
+
diff --git a/superkaramba/examples/setIncomingData/2.theme b/superkaramba/examples/setIncomingData/2.theme
new file mode 100644
index 0000000..df7d7b2
--- /dev/null
+++ b/superkaramba/examples/setIncomingData/2.theme
@@ -0,0 +1,2 @@
+KARAMBA x=200 y=100 w=300 h=40 INTERVAL=200 LOCKED=true
+TEXT x=0 y=0 w=300 h=20 value="you clicked on theme 1:"
diff --git a/superkaramba/examples/taskBar/cleanbar/README b/superkaramba/examples/taskBar/cleanbar/README
new file mode 100644
index 0000000..0f828b6
--- /dev/null
+++ b/superkaramba/examples/taskBar/cleanbar/README
@@ -0,0 +1,25 @@
+Cleanbar for SuperKaramba, version 0.4
+Written by Adam Geitgey
+Released under the GNU General Public License version 2
+
+
+Cleanbar requires SuperKaramba 0.31 or higher!!
+
+
+Cleanbar is a simple taskbar, xmms control, and clock. Cleanbar is quick,
+simple, and appealing.
+
+The Launch button brings up the K Menu. The play control buttons will control
+XMMS (xmmsctrl is required). A clock is shown on the right. Tasks show up
+along the middle and the taskbar works just like any other taskbar from the
+last 10 years.
+
+I created this basically as a quick example of how to use the new
+event-based task control API in SuperKaramba 0.31.
+
+It also demonstrates how to create themes that work at any resolution. You
+should not have to change anything for this to work on your desktop.
+
+Please report any major problems you have.
+
+Thanks.
diff --git a/superkaramba/examples/taskBar/cleanbar/cleanbar.py b/superkaramba/examples/taskBar/cleanbar/cleanbar.py
new file mode 100644
index 0000000..c0da2a2
--- /dev/null
+++ b/superkaramba/examples/taskBar/cleanbar/cleanbar.py
@@ -0,0 +1,267 @@
+#this import statement allows access to the karamba functions
+import karamba
+import os
+import time
+
+######################################
+## Globals
+######################################
+
+init = 0
+numOfTasks = 0
+
+## Default res
+## You don't need to change it. It should auto-detect.
+resX = 1024
+resY = 768
+
+# list of tasks
+taskList = []
+
+# focused task
+activeTask = 0
+
+## Task display stuff
+taskPanels = []
+taskText = []
+taskMenu = 0
+taskMenuLookup = {}
+timeText = 0
+
+## My code to detect resolution
+havexwi = os.system("which xwininfo")
+
+if (havexwi == 0):
+ pass
+else:
+ print "\nCan't find xwininfo in your path."
+
+fp = os.popen("xwininfo -root -stats")
+output = fp.read()
+output = output.splitlines()
+i = 0
+for x in output:
+ param = x.split()
+ if (len(param) > 1):
+ if param[0].find("Width:") != -1:
+ resX = int(param[1])
+ if param[0].find("Height:") != -1:
+ resY = int(param[1])
+
+
+
+
+def drawTaskbar(widget):
+ global taskPanels
+ global taskText
+ global numOfTasks
+
+ taskList = karamba.getTaskList(widget)
+
+ for image in taskPanels:
+ karamba.hideImage(widget, image)
+
+ for text in taskText:
+ karamba.changeText(widget, text, "")
+ karamba.changeTextShadow(widget, text, 0)
+ karamba.changeTextColor(widget,text,0,0,0)
+
+ length = len(taskList)
+ if (numOfTasks < length):
+ length = numOfTasks
+
+
+ knownGroups = {}
+ groups = []
+ groupRefs = {}
+
+ activeGroup = 0
+ groupCount = 0
+
+ #build groups list that contains sub-lists of taskInfo sorted by group
+ for j in range(len(taskList)):
+ taskinfo = karamba.getTaskInfo(widget, taskList[j])
+
+ if knownGroups.has_key(taskinfo[2]) == 0:
+ groupCount = groupCount + 1
+ if (taskinfo[7] == 1):
+ activeGroup = groupCount
+ knownGroups[taskinfo[2]] = 1
+ thisGroup = []
+ thisGroup.append(taskinfo)
+ groupRefs[taskinfo[2]] = len(groups)
+ groups.append(thisGroup)
+ else:
+ if (taskinfo[7] == 1):
+ activeGroup = groupRefs[taskinfo[2]] + 1
+ knownGroups[taskinfo[2]] = knownGroups[taskinfo[2]] + 1
+ thisGroup = groups[groupRefs[taskinfo[2]]]
+ thisGroup.append(taskinfo)
+
+ #fill out the task bar
+ j = 0
+ for group in groups:
+ #safety check (could be more task groups than bar is long)
+ if (j < length):
+ karamba.showImage(widget, taskPanels[j])
+ if len(group) != 1:
+ karamba.changeText(widget, taskText[j], group[0][2] + " [" + str(len(group)) + "]")
+ else:
+ karamba.changeText(widget, taskText[j], (group[0][0]))
+ j = j + 1
+
+ if (activeGroup != 0):
+ karamba.changeTextShadow(widget, taskText[activeGroup - 1], 1)
+ karamba.changeTextColor(widget, taskText[activeGroup - 1], 239, 220, 11)
+
+
+ karamba.redrawWidget(widget)
+
+#this is called when your widget is initialized
+def initWidget(widget):
+ global resX
+ global numOfTasks
+ global taskPanels
+ global taskText
+ global timeText
+
+ karamba.createImage(widget, resX - 149, 0, "pics/rightend_new.png")
+ numOfTasks = (resX - 198 - 149)/121
+
+ timeText = karamba.createText(widget, resX - 149 + 54, 10, 140, 20, "time")
+ karamba.changeTextColor(widget, timeText, 0,0,0)
+ karamba.changeTextSize(widget, timeText, 9)
+
+ for i in range(numOfTasks):
+ taskPanels.append(karamba.createImage(widget, 198 + (121*i), 3, "pics/task_new.png"))
+ taskText.append(karamba.createText(widget, 198 + (121*i) +9, 9, 100, 20, ""))
+
+ for text in taskText:
+ karamba.changeTextSize(widget,text,9)
+
+ drawTaskbar(widget)
+
+# called to indicate that a new task is currently started
+def startupAdded(widget, startup):
+ pass
+
+# called whenever a startup is removed. Which either means the task is
+# successfully started (and taskAdded will be called), or the task could
+# not be started for some reason.
+def startupRemoved(widget, startup):
+ pass
+
+# called whenever a new task has been started
+def taskAdded(widget, task):
+ drawTaskbar(widget)
+
+# called whenever a task is removed
+def taskRemoved(widget, task):
+ drawTaskbar(widget)
+
+# called whenever a new task has gained focus.
+# task = the active task
+def activeTaskChanged(widget, task):
+ drawTaskbar(widget)
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ global timeText
+
+ karamba.changeText(widget, timeText, time.strftime("%I:%M %p %a",time.localtime(time.time())))
+ karamba.redrawWidget(widget)
+
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ global numOfTasks
+ global taskMenu
+ global taskMenuLookup
+
+ taskSelected = (x-198)/121
+
+ ## Make sure its a valid task
+ if (0 <= taskSelected < numOfTasks):
+ taskList = karamba.getTaskList(widget)
+
+ #free last menu
+ karamba.deleteMenu(widget, taskMenu)
+
+ #create new menu
+ taskMenu = karamba.createMenu(widget)
+ taskMenuLoopup = {}
+
+ length = len(taskList)
+ if (numOfTasks < length):
+ length = numOfTasks
+
+
+ knownGroups = {}
+ groups = []
+ groupRefs = {}
+ for j in range(len(taskList)):
+ taskinfo = karamba.getTaskInfo(widget, taskList[j])
+
+ if knownGroups.has_key(taskinfo[2]) == 0:
+ knownGroups[taskinfo[2]] = 1
+ thisGroup = []
+ thisGroup.append(taskinfo)
+ groupRefs[taskinfo[2]] = len(groups)
+ groups.append(thisGroup)
+ else:
+ knownGroups[taskinfo[2]] = knownGroups[taskinfo[2]] + 1
+ thisGroup = groups[groupRefs[taskinfo[2]]]
+ thisGroup.append(taskinfo)
+
+ if taskSelected < len(groups):
+ taskGroup = groups[taskSelected]
+
+
+ if len(taskGroup) == 1:
+ #only one task in group - just switch to that app
+ ## perform the task action (see Task API for list of numbers)
+ karamba.performTaskAction(widget, taskGroup[0][8], 8)
+
+ else:
+ #more than one task in this group, make a popup
+ for task in taskGroup:
+ #if it's minimized, put []'s around name
+ if task[5] == 1:
+ item = karamba.addMenuItem(widget, taskMenu, "[ " + task[0] + " ]", task[2])
+ else:
+ item = karamba.addMenuItem(widget, taskMenu, task[0], task[2])
+ #save the taskInfo item for later use
+ #so we will know info for the task that
+ #will be clicked in the callback
+ taskMenuLookup[item] = task
+
+ numOfItems = len(taskGroup)
+ karamba.popupMenu(widget, taskMenu, 198 + (121*taskSelected), -1 * (numOfItems * 26))
+
+
+
+ if (taskSelected == numOfTasks):
+ karamba.toggleShowDesktop(widget)
+
+#This gets called when an item is clicked in a popup menu you have created.
+# menu = a reference to the menu
+# id = the number of the item that was clicked.
+def menuItemClicked(widget, menu, id):
+ global taskMenuLookup
+
+ taskinfo = taskMenuLookup[id]
+ karamba.performTaskAction(widget, taskinfo[8], 8)
+
+
diff --git a/superkaramba/examples/taskBar/cleanbar/cleanbar.theme b/superkaramba/examples/taskBar/cleanbar/cleanbar.theme
new file mode 100644
index 0000000..ec111cd
--- /dev/null
+++ b/superkaramba/examples/taskBar/cleanbar/cleanbar.theme
@@ -0,0 +1,14 @@
+KARAMBA X=0 Y=0 W=1600 H=31 LOCKED=true ONTOP=TRUE BOTTOMBAR=true INTERVAL=20000
+
+IMAGE X=0 Y=0 PATH="pics/bar2.png"
+
+#K Menu
+CLICKAREA X=4 Y=6 W=64 H=25 ONCLICK="dcop kicker kicker popupKMenu 0"
+
+#XMMS controls
+CLICKAREA X=96 Y=6 W=15 H=23 ONCLICK="xmmsctrl prev"
+CLICKAREA X=121 Y=6 W=10 H=23 ONCLICK="xmmsctrl play"
+CLICKAREA X=140 Y=6 W=12 H=23 ONCLICK="xmmsctrl pause"
+CLICKAREA X=159 Y=6 W=12 H=23 ONCLICK="xmmsctrl stop"
+CLICKAREA X=180 Y=6 W=12 H=23 ONCLICK="xmmsctrl next"
+
diff --git a/superkaramba/examples/taskBar/cleanbar/pics/bar2.png b/superkaramba/examples/taskBar/cleanbar/pics/bar2.png
new file mode 100644
index 0000000..1566ff0
Binary files /dev/null and b/superkaramba/examples/taskBar/cleanbar/pics/bar2.png differ
diff --git a/superkaramba/examples/taskBar/cleanbar/pics/rightend.png b/superkaramba/examples/taskBar/cleanbar/pics/rightend.png
new file mode 100644
index 0000000..0da33ca
Binary files /dev/null and b/superkaramba/examples/taskBar/cleanbar/pics/rightend.png differ
diff --git a/superkaramba/examples/taskBar/cleanbar/pics/rightend_new.png b/superkaramba/examples/taskBar/cleanbar/pics/rightend_new.png
new file mode 100644
index 0000000..356b970
Binary files /dev/null and b/superkaramba/examples/taskBar/cleanbar/pics/rightend_new.png differ
diff --git a/superkaramba/examples/taskBar/cleanbar/pics/slickbar.png b/superkaramba/examples/taskBar/cleanbar/pics/slickbar.png
new file mode 100644
index 0000000..24b7336
Binary files /dev/null and b/superkaramba/examples/taskBar/cleanbar/pics/slickbar.png differ
diff --git a/superkaramba/examples/taskBar/cleanbar/pics/startup.png b/superkaramba/examples/taskBar/cleanbar/pics/startup.png
new file mode 100644
index 0000000..0d3555e
Binary files /dev/null and b/superkaramba/examples/taskBar/cleanbar/pics/startup.png differ
diff --git a/superkaramba/examples/taskBar/cleanbar/pics/task.png b/superkaramba/examples/taskBar/cleanbar/pics/task.png
new file mode 100644
index 0000000..3058f41
Binary files /dev/null and b/superkaramba/examples/taskBar/cleanbar/pics/task.png differ
diff --git a/superkaramba/examples/taskBar/cleanbar/pics/task_new.png b/superkaramba/examples/taskBar/cleanbar/pics/task_new.png
new file mode 100644
index 0000000..e66537c
Binary files /dev/null and b/superkaramba/examples/taskBar/cleanbar/pics/task_new.png differ
diff --git a/superkaramba/examples/template.py b/superkaramba/examples/template.py
new file mode 100644
index 0000000..d79d1a0
--- /dev/null
+++ b/superkaramba/examples/template.py
@@ -0,0 +1,160 @@
+#this import statement allows access to the karamba functions
+import karamba
+
+
+#this is called when your widget is initialized
+def initWidget(widget):
+ pass
+
+#This is called when your widget is closed. You can use this to clean
+#up open files, etc. You don't need to delete text and images in your
+#theme. That is done automatically. This callback is just for cleaning up
+#external things. Most people don't need to put anything here.
+def widgetClosed(widget):
+ pass
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes:
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button clicked:
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+# 4,5 = Scroll wheel up and down
+def widgetClicked(widget, x, y, button):
+ pass
+
+#This gets called everytime our widget is clicked.
+#Notes
+# widget = reference to our widget
+# x = x position (relative to our widget)
+# y = y position (relative to our widget)
+# botton = button being held:
+# 0 = No Mouse Button
+# 1 = Left Mouse Button
+# 2 = Middle Mouse Button
+# 3 = Right Mouse Button, but this will never happen
+# because the right mouse button brings up the
+# Karamba menu.
+def widgetMouseMoved(widget, x, y, button):
+ #Warning: Don't do anything too intensive here
+ #You don't want to run some complex piece of code everytime the mouse moves
+ pass
+
+
+#This gets called when an item is clicked in a popup menu you have created.
+# menu = a reference to the menu
+# id = the number of the item that was clicked.
+def menuItemClicked(widget, menu, id):
+ pass
+
+#This gets called when an item is clicked in the theme CONFIGURATION menu,
+#not the popup menus that you create.
+# key = the reference to the configuration key that was changed
+# value = the new value (true or false) that was selected
+def menuOptionChanged(widget, key, value):
+ pass
+
+#This gets called when a meter (image, text, etc) is clicked.
+# NOTE you must use attachClickArea() to make a meter
+# clickable.
+# widget = reference to your theme
+# meter = the meter clicked
+# button = the button clicked (see widgetClicked for button numbers)
+def meterClicked(widget, meter, button):
+ pass
+
+#This gets called when a command you have executed with executeInteractive() outputs something
+#to stdout. This way you can get the output of for example kdialog without freezing up the widget
+#waiting for kdialog to end.
+# widget = reference to your theme
+# pid = process number of the program outputting (use this if you execute more than out process)
+# output = the text the program outputted to stdout
+def commandOutput(widget, pid, output):
+ pass
+
+#This gets called when another theme sends a message.
+# widget = reference to your theme
+# caller = "pretty" name or regular name (name of theme file with a number attached) of sending theme
+# output = the text sent.
+def themeNotify(widget, caller, message):
+ pass
+
+#This gets called when an item is dropped on this widget.
+# NOTE you have to call acceptDrops() before your widget will accept drops.
+# widget = reference to your theme
+# dropText = the text of the dropped item (probably a URL to it's location in KDE)
+# x = the x position on the theme relative to the upper left corner
+# y = the y position on the theme relative to the upper left corner
+def itemDropped(widget, dropText, x, y):
+ pass
+
+
+#This gets called when a new program is LOADING in KDE. When it is done
+#loading, startupRemoved() is called, followed by taskAdded().
+# widget = reference to your widget
+# task = A refence to the task that is starting.
+def startupAdded(widget, startup):
+ pass
+
+#This gets called when a new program is done LOADING in KDE.
+# widget = reference to your widget
+# task = A refence to the task that just finished loading.
+def startupRemoved(widget, startup):
+ pass
+
+#This is called every time a new task (program) is started in KDE.
+# widget = reference to your widget
+# task = A refence to the new task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def taskAdded(widget, task):
+ pass
+
+#This is called everytime a task (program) is closed in KDE.
+# widget = reference to your widget
+# task = A refence to the task.
+def taskRemoved(widget, task):
+ pass
+
+#This is called everytime a different task gains focus (IE, the user clicks
+#on a different window).
+# widget = reference to your widget
+# task = A refence to the task. Call getTaskInfo() with this reference
+# to get the name, etc of this new task.
+def activeTaskChanged(widget, task):
+ pass
+
+#This is called everytime the systray you created with createSystray() is updated
+def systrayUpdated(widget):
+ pass
+
+#This is called everytime the current desktop changes
+# widget = reference to your widget
+# desktop = the current desktop
+def desktopChanged(widget, desktop):
+ pass
+
+#This is called everytime the wallpaper changes on a desktop
+# widget = reference to your widget
+# desktop = the desktop whose wallpaper changed
+def wallpaperChanged(widget, desktop):
+ pass
+
+#This is called everytime there is a key press in any focused input field
+# widget = reference to your widget
+# meter = reference to an input box
+# char = the key that was pressed
+def keyPressed(widget, meter, char):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded my python extension!"
diff --git a/superkaramba/examples/test_all.sh b/superkaramba/examples/test_all.sh
new file mode 100755
index 0000000..5e95063
--- /dev/null
+++ b/superkaramba/examples/test_all.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+themes=(
+ "text/text.theme"
+ "autoHide/main.theme"
+ "bar/bar.theme"
+ "graph/graph.theme"
+ "image/image.theme"
+ "popupMenu/popupMenu.theme"
+ "taskBar/cleanbar/cleanbar.theme"
+ "richtext/richtext.theme"
+ "richtext/rtext.theme"
+ "globalMouse/eyes.theme"
+ "unicode/unicode.theme"
+ "mouseDrag/karmix/karmix.theme"
+ "input_api/input_api.theme"
+ "input_example/input_example.theme"
+)
+
+for theme in "${themes[@]}"
+do
+ echo $theme
+ dcop `dcop superkaramba* | head -n 1` default openTheme $PWD/$theme
+ read a
+ dcop `dcop superkaramba* | head -n 1` default closeTheme `expr $theme : '.*/\(.*\)\.'`
+done
+
+#dcop `dcop superkaramba* | head -n 1` default quit
diff --git a/superkaramba/examples/text/text.py b/superkaramba/examples/text/text.py
new file mode 100644
index 0000000..4612dd5
--- /dev/null
+++ b/superkaramba/examples/text/text.py
@@ -0,0 +1,110 @@
+#this import statement allows access to the karamba functions
+import karamba
+
+align = ['LEFT', 'CENTER', 'RIGHT']
+texts = [0,0,0,0,0,0,0,0,0,0,0]
+b = 0
+a = 0
+
+#this is called when you widget is initialized
+def initWidget(widget):
+ global texts, b
+ texts[0] = karamba.getThemeText(widget, "text0")
+ texts[1] = karamba.getThemeText(widget, "text1")
+ texts[2] = karamba.getThemeText(widget, "text2")
+ texts[3] = karamba.getThemeText(widget, "text3")
+ texts[4] = karamba.getThemeText(widget, "text4")
+ texts[5] = karamba.getThemeText(widget, "text5")
+ texts[6] = karamba.getThemeText(widget, "text6")
+ texts[7] = karamba.getThemeText(widget, "text7")
+ texts[8] = karamba.getThemeText(widget, "text8")
+ texts[9] = karamba.getThemeText(widget, "text9")
+ texts[10] = karamba.getThemeText(widget, "text10")
+
+
+#this is called everytime your widget is updated
+#the update inverval is specified in the .theme file
+def widgetUpdated(widget):
+ global texts, b, a
+
+ b = (b+1)%2
+
+ # Create & delete
+ if(texts[0]):
+ karamba.deleteText(widget, texts[0])
+ texts[0] = 0
+ else:
+ texts[0] = karamba.createText(widget, 0, 20, 200, 20, "Text meter")
+
+ # size & resize
+ size = karamba.getTextSize(widget, texts[1])
+ print "getTextSize: " + str(size)
+ size = ((b * 200) + 200, size[1])
+ karamba.resizeText(widget, texts[1], size[0], size[1])
+
+ # pos & move
+ pos = karamba.getTextPos(widget, texts[2])
+ print "getTextPos: " + str(pos)
+ pos = (b * 200, pos[1])
+ karamba.moveText(widget, texts[2], pos[0], pos[1])
+
+ # Hide & Show
+ if(b):
+ karamba.hideText(widget, texts[3])
+ else:
+ karamba.showText(widget, texts[3])
+
+ # Sensor
+ sensor = karamba.getTextSensor(widget, texts[4])
+ print "getSensor: " + str(sensor)
+ if(b):
+ karamba.setTextSensor(widget, texts[4], 'SENSOR=SENSOR TYPE="cpu_temp"')
+ else:
+ karamba.setTextSensor(widget, texts[4], 'SENSOR=CPU')
+
+ # Value
+ v = karamba.getTextValue(widget, texts[5])
+ print "getTextValue: ", v
+ v += '.'
+ karamba.changeText(widget, texts[5], v)
+
+ # Shadow
+ v = karamba.getTextShadow(widget, texts[6])
+ print "getTextShadow: ", v
+ v = (v+1)%10;
+ karamba.changeTextShadow(widget, texts[6], v)
+
+ # Font size
+ v = karamba.getTextFontSize(widget, texts[7])
+ print "getTextFontSize: ", v
+ v = 10 + ((v-10)+1)%10;
+ karamba.changeTextSize(widget, texts[7], v)
+
+ # Text color
+ v = karamba.getTextColor(widget, texts[8])
+ print "getTextColor: ", v
+ karamba.changeTextColor(widget, texts[8], b*255, b*255, b*255)
+
+ # Text Font
+ v = karamba.getTextFont(widget, texts[9])
+ print "getTextFont: ", v
+ if(b):
+ v = 'Bitstream Vera Sans'
+ else:
+ v = 'Bitstream Vera Serif'
+ karamba.changeTextFont(widget, texts[9], v)
+
+ # Text Alignment
+ a = (a+1)%3
+ v = karamba.getTextAlign(widget, texts[10])
+ print "getTextAlign: ", v
+ karamba.setTextAlign(widget, texts[10], align[a])
+
+def widgetClicked(widget, x, y, button):
+ pass
+
+def widgetMouseMoved(widget, x, y, button):
+ pass
+
+# This will be printed when the widget loads.
+print "Loaded Text test python extension!"
diff --git a/superkaramba/examples/text/text.theme b/superkaramba/examples/text/text.theme
new file mode 100644
index 0000000..522640a
--- /dev/null
+++ b/superkaramba/examples/text/text.theme
@@ -0,0 +1,35 @@
+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="createText & deleteText" name=ttext0
+TEXT x=0 Y=20 w=200 h=20 value="Text meter" min=0 max=100 name=text0
+
+TEXT x=0 Y=45 w=600 h=20 VALUE="getTextSize & resizeText" name=ttext1
+TEXT x=0 Y=65 w=200 h=20 value="The quick brown fox jumps over the lazy dog" min=0 max=100 name=text1
+
+TEXT x=0 Y=90 w=600 h=20 VALUE="getTextPos & moveText" name=ttext2
+TEXT x=0 Y=110 w=200 h=20 value="Text meter" min=0 max=100 name=text2
+
+TEXT x=0 Y=135 w=600 h=20 VALUE="hideText & showText" name=ttext3
+TEXT x=0 Y=155 w=200 h=20 value="Text meter" min=0 max=100 name=text3
+
+TEXT x=0 Y=180 w=600 h=20 VALUE="getTextSensor & setTextSensor" name=ttext4
+TEXT x=0 Y=200 w=200 h=20 value=50 min=0 max=100 name=text4
+
+TEXT x=0 Y=225 w=600 h=20 VALUE="getTextValue & setTextValue" name=ttext5
+TEXT x=0 Y=245 w=200 h=20 value="." min=0 max=100 name=text5
+
+TEXT x=0 Y=270 w=600 h=20 VALUE="getTextShadow & setTextShadow" name=ttext6
+TEXT x=0 Y=290 w=400 h=20 value="The quick brown fox jumps over the lazy dog" min=0 max=100 name=text6
+
+TEXT x=0 Y=315 w=600 h=20 VALUE="setTextSize & getTextSize" name=ttext7
+TEXT x=0 Y=335 w=200 h=20 value="Text meter" min=0 max=100 name=text7
+
+TEXT x=0 Y=360 w=600 h=20 VALUE="setTextColor & getTextColor" name=ttext8
+TEXT x=0 Y=380 w=400 h=20 value="The quick brown fox jumps over the lazy dog" min=0 max=100 name=text8
+
+TEXT x=0 Y=405 w=600 h=20 VALUE="setTextFont & getTextFont" name=ttext9
+TEXT x=0 Y=425 w=400 h=20 value="The quick brown fox jumps over the lazy dog" min=0 max=100 name=text9
+
+TEXT x=0 Y=450 w=600 h=20 VALUE="setTextAlign & getTextAlign" name=ttext10
+TEXT x=0 Y=470 w=400 h=20 value="Text meter" min=0 max=100 name=text10
diff --git a/superkaramba/examples/unicode/unicode.py b/superkaramba/examples/unicode/unicode.py
new file mode 100644
index 0000000..13d1136
--- /dev/null
+++ b/superkaramba/examples/unicode/unicode.py
@@ -0,0 +1,116 @@
+#Unicode Example
+
+#For Symbol Tables look at www.unicode.org/charts/
+
+
+#this import statement allows access to the karamba functions
+import karamba
+
+#this is called when you widget is initialized
+def initWidget(widget):
+
+ text=u"""
+