From 2bda8f7717adf28da4af0d34fb82f63d2868c31d Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- superkaramba/examples/API | 6 + superkaramba/examples/README | 62 + superkaramba/examples/api.html | 4016 ++++++++++++++++++++ superkaramba/examples/autoHide/main.py | 62 + superkaramba/examples/autoHide/main.theme | 42 + superkaramba/examples/autoHide/pics/MSN-64x64.png | Bin 0 -> 6178 bytes superkaramba/examples/autoHide/pics/MSN-96x96.png | Bin 0 -> 11529 bytes .../examples/autoHide/pics/Tux_House-64x64.png | Bin 0 -> 4485 bytes .../examples/autoHide/pics/Tux_House-96x96.png | Bin 0 -> 7462 bytes .../examples/autoHide/pics/Tux_Mail-64x64.png | Bin 0 -> 8572 bytes .../examples/autoHide/pics/Tux_Mail-96x96.png | Bin 0 -> 15942 bytes .../examples/autoHide/pics/Tux_Mozilla-64x64.png | Bin 0 -> 7373 bytes .../examples/autoHide/pics/Tux_Mozilla-96x96.png | Bin 0 -> 13570 bytes .../examples/autoHide/pics/Tux_Sherlock-64x64.png | Bin 0 -> 5635 bytes .../examples/autoHide/pics/Tux_Sherlock-96x96.png | Bin 0 -> 10369 bytes .../examples/autoHide/pics/Tux_Terminal-64x64.png | Bin 0 -> 3489 bytes .../examples/autoHide/pics/Tux_Terminal-96x96.png | Bin 0 -> 5985 bytes .../examples/autoHide/pics/Tux_iPhoto-64x64.png | Bin 0 -> 8036 bytes .../examples/autoHide/pics/Tux_iPhoto-96x96.png | Bin 0 -> 14876 bytes superkaramba/examples/autoHide/pics/bar3.png | Bin 0 -> 393 bytes superkaramba/examples/autoHide/pics/bar4.png | Bin 0 -> 310 bytes superkaramba/examples/autoHide/pics/calendar.png | Bin 0 -> 1950 bytes .../examples/autoHide/pics/ctrl center-64x64.png | Bin 0 -> 5582 bytes .../examples/autoHide/pics/ctrl center-96x96.png | Bin 0 -> 9770 bytes .../examples/autoHide/pics/iconbarback.png | Bin 0 -> 2475 bytes superkaramba/examples/autoHide/pics/label3.png | Bin 0 -> 300 bytes superkaramba/examples/autoHide/pics/label4.png | Bin 0 -> 256 bytes superkaramba/examples/autoHide/pics/osxbarback.png | Bin 0 -> 6463 bytes .../examples/autoHide/pics/osxbarbackBig.png | Bin 0 -> 6473 bytes superkaramba/examples/autoHide/pics/pointer.png | Bin 0 -> 309 bytes superkaramba/examples/bar/bar.py | 93 + superkaramba/examples/bar/bar.theme | 26 + superkaramba/examples/bar/hor.png | Bin 0 -> 300 bytes superkaramba/examples/bar/ver.png | Bin 0 -> 321 bytes superkaramba/examples/change_interval/interval.py | 60 + .../examples/change_interval/interval.theme | 2 + superkaramba/examples/control_management/mgmt.py | 49 + .../examples/control_management/mgmt.theme | 1 + .../examples/disableRightClickMenu/disable_menu.py | 176 + .../disableRightClickMenu/disable_menu.theme | 1 + superkaramba/examples/globalMouse/README | 29 + .../examples/globalMouse/extension/setup.py | 12 + .../examples/globalMouse/extension/xcursor.c | 104 + superkaramba/examples/globalMouse/eyes.py | 192 + superkaramba/examples/globalMouse/eyes.theme | 3 + superkaramba/examples/globalMouse/pics/eyes.png | Bin 0 -> 2819 bytes superkaramba/examples/globalMouse/pics/eyes.xcf | Bin 0 -> 18677 bytes superkaramba/examples/globalMouse/pics/mask.png | Bin 0 -> 495 bytes superkaramba/examples/globalMouse/pics/pupille.png | Bin 0 -> 256 bytes superkaramba/examples/globalMouse/xcursor.so | Bin 0 -> 7465 bytes superkaramba/examples/graph/graph.py | 89 + superkaramba/examples/graph/graph.theme | 26 + superkaramba/examples/image/flag.png | Bin 0 -> 1072 bytes superkaramba/examples/image/flag2.png | Bin 0 -> 2130 bytes superkaramba/examples/image/image.py | 121 + superkaramba/examples/image/image.theme | 34 + superkaramba/examples/image/test1.sh | 2 + superkaramba/examples/image/test2.sh | 2 + superkaramba/examples/input_api/input_api.py | 185 + superkaramba/examples/input_api/input_api.theme | 5 + .../examples/input_example/input_example.py | 169 + .../examples/input_example/input_example.theme | 5 + .../examples/mouseDrag/karmix/images/bar.png | Bin 0 -> 207 bytes .../examples/mouseDrag/karmix/images/bg.png | Bin 0 -> 4719 bytes superkaramba/examples/mouseDrag/karmix/karmix.py | 190 + .../examples/mouseDrag/karmix/karmix.theme | 17 + superkaramba/examples/mouseDrop/mousedrop.py | 138 + superkaramba/examples/mouseDrop/mousedrop.theme | 5 + superkaramba/examples/openCloseTheme/1.py | 22 + superkaramba/examples/openCloseTheme/1.theme | 2 + superkaramba/examples/openCloseTheme/2.theme | 2 + superkaramba/examples/popupMenu/calendar.png | Bin 0 -> 1950 bytes superkaramba/examples/popupMenu/popupMenu.png | Bin 0 -> 6221 bytes superkaramba/examples/popupMenu/popupMenu.py | 117 + superkaramba/examples/popupMenu/popupMenu.theme | 4 + superkaramba/examples/richtext/info.png | Bin 0 -> 641 bytes .../examples/richtext/penguin_executive.png | Bin 0 -> 5159 bytes superkaramba/examples/richtext/richtext.py | 136 + superkaramba/examples/richtext/richtext.theme | 1 + superkaramba/examples/richtext/rtext.py | 99 + superkaramba/examples/richtext/rtext.theme | 26 + .../examples/service_group/service_group.py | 143 + .../examples/service_group/service_group.theme | 4 + superkaramba/examples/setIncomingData/1.py | 27 + superkaramba/examples/setIncomingData/1.theme | 2 + superkaramba/examples/setIncomingData/2.py | 78 + superkaramba/examples/setIncomingData/2.theme | 2 + superkaramba/examples/taskBar/cleanbar/README | 25 + superkaramba/examples/taskBar/cleanbar/cleanbar.py | 267 ++ .../examples/taskBar/cleanbar/cleanbar.theme | 14 + .../examples/taskBar/cleanbar/pics/bar2.png | Bin 0 -> 7508 bytes .../examples/taskBar/cleanbar/pics/rightend.png | Bin 0 -> 434 bytes .../taskBar/cleanbar/pics/rightend_new.png | Bin 0 -> 5267 bytes .../examples/taskBar/cleanbar/pics/slickbar.png | Bin 0 -> 3130 bytes .../examples/taskBar/cleanbar/pics/startup.png | Bin 0 -> 2584 bytes .../examples/taskBar/cleanbar/pics/task.png | Bin 0 -> 429 bytes .../examples/taskBar/cleanbar/pics/task_new.png | Bin 0 -> 2470 bytes superkaramba/examples/template.py | 160 + superkaramba/examples/test_all.sh | 27 + superkaramba/examples/text/text.py | 110 + superkaramba/examples/text/text.theme | 35 + superkaramba/examples/unicode/unicode.py | 116 + superkaramba/examples/unicode/unicode.theme | 1 + 103 files changed, 7344 insertions(+) create mode 100644 superkaramba/examples/API create mode 100644 superkaramba/examples/README create mode 100644 superkaramba/examples/api.html create mode 100644 superkaramba/examples/autoHide/main.py create mode 100644 superkaramba/examples/autoHide/main.theme create mode 100644 superkaramba/examples/autoHide/pics/MSN-64x64.png create mode 100644 superkaramba/examples/autoHide/pics/MSN-96x96.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_House-64x64.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_House-96x96.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_Mail-64x64.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_Mail-96x96.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_Mozilla-64x64.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_Mozilla-96x96.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_Sherlock-64x64.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_Sherlock-96x96.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_Terminal-64x64.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_Terminal-96x96.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_iPhoto-64x64.png create mode 100644 superkaramba/examples/autoHide/pics/Tux_iPhoto-96x96.png create mode 100644 superkaramba/examples/autoHide/pics/bar3.png create mode 100644 superkaramba/examples/autoHide/pics/bar4.png create mode 100644 superkaramba/examples/autoHide/pics/calendar.png create mode 100644 superkaramba/examples/autoHide/pics/ctrl center-64x64.png create mode 100644 superkaramba/examples/autoHide/pics/ctrl center-96x96.png create mode 100644 superkaramba/examples/autoHide/pics/iconbarback.png create mode 100644 superkaramba/examples/autoHide/pics/label3.png create mode 100644 superkaramba/examples/autoHide/pics/label4.png create mode 100644 superkaramba/examples/autoHide/pics/osxbarback.png create mode 100644 superkaramba/examples/autoHide/pics/osxbarbackBig.png create mode 100644 superkaramba/examples/autoHide/pics/pointer.png create mode 100644 superkaramba/examples/bar/bar.py create mode 100644 superkaramba/examples/bar/bar.theme create mode 100644 superkaramba/examples/bar/hor.png create mode 100644 superkaramba/examples/bar/ver.png create mode 100644 superkaramba/examples/change_interval/interval.py create mode 100644 superkaramba/examples/change_interval/interval.theme create mode 100644 superkaramba/examples/control_management/mgmt.py create mode 100644 superkaramba/examples/control_management/mgmt.theme create mode 100644 superkaramba/examples/disableRightClickMenu/disable_menu.py create mode 100644 superkaramba/examples/disableRightClickMenu/disable_menu.theme create mode 100644 superkaramba/examples/globalMouse/README create mode 100644 superkaramba/examples/globalMouse/extension/setup.py create mode 100644 superkaramba/examples/globalMouse/extension/xcursor.c create mode 100644 superkaramba/examples/globalMouse/eyes.py create mode 100644 superkaramba/examples/globalMouse/eyes.theme create mode 100644 superkaramba/examples/globalMouse/pics/eyes.png create mode 100644 superkaramba/examples/globalMouse/pics/eyes.xcf create mode 100644 superkaramba/examples/globalMouse/pics/mask.png create mode 100644 superkaramba/examples/globalMouse/pics/pupille.png create mode 100755 superkaramba/examples/globalMouse/xcursor.so create mode 100644 superkaramba/examples/graph/graph.py create mode 100644 superkaramba/examples/graph/graph.theme create mode 100644 superkaramba/examples/image/flag.png create mode 100644 superkaramba/examples/image/flag2.png create mode 100644 superkaramba/examples/image/image.py create mode 100644 superkaramba/examples/image/image.theme create mode 100755 superkaramba/examples/image/test1.sh create mode 100755 superkaramba/examples/image/test2.sh create mode 100644 superkaramba/examples/input_api/input_api.py create mode 100644 superkaramba/examples/input_api/input_api.theme create mode 100644 superkaramba/examples/input_example/input_example.py create mode 100644 superkaramba/examples/input_example/input_example.theme create mode 100644 superkaramba/examples/mouseDrag/karmix/images/bar.png create mode 100644 superkaramba/examples/mouseDrag/karmix/images/bg.png create mode 100644 superkaramba/examples/mouseDrag/karmix/karmix.py create mode 100644 superkaramba/examples/mouseDrag/karmix/karmix.theme create mode 100644 superkaramba/examples/mouseDrop/mousedrop.py create mode 100644 superkaramba/examples/mouseDrop/mousedrop.theme create mode 100644 superkaramba/examples/openCloseTheme/1.py create mode 100644 superkaramba/examples/openCloseTheme/1.theme create mode 100644 superkaramba/examples/openCloseTheme/2.theme create mode 100644 superkaramba/examples/popupMenu/calendar.png create mode 100644 superkaramba/examples/popupMenu/popupMenu.png create mode 100644 superkaramba/examples/popupMenu/popupMenu.py create mode 100644 superkaramba/examples/popupMenu/popupMenu.theme create mode 100644 superkaramba/examples/richtext/info.png create mode 100644 superkaramba/examples/richtext/penguin_executive.png create mode 100644 superkaramba/examples/richtext/richtext.py create mode 100644 superkaramba/examples/richtext/richtext.theme create mode 100644 superkaramba/examples/richtext/rtext.py create mode 100644 superkaramba/examples/richtext/rtext.theme create mode 100644 superkaramba/examples/service_group/service_group.py create mode 100644 superkaramba/examples/service_group/service_group.theme create mode 100644 superkaramba/examples/setIncomingData/1.py create mode 100644 superkaramba/examples/setIncomingData/1.theme create mode 100644 superkaramba/examples/setIncomingData/2.py create mode 100644 superkaramba/examples/setIncomingData/2.theme create mode 100644 superkaramba/examples/taskBar/cleanbar/README create mode 100644 superkaramba/examples/taskBar/cleanbar/cleanbar.py create mode 100644 superkaramba/examples/taskBar/cleanbar/cleanbar.theme create mode 100644 superkaramba/examples/taskBar/cleanbar/pics/bar2.png create mode 100644 superkaramba/examples/taskBar/cleanbar/pics/rightend.png create mode 100644 superkaramba/examples/taskBar/cleanbar/pics/rightend_new.png create mode 100644 superkaramba/examples/taskBar/cleanbar/pics/slickbar.png create mode 100644 superkaramba/examples/taskBar/cleanbar/pics/startup.png create mode 100644 superkaramba/examples/taskBar/cleanbar/pics/task.png create mode 100644 superkaramba/examples/taskBar/cleanbar/pics/task_new.png create mode 100644 superkaramba/examples/template.py create mode 100755 superkaramba/examples/test_all.sh create mode 100644 superkaramba/examples/text/text.py create mode 100644 superkaramba/examples/text/text.theme create mode 100644 superkaramba/examples/unicode/unicode.py create mode 100644 superkaramba/examples/unicode/unicode.theme (limited to 'superkaramba/examples') diff --git a/superkaramba/examples/API b/superkaramba/examples/API new file mode 100644 index 0000000..897e4d2 --- /dev/null +++ b/superkaramba/examples/API @@ -0,0 +1,6 @@ +All of the programmers reference material has been moved to the web site. + +It is at: + +http://netdragon.sourceforge.net/index.php?page=Information+for+Theme+Creators + diff --git a/superkaramba/examples/README b/superkaramba/examples/README new file mode 100644 index 0000000..712cf0e --- /dev/null +++ b/superkaramba/examples/README @@ -0,0 +1,62 @@ +All of the information for programmers is in the file called "API". + +Here are some examples of themes with matching python addons: + +autoHide/ + + This is the main.theme from kde-look.org with a simple + example python script that makes it "auto-hide". + Move the mouse over it to pop it back out. + +globalMouse/ + + This shows how to get the mouse cursor position anyway on + the screen but using the xcursor python module. + (This is Karamba Eyes by Wilfried.Huss@gmx.at) + +input_api/ + + This shows some of the different things you can do to an input box + once you have one created. + +input_example/ + + This is a functional example of how you grab text entered into an + input box and use it to do something. In this example, the text + is used to search for the entered word on dict.leo.org. + (This sample was contributed by Alex Wiedenbruch ) + +mouseDrag/ + + This shows how to use mouse dragging in the callback widgetMouseMoved + in your themes. + (This is karmix by Tian and rewritten by Ryan Nickell) + +openCloseTheme/ + + This shows how you can open a new theme from within an existing theme, + and how you can close themes. + +popupMenu/ + + This shows up to create popup menus, display them, and then + do something with the user input from them. + (This is a sample by MrDobalina ) + +richtext/ + + This is a simple example of how to use rich text (text with HTML + tags) in your themes. + (This is by Wilfried.Huss@gmx.at) + +taskBar/ + + This shows how to use the task management API to create a + simple taskbar. + (This is cleanbar by Adam Geitgey) + +unicode/ + + This is a simple example of how to display unicode characters in your + theme. + (This is by Wilfried.Huss@gmx.at) diff --git a/superkaramba/examples/api.html b/superkaramba/examples/api.html new file mode 100644 index 0000000..132544a --- /dev/null +++ b/superkaramba/examples/api.html @@ -0,0 +1,4016 @@ + + + + +./python_api + + + + + +Generated with ROBODoc v4.99.6 on Mon Nov 15 21:51:28 2004 +
+

TABLE OF CONTENTS

+ +
+ +

+Widget/createWidgetMask

+ +

[top]

+

SYNOPSIS

+

long createWidgetMask(widget, mask) +

+

DESCRIPTION

+

This function doesn't work currently due to a bug in KDE. Please use + MASK= in your .theme file for the time being. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string mask -- The name of the widget mask file. +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Widget/getWidgetPosition

+ +

[top]

+

SYNOPSIS

+

tuple getWidgetPosition(widget) +

+

DESCRIPTION

+

Returns a Python Tuple containing the x and y position of you widget. + widget is a reference to the current widget. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

position of the widget +

+
+
+ +

+Widget/moveWidget

+ +

[top]

+

SYNOPSIS

+

long moveWidget(widget, x, y) +

+

DESCRIPTION

+

Moves your karamba widget to a new screen location +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Widget/redrawWidget

+ +

[top]

+

SYNOPSIS

+

long redrawWidget(widget) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Widget/redrawWidgetBackground

+ +

[top]

+

SYNOPSIS

+

long redrawWidgetBackground(widget) +

+

DESCRIPTION

+

Redraws widget background. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Widget/resizeWidget

+ +

[top]

+

SYNOPSIS

+

long resizeWidget(widget, w, h) +

+

DESCRIPTION

+

Resizes your karamba widget to width=w, height=h +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Widget/toggleWidgetRedraw

+ +

[top]

+

SYNOPSIS

+

long toggleWidgetRedraw(widget, b) +

+

DESCRIPTION

+

Toggles widget redraw. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long b -- 1 = widget is drawn +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/changeText

+ +

[top]

+

SYNOPSIS

+

long changeText(widget, text, value) +

+

DESCRIPTION

+

This will change the contents of a text widget. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • long value -- new value +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/changeTextColor

+ +

[top]

+

SYNOPSIS

+

long changeTextColor(widget, text, r, g, b) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • long red -- red component of color +
  • +
  • long green -- green component of color +
  • +
  • long blue -- blue component of color +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/changeTextFont

+ +

[top]

+

SYNOPSIS

+

long changeTextFont(widget, text, font) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • string font -- font name +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/changeTextShadow

+ +

[top]

+

SYNOPSIS

+

long changeTextShadow(widget, text, shadow) +

+

DESCRIPTION

+

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 +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • long shadow -- shadow offset +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/changeTextSize

+ +

[top]

+

SYNOPSIS

+

long changeTextSize(widget, text, size) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • long size -- new size for text +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/createText

+ +

[top]

+

SYNOPSIS

+

long createText(widget, x, y, w, h, text) +

+

DESCRIPTION

+

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() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
  • string text -- text for the textlabel +
  • +
+

+

RETURN VALUE

+

Pointer to new text meter +

+
+
+ +

+Text/deleteText

+ +

[top]

+

SYNOPSIS

+

long deleteText(widget, text) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long widget -- text +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/getTextAlign

+ +

[top]

+

SYNOPSIS

+

string getTextAlign(widget, text) +

+

DESCRIPTION

+

Get current text align. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

LEFT, CENTER or RIGHT +

+
+
+ +

+Text/getTextColor

+ +

[top]

+

SYNOPSIS

+

tuple getTextColor(widget, text) +

+

DESCRIPTION

+

Get current text color +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

(red, green, blue) +

+
+
+ +

+Text/getTextFont

+ +

[top]

+

SYNOPSIS

+

string getTextFont(widget, text) +

+

DESCRIPTION

+

Get current text font name +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

font name +

+
+
+ +

+Text/getTextFontSize

+ +

[top]

+

SYNOPSIS

+

long getTextFontSize(widget, text) +

+

DESCRIPTION

+

Get current text font size +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

text font size +

+
+
+ +

+Text/getTextPos

+ +

[top]

+

SYNOPSIS

+

tuple getTextPos(widget, text) +

+

DESCRIPTION

+

Given a reference to a text object, this will return a tuple + containing the x and y coordinate of a text object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

pos +

+
+
+ +

+Text/getTextSensor

+ +

[top]

+

SYNOPSIS

+

string getTextSensor(widget, text) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

sensor string +

+
+
+ +

+Text/getTextShadow

+ +

[top]

+

SYNOPSIS

+

long getTextShadow(widget, text) +

+

DESCRIPTION

+

Get current shadow offset +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

shadow offset +

+
+
+ +

+Text/getTextSize

+ +

[top]

+

SYNOPSIS

+

tuple getTextSize(widget, text) +

+

DESCRIPTION

+

Given a reference to a text object, this will return a tuple + containing the height and width of a text object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

size +

+
+
+ +

+Text/getTextValue

+ +

[top]

+

SYNOPSIS

+

string getTextValue(widget, text) +

+

DESCRIPTION

+

Returns current text value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

value +

+
+
+ +

+Text/getThemeText

+ +

[top]

+

SYNOPSIS

+

long getThemeText(widget, name) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string name -- name of the text to get +
  • +
+

+

RETURN VALUE

+

Pointer to text +

+
+
+ +

+Text/hideText

+ +

[top]

+

SYNOPSIS

+

long hideText(widget, text) +

+

DESCRIPTION

+

Hides text that is visible. You need to call redrawWidget() afterwords + to actually hide the text on screen. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/moveText

+ +

[top]

+

SYNOPSIS

+

long moveText(widget, text, x, y) +

+

DESCRIPTION

+

This moves a text object to a new x, y relative to your widget. In other + words, (0,0) is the top corner of your widget, not the screen. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/resizeText

+ +

[top]

+

SYNOPSIS

+

long resizeText(widget, text, w, h) +

+

DESCRIPTION

+

This will resize text to new height and width. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • long w -- new width +
  • +
  • long h -- new height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/setTextAlign

+ +

[top]

+

SYNOPSIS

+

long setTextAlign(widget, text, align) +

+

DESCRIPTION

+

Sets text label align. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • string align -- LEFT, CENTER or RIGHT +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/setTextSensor

+ +

[top]

+

SYNOPSIS

+

long setTextSensor(widget, text, sensor) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
  • string sensor -- new sensor as in theme files +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Text/showText

+ +

[top]

+

SYNOPSIS

+

long showText(widget, text) +

+

DESCRIPTION

+

Shows text that has been hidden with hideText() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long text -- pointer to text +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Task/getStartupInfo

+ +

[top]

+

SYNOPSIS

+

list getStartupInfo(widget, task) +

+

DESCRIPTION

+

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 +
  • +
+

+
+
+ +

+Task/getStartupList

+ +

[top]

+

SYNOPSIS

+

list getTaskList(widget) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

startup list +

+
+
+ +

+Task/getTaskInfo

+ +

[top]

+

SYNOPSIS

+

list getTaskInfo(widget, task) +

+

DESCRIPTION

+

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 +
  • +
+

+
+
+ +

+Task/getTaskList

+ +

[top]

+

SYNOPSIS

+

list getTaskList(widget) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

Task list +

+
+
+ +

+Task/getTaskNames

+ +

[top]

+

SYNOPSIS

+

list getTaskNames(widget) +

+

DESCRIPTION

+

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() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

Task list +

+
+
+ +

+Task/performTaskAction

+ +

[top]

+

SYNOPSIS

+

long performTaskAction(widget, task, action) +

+

DESCRIPTION

+

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) +
  • +
+

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long task -- pointer to task +
  • +
  • long action -- action number +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Systray/createSystray

+ +

[top]

+

SYNOPSIS

+

long createSystray(widget, x, y, w, h) +

+

DESCRIPTION

+

?? +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Systray/getCurrentWindowCount

+ +

[top]

+

SYNOPSIS

+

long getCurrentWindowCount(widget) +

+

DESCRIPTION

+

?? +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

window count +

+
+
+ +

+Systray/hideSystray

+ +

[top]

+

SYNOPSIS

+

long hideSystray(widget) +

+

DESCRIPTION

+

?? +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Systray/moveSystray

+ +

[top]

+

SYNOPSIS

+

long moveSystray(widget, x, y, w, h) +

+

DESCRIPTION

+

?? +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Systray/showSystray

+ +

[top]

+

SYNOPSIS

+

long showSystray(widget) +

+

DESCRIPTION

+

?? +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Systray/updateSystrayLayout

+ +

[top]

+

SYNOPSIS

+

long getCurrentWindowCount(widget) +

+

DESCRIPTION

+

?? +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/changeRichText

+ +

[top]

+

SYNOPSIS

+

long changeRichText(widget, richtext, value) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
  • string value -- new text +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/changeRichTextFont

+ +

[top]

+

SYNOPSIS

+

long changeRichTextFont(widget, richtext, font) +

+

DESCRIPTION

+

This will change the font of a richtext widget. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
  • string font -- name of the new font +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/changeRichTextSize

+ +

[top]

+

SYNOPSIS

+

long changeRichTextSize(widget, richtext, size) +

+

DESCRIPTION

+

This will change the font size of a richtext widget. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
  • long size -- new font point size +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/createRichText

+ +

[top]

+

SYNOPSIS

+

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 +
  • +
+

+

RETURN VALUE

+

Pointer to new richtext meter +

+
+
+ +

+RichText/deleteRichText

+ +

[top]

+

SYNOPSIS

+

long deleteRichText(widget, richtext) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long widget -- richtext +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/getRichTextFont

+ +

[top]

+

SYNOPSIS

+

string getRichTextFont(widget, richtext) +

+

DESCRIPTION

+

This will get the font of a richtext widget. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
+

+

RETURN VALUE

+

font name +

+
+
+ +

+RichText/getRichTextFontSize

+ +

[top]

+

SYNOPSIS

+

long getRichTextFontSize(widget, richtext) +

+

DESCRIPTION

+

This will get the font size of a richtext widget. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
+

+

RETURN VALUE

+

font point size +

+
+
+ +

+RichText/getRichTextPos

+ +

[top]

+

SYNOPSIS

+

tuple getRichTextPos(widget, richtext) +

+

DESCRIPTION

+

Given a reference to a richtext object, this will return a tuple + containing the x and y coordinate of a richtext object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
+

+

RETURN VALUE

+

pos +

+
+
+ +

+RichText/getRichTextSensor

+ +

[top]

+

SYNOPSIS

+

string getRichTextSensor(widget, richtext) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
+

+

RETURN VALUE

+

sensor string +

+
+
+ +

+RichText/getRichTextSize

+ +

[top]

+

SYNOPSIS

+

tuple getRichTextSize(widget, richtext) +

+

DESCRIPTION

+

Given a reference to a richtext object, this will return a tuple + containing the height and width of a richtext object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
+

+

RETURN VALUE

+

size +

+
+
+ +

+RichText/getRichTextValue

+ +

[top]

+

SYNOPSIS

+

string getRichTextValue(widget, richtext) +

+

DESCRIPTION

+

Returns current richtext value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
+

+

RETURN VALUE

+

value +

+
+
+ +

+RichText/getThemeRichText

+ +

[top]

+

SYNOPSIS

+

long getThemeRichText(widget, name) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string name -- name of the richtext to get +
  • +
+

+

RETURN VALUE

+

Pointer to richtext +

+
+
+ +

+RichText/hideRichText

+ +

[top]

+

SYNOPSIS

+

long hideRichText(widget, richtext) +

+

DESCRIPTION

+

This hides an richtext. In other words, during subsequent calls to + widgetUpdate(), this richtext will not be drawn. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/moveRichText

+ +

[top]

+

SYNOPSIS

+

long moveRichText(widget, richtext, x, y) +

+

DESCRIPTION

+

This moves a text object to a new x, y relative to your widget. In other + words, (0,0) is the top corner of your widget, not the screen. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/resizeRichText

+ +

[top]

+

SYNOPSIS

+

long resizeRichText(widget, richtext, w, h) +

+

DESCRIPTION

+

This will resize richtext to new height and width. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
  • long w -- new width +
  • +
  • long h -- new height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/setRichTextSensor

+ +

[top]

+

SYNOPSIS

+

long setRichTextSensor(widget, richtext, sensor) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
  • string sensor -- new sensor as in theme files +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/setRichTextWidth

+ +

[top]

+

SYNOPSIS

+

long setRichTextWidth(widget, richtext, width) +

+

DESCRIPTION

+

Given a reference to a rich text object, this function changes it's width + to the specified value in pixels. +

+ +

The height adjusts automatically as the contents are changed with + changeRichText. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
  • long width -- new width in pixels +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+RichText/showRichText

+ +

[top]

+

SYNOPSIS

+

long showRichText(widget, richtext) +

+

DESCRIPTION

+

This shows an richtext. In other words, during subsequent calls to + widgetUpdate(), this richtext will be drawn. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long richtext -- pointer to richtext +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/acceptDrops

+ +

[top]

+

SYNOPSIS

+

long acceptDrops(widget) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/attachClickArea

+ +

[top]

+

SYNOPSIS

+

long attachClickArea(widget, meter, lB, mB, rB) +

+

DESCRIPTION

+

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). +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long meter -- pointer to meter +
  • +
  • string lB -- command to left mouse button +
  • +
  • string mB -- command to middle mouse button +
  • +
  • string rB -- command to right mouse button +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/createClickArea

+ +

[top]

+

SYNOPSIS

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
  • string cmd_to_run -- command to be run +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/execute

+ +

[top]

+

SYNOPSIS

+

long execute(widget, command) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string command -- command to execute +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/executeInteractive

+ +

[top]

+

SYNOPSIS

+

long executeInteractive(widget, command) +

+

DESCRIPTION

+

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. +

+ +

Example: Run the command "ls -la *.zip" +

+ +

myCommand = ["ls", "-la", "*.zip"] + karamba.executeInteractive(widget, myCommand) +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string command -- command to execute +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/getIp

+ +

[top]

+

SYNOPSIS

+

string getIp(widget, interface_name) +

+

DESCRIPTION

+

get current IP address of the interface_name interface. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string interface_name -- name of the interface to get ip +
  • +
+

+

RETURN VALUE

+

ip address +

+
+
+ +

+Misc/getNumberOfDesktop

+ +

[top]

+

SYNOPSIS

+

long getNumberOfDesktop(widget) +

+

DESCRIPTION

+

Returns number fo desktops +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

number of desktops +

+
+
+ +

+Misc/getThemePath

+ +

[top]

+

SYNOPSIS

+

string getThemePath(widget) +

+

DESCRIPTION

+

Returns a string containing the directory where your theme was loaded + from. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

path to theme +

+
+
+ +

+Misc/hide

+ +

[top]

+

SYNOPSIS

+

string hide(widget) +

+

DESCRIPTION

+

hide theme +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/openTheme

+ +

[top]

+

SYNOPSIS

+

long openTheme(theme) +

+

DESCRIPTION

+

Opens new theme. +

+

ARGUMENTS

+
  • string theme -- path to new theme +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/show

+ +

[top]

+

SYNOPSIS

+

string show(widget) +

+

DESCRIPTION

+

show theme +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/toggleShowDesktop

+ +

[top]

+

SYNOPSIS

+

long toggleShowDesktop(widget) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Misc/translateAll

+ +

[top]

+

SYNOPSIS

+

long translateAll(widget, relative_x, relative_y) +

+

DESCRIPTION

+

Moves all widgets within a theme in a particular direction relative from + the previous spot without moving the parent theme widget. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long translate_x -- move horizontally +
  • +
  • long translate_y -- move vertically +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Menu/addMenuItem

+ +

[top]

+

SYNOPSIS

+

long addMenuItem(widget, menu, text, icon) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long menu -- pointer to menu +
  • +
  • string text -- text for menu item +
  • +
  • string icon -- icon +
  • +
+

+

RETURN VALUE

+

menu item id +

+
+
+ +

+Menu/addMenuSeparator

+ +

[top]

+

SYNOPSIS

+

long addMenuSeparator(widget, menu) +

+

DESCRIPTION

+

This adds an menu separator to the given menu. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long menu -- pointer to menu +
  • +
+

+

RETURN VALUE

+

menu item id +

+
+
+ +

+Menu/createMenu

+ +

[top]

+

SYNOPSIS

+

long createMenu(widget) +

+

DESCRIPTION

+

This creates an empty popup menu and returns a pointer to the menu. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
+

+

RETURN VALUE

+

pointer to menu +

+
+
+ +

+Menu/deleteMenu

+ +

[top]

+

SYNOPSIS

+

long deleteMenu(widget, menu) +

+

DESCRIPTION

+

This deletes the referenced menu if that menu exists. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long menu -- pointer to menu +
  • +
+

+

RETURN VALUE

+

1 if menu existed and was deleted, returns 0 otherwise. +

+
+
+ +

+Menu/popupMenu

+ +

[top]

+

SYNOPSIS

+

long popupMenu(widget, menu, x, y) +

+

DESCRIPTION

+

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. +

+
+
+ +

+Menu/removeMenuItem

+ +

[top]

+

SYNOPSIS

+

long removeMenuItem(widget, menu, id) +

+

DESCRIPTION

+

This removes the item with given id from given menu if that menu exists. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long menu -- pointer to menu +
  • +
  • long id -- menu item id +
  • +
+

+

RETURN VALUE

+

1 if the menu item existed and was removed or returns zero otherwise. +

+
+
+ +

+Image/addImageTooltip

+ +

[top]

+

SYNOPSIS

+

long addImageTooltip(widget, image, text) +

+

DESCRIPTION

+

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. +
  • +
+

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
  • string text -- tooltip text +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/changeImageChannelIntensity

+ +

[top]

+

SYNOPSIS

+

long changeImageChannelIntensity(widget, image, ratio, channel, millisec) +

+

DESCRIPTION

+

Changes the "intensity" of the image color channel, which is similar to + it's brightness. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
  • float ratio -- -1.0 to 1.0 (dark to bright) +
  • +
  • string channel -- color channel (red|green|blue) +
  • +
  • long millisec -- milliseconds before the image is restored +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/changeImageIntensity

+ +

[top]

+

SYNOPSIS

+

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 +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/changeImageToGray

+ +

[top]

+

SYNOPSIS

+

long changeImageToGray(widget, image, millisec) +

+

DESCRIPTION

+

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 +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/createBackgroundImage

+ +

[top]

+

SYNOPSIS

+

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() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • string image -- image for the imagelabel +
  • +
+

+

RETURN VALUE

+

Pointer to new image meter +

+
+
+ +

+Image/createImage

+ +

[top]

+

SYNOPSIS

+

long createImage(widget, x, y, image) +

+

DESCRIPTION

+

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() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • string image -- image for the imagelabel +
  • +
+

+

RETURN VALUE

+

Pointer to new image meter +

+
+
+ +

+Image/createTaskIcon

+ +

[top]

+

SYNOPSIS

+

long createTaskIcon(widget, x, y, ctask) +

+

DESCRIPTION

+

This creates a task image at x,y. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • long task -- task +
  • +
+

+

RETURN VALUE

+

Pointer to new image meter +

+
+
+ +

+Image/deleteImage

+ +

[top]

+

SYNOPSIS

+

long deleteImage(widget, image) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long widget -- image +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/getImageHeight

+ +

[top]

+

SYNOPSIS

+

long getImageSize(widget, image) +

+

DESCRIPTION

+

This returns the height 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 +
  • +
+

+

RETURN VALUE

+

height +

+
+
+ +

+Image/getImagePath

+ +

[top]

+

SYNOPSIS

+

string getImagePath(widget, image) +

+

DESCRIPTION

+

Returns current image path. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
+

+

RETURN VALUE

+

path +

+
+
+ +

+Image/getImagePos

+ +

[top]

+

SYNOPSIS

+

tuple getImagePos(widget, image) +

+

DESCRIPTION

+

Given a reference to a image object, this will return a tuple + containing the x and y coordinate of a image object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
+

+

RETURN VALUE

+

pos +

+
+
+ +

+Image/getImageSensor

+ +

[top]

+

SYNOPSIS

+

string getImageSensor(widget, image) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
+

+

RETURN VALUE

+

sensor string +

+
+
+ +

+Image/getImageSize

+ +

[top]

+

SYNOPSIS

+

tuple getImageSize(widget, image) +

+

DESCRIPTION

+

Given a reference to a image object, this will return a tuple + containing the height and width of a image object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
+

+

RETURN VALUE

+

size +

+
+
+ +

+Image/getImageWidth

+ +

[top]

+

SYNOPSIS

+

long getImageSize(widget, image) +

+

DESCRIPTION

+

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 +

+

RETURN VALUE

+

width +

+
+
+ +

+Image/getThemeImage

+ +

[top]

+

SYNOPSIS

+

long getThemeImage(widget, name) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string name -- name of the image to get +
  • +
+

+

RETURN VALUE

+

Pointer to image +

+
+
+ +

+Image/hideImage

+ +

[top]

+

SYNOPSIS

+

long hideImage(widget, image) +

+

DESCRIPTION

+

This hides an image. In other words, during subsequent calls to + widgetUpdate(), this image will not be drawn. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/moveImage

+ +

[top]

+

SYNOPSIS

+

long moveImage(widget, image, x, y) +

+

DESCRIPTION

+

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() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/removeImageEffects

+ +

[top]

+

SYNOPSIS

+

long removeImageEffects(widget, image) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/removeImageTransformations

+ +

[top]

+

SYNOPSIS

+

long removeImageTransformations(widget, image) +

+

DESCRIPTION

+

If you have rotated or resized your image, you can call this to restore + your image to it's original form. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/resizeImage

+ +

[top]

+

SYNOPSIS

+

long resizeImage(widget, image, w, h) +

+

DESCRIPTION

+

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() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/resizeImageSmooth

+ +

[top]

+

SYNOPSIS

+

long resizeImageSmooth(widget, image, w, h) +

+

DESCRIPTION

+

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() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/rotateImage

+ +

[top]

+

SYNOPSIS

+

long rotateImage(widget, image, deg) +

+

DESCRIPTION

+

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() +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
  • long deg -- degrees to rotate +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/setImagePath

+ +

[top]

+

SYNOPSIS

+

long setImagePath(widget, image, path) +

+

DESCRIPTION

+

This will change image of a image widget. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
  • long path -- new path +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/setImageSensor

+ +

[top]

+

SYNOPSIS

+

long setImageSensor(widget, image, sensor) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
  • string sensor -- new sensor as in theme files +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Image/showImage

+ +

[top]

+

SYNOPSIS

+

long showImage(widget, image) +

+

DESCRIPTION

+

This shows a previously hidden image. It does not actually refresh the + image on screen. That is what redrawWidget() does. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long image -- pointer to image +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/createGraph

+ +

[top]

+

SYNOPSIS

+

long createGraph(widget, x, y, w, h, points) +

+

DESCRIPTION

+

This creates a graph at x,y with width and height w,h. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
  • long points -- Number of points in graph +
  • +
+

+

RETURN VALUE

+

Pointer to new graph meter +

+
+
+ +

+Graph/deleteGraph

+ +

[top]

+

SYNOPSIS

+

long deleteGraph(widget, graph) +

+

DESCRIPTION

+

This deletes graph. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long widget -- graph +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/getGraphColor

+ +

[top]

+

SYNOPSIS

+

tuple getGraphColor(widget, graph) +

+

DESCRIPTION

+

Get current graph color +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
+

+

RETURN VALUE

+

(red, green, blue) +

+
+
+ +

+Graph/getGraphMinMax

+ +

[top]

+

SYNOPSIS

+

tuple getGraphMinMax(widget, graph) +

+

DESCRIPTION

+

Returns current graph value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
+

+

RETURN VALUE

+

min & max +

+
+
+ +

+Graph/getGraphPos

+ +

[top]

+

SYNOPSIS

+

tuple getGraphPos(widget, graph) +

+

DESCRIPTION

+

Given a reference to a graph object, this will return a tuple + containing the x and y coordinate of a graph object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
+

+

RETURN VALUE

+

pos +

+
+
+ +

+Graph/getGraphSensor

+ +

[top]

+

SYNOPSIS

+

string getGraphSensor(widget, graph) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
+

+

RETURN VALUE

+

sensor string +

+
+
+ +

+Graph/getGraphSize

+ +

[top]

+

SYNOPSIS

+

tuple getGraphSize(widget, graph) +

+

DESCRIPTION

+

Given a reference to a graph object, this will return a tuple + containing the height and width of a graph object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
+

+

RETURN VALUE

+

size +

+
+
+ +

+Graph/getGraphValue

+ +

[top]

+

SYNOPSIS

+

long getGraphValue(widget, graph) +

+

DESCRIPTION

+

Returns current graph value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
+

+

RETURN VALUE

+

value +

+
+
+ +

+Graph/getThemeGraph

+ +

[top]

+

SYNOPSIS

+

long getThemeGraph(widget, name) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string name -- name of the graph to get +
  • +
+

+

RETURN VALUE

+

Pointer to graph +

+
+
+ +

+Graph/hideGraph

+ +

[top]

+

SYNOPSIS

+

long hideGraph(widget, graph) +

+

DESCRIPTION

+

This hides an graph. In other words, during subsequent calls to + widgetUpdate(), this graph will not be drawn. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/moveGraph

+ +

[top]

+

SYNOPSIS

+

long moveGraph(widget, graph, x, y) +

+

DESCRIPTION

+

This will move graph to new x and y coordinates. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/resizeGraph

+ +

[top]

+

SYNOPSIS

+

long resizeGraph(widget, graph, w, h) +

+

DESCRIPTION

+

This will resize graph to new height and width. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
  • long w -- new width +
  • +
  • long h -- new height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/setGraphColor

+ +

[top]

+

SYNOPSIS

+

tuple setGraphColor(widget, graph, red, green, blue) +

+

DESCRIPTION

+

Set current graph color +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
  • long red -- red component of color +
  • +
  • long green -- green component of color +
  • +
  • long blue -- blue component of color +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/setGraphMinMax

+ +

[top]

+

SYNOPSIS

+

long setGraphMinMax(widget, graph, min, max) +

+

DESCRIPTION

+

Returns current graph value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
  • long min -- min value +
  • +
  • long max -- max value +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/setGraphSensor

+ +

[top]

+

SYNOPSIS

+

long setGraphSensor(widget, graph, sensor) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
  • string sensor -- new sensor as in theme files +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/setGraphValue

+ +

[top]

+

SYNOPSIS

+

long setGraphValue(widget, graph, value) +

+

DESCRIPTION

+

Sets current graph value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
  • long value -- new value +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Graph/showGraph

+ +

[top]

+

SYNOPSIS

+

long showGraph(widget, graph) +

+

DESCRIPTION

+

This shows an graph. In other words, during subsequent calls to + widgetUpdate(), this graph will be drawn. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long graph -- pointer to graph +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Config/addMenuConfigOption

+ +

[top]

+

SYNOPSIS

+

long addMenuConfigOption(widget, key, name) +

+

DESCRIPTION

+

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: +

+ +

addMenuConfigOption(widget, String key, String name) +

+ +

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") +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string key -- key for menu item +
  • +
  • string name -- name of the graph to get +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Config/readConfigEntry

+ +

[top]

+

SYNOPSIS

+

string|long readConfigEntry(widget, key, value) +

+

DESCRIPTION

+

This function reads an entry from the config file with the given key. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string key -- key for config item +
  • +
+

+

RETURN VALUE

+

config value for key +

+
+
+ +

+Config/readMenuConfigOption

+ +

[top]

+

SYNOPSIS

+

long readMenuConfigOption(widget, key) +

+

DESCRIPTION

+

This returns whether or not the given option is checked in the theme's + Configure Theme menu. +

+ +

See addMenuConfigOption for a more detailed explanation. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string key -- key for menu item +
  • +
+

+

RETURN VALUE

+

0 is returned if it is not checked and 1 is returned if it is. +

+
+
+ +

+Config/setMenuConfigOption

+ +

[top]

+

SYNOPSIS

+

long setMenuConfigOption(widget, key, value) +

+

DESCRIPTION

+

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. +

+ +

See addMenuConfigOption for a more detailed explanation. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string key -- key for menu item +
  • +
  • int value -- 1 if checked +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Config/writeConfigEntry

+ +

[top]

+

SYNOPSIS

+

long writeConfigEntry(widget, key, value) +

+

DESCRIPTION

+

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") +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string key -- key for config item +
  • +
  • string value -- config value +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/createBar

+ +

[top]

+

SYNOPSIS

+

long createBar(widget, x, y, w, h, image) +

+

DESCRIPTION

+

This creates a bar at x,y with width and height w,h. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
  • long w -- width +
  • +
  • long h -- height +
  • +
  • string image -- Path to image +
  • +
+

+

RETURN VALUE

+

Pointer to new bar meter +

+
+
+ +

+Bar/deleteBar

+ +

[top]

+

SYNOPSIS

+

long deleteBar(widget, bar) +

+

DESCRIPTION

+

This deletes bar. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long widget -- bar +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/getBarImage

+ +

[top]

+

SYNOPSIS

+

string getBarImage(widget, bar) +

+

DESCRIPTION

+

Get bar image +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
+

+

RETURN VALUE

+

path to bar image +

+
+
+ +

+Bar/getBarMinMax

+ +

[top]

+

SYNOPSIS

+

tuple getBarMinMax(widget, bar) +

+

DESCRIPTION

+

Returns current bar value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
+

+

RETURN VALUE

+

min & max +

+
+
+ +

+Bar/getBarPos

+ +

[top]

+

SYNOPSIS

+

tuple getBarPos(widget, bar) +

+

DESCRIPTION

+

Given a reference to a bar object, this will return a tuple + containing the x and y coordinate of a bar object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
+

+

RETURN VALUE

+

pos +

+
+
+ +

+Bar/getBarSensor

+ +

[top]

+

SYNOPSIS

+

string getBarSensor(widget, bar) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
+

+

RETURN VALUE

+

sensor string +

+
+
+ +

+Bar/getBarSize

+ +

[top]

+

SYNOPSIS

+

tuple getBarSize(widget, bar) +

+

DESCRIPTION

+

Given a reference to a bar object, this will return a tuple + containing the height and width of a bar object. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
+

+

RETURN VALUE

+

size +

+
+
+ +

+Bar/getBarValue

+ +

[top]

+

SYNOPSIS

+

long getBarValue(widget, bar) +

+

DESCRIPTION

+

Returns current bar value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
+

+

RETURN VALUE

+

value +

+
+
+ +

+Bar/getBarVertical

+ +

[top]

+

SYNOPSIS

+

string getBarVertical(widget, bar) +

+

DESCRIPTION

+

Check if bar is vertical bar +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
+

+

RETURN VALUE

+

1 if vertical +

+
+
+ +

+Bar/getThemeBar

+ +

[top]

+

SYNOPSIS

+

long getThemeBar(widget, name) +

+

DESCRIPTION

+

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. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • string name -- name of the bar to get +
  • +
+

+

RETURN VALUE

+

Pointer to bar +

+
+
+ +

+Bar/hideBar

+ +

[top]

+

SYNOPSIS

+

long hideBar(widget, bar) +

+

DESCRIPTION

+

This hides an bar. In other words, during subsequent calls to + widgetUpdate(), this bar will not be drawn. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/moveBar

+ +

[top]

+

SYNOPSIS

+

long moveBar(widget, bar, x, y) +

+

DESCRIPTION

+

This will move bar to new x and y coordinates. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
  • long x -- x coordinate +
  • +
  • long y -- y coordinate +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/resizeBar

+ +

[top]

+

SYNOPSIS

+

long resizeBar(widget, bar, w, h) +

+

DESCRIPTION

+

This will resize bar to new height and width. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
  • long w -- new width +
  • +
  • long h -- new height +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/setBarImage

+ +

[top]

+

SYNOPSIS

+

long setBarImage(widget, bar, image) +

+

DESCRIPTION

+

Get bar image +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
  • string image -- new image +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/setBarMinMax

+ +

[top]

+

SYNOPSIS

+

long setBarMinMax(widget, bar, min, max) +

+

DESCRIPTION

+

Returns current bar value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
  • long min -- min value +
  • +
  • long max -- max value +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/setBarSensor

+ +

[top]

+

SYNOPSIS

+

long setBarSensor(widget, bar, sensor) +

+

DESCRIPTION

+

Get current sensor string +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
  • string sensor -- new sensor as in theme files +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/setBarValue

+ +

[top]

+

SYNOPSIS

+

long setBarValue(widget, bar, value) +

+

DESCRIPTION

+

Sets current bar value. +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
  • long value -- new value +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/setBarVertical

+ +

[top]

+

SYNOPSIS

+

long setBarVertical(widget, bar) +

+

DESCRIPTION

+

Set bar vertical +

+

ARGUMENTS

+
  • long widget -- karamba +
  • +
  • long bar -- pointer to bar +
  • +
  • long vertical -- 1 if vertical +
  • +
+

+

RETURN VALUE

+

1 if successful +

+
+
+ +

+Bar/showBar

+ +

[top]

+

SYNOPSIS

+

long showBar(widget, bar) +

+

DESCRIPTION

+

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.

+

Some features: +

    +
  • Numbered and unnumbered lists
  • +
  • Inline Images +
  • Various different text colours
  • +
  • Hyperlinks: Superkaramba Homepage
  • +
  • Links can also trigger actions in the script
  • +
  • Various different caracter styles
  • +
  • Unicode: \u03B6 \u03B3 \u03BB \u03A3 \u03A9
  • +
  • Simple Tables: + + + + +
    Header
    Cell (1,1)Cell (1,2)Cell (1,3)
    Cell (2,1)Cell (2,2)Cell (2,3)
  • +
+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""" +

UNICODE Example

+

Greek:

+\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0 +\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9 +
+\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0 +\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9 +

Cyrillic:

+\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F +\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F +
+\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F +\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F +

Hebrew:

+\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF +\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA +

Arabic:

+\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630 +\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\u0641\u0642\u0643\u0644\u0645\u0646 +\u0647\u0648\u064A +

+For a complete reference on unicode caracter codes look at: +

www.unicode.org/charts/
+

+""" + karamba.resizeWidget(widget, 400, 400) + + richtext = karamba.createRichText(widget, text) + + karamba.setRichTextWidth(widget, richtext, 370) + +# greek_heading = karamba.createText(widget, 0, 5, 100, 20, "Greek:") +# greek_small = karamba.createText(widget, 0, 25, 400, 15, u"\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9"); +# greek_big = karamba.createText(widget, 0, 40, 400, 15, u"\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9"); + +# hebrew_heading = karamba.createText(widget, 0, 60, 100, 20, "Hebrew:") +# hebrew = karamba.createText(widget, 0, 80, 400, 15, u"\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA"); + +# arabic_heading = karamba.createText(widget, 0, 100, 100, 20, "Arabic:") +# arabic = karamba.createText(widget, 0, 120, 400, 15, u"\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u064A"); + +# cyrillic_heading = karamba.createText(widget, 0, 140, 100, 20, "Cyrillic:") +# cyrillic_small = karamba.createText(widget, 0, 160, 400, 15, u"\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F") +# cyrillic_big = karamba.createText(widget, 0, 175, 400, 15, u"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F") + +# karamba.changeTextColor(widget, greek_heading, 0, 0, 0) +# karamba.changeTextColor(widget, greek_small, 0, 0, 0) +# karamba.changeTextColor(widget, greek_big, 0, 0, 0) +# karamba.changeTextColor(widget, hebrew_heading, 0, 0, 0) +# karamba.changeTextColor(widget, hebrew, 0, 0, 0) +# karamba.changeTextColor(widget, arabic_heading, 0, 0, 0) +# karamba.changeTextColor(widget, arabic, 0, 0, 0) +# karamba.changeTextColor(widget, cyrillic_heading, 0, 0, 0) +# karamba.changeTextColor(widget, cyrillic_small, 0, 0, 0) +# karamba.changeTextColor(widget, cyrillic_big, 0, 0, 0) + +# karamba.changeTextSize(widget, greek_heading, 12) +# karamba.changeTextSize(widget, hebrew_heading, 12) +# karamba.changeTextSize(widget, arabic_heading, 12) +# karamba.changeTextSize(widget, cyrillic_heading, 12) + + + +#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 + +def meterClicked(widget, meter, 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 will be printed when the widget loads. +print "Loaded Karamba Unicode Test" diff --git a/superkaramba/examples/unicode/unicode.theme b/superkaramba/examples/unicode/unicode.theme new file mode 100644 index 0000000..44cb1c8 --- /dev/null +++ b/superkaramba/examples/unicode/unicode.theme @@ -0,0 +1 @@ +KARAMBA X=80 Y=20 W=400 H=300 LOCKED=true INTERVAL=10000 -- cgit v1.2.1