superkaramba
config.cpp File Reference
#include <Python.h>
#include <QObject>
#include <kconfig.h>
#include "meters/meter.h"
#include "python/meter.h"
#include "python/config.h"
#include <kconfiggroup.h>
#include "../karamba.h"

Go to the source code of this file.
Functions | |
| long | addMenuConfigOption (long widget, QString key, QString name) |
| PyObject * | py_add_menu_config_option (PyObject *, PyObject *args) |
| long | setMenuConfigOption (long widget, QString key, bool value) |
| PyObject * | py_set_menu_config_option (PyObject *, PyObject *args) |
| long | readMenuConfigOption (long widget, QString key) |
| PyObject * | py_read_menu_config_option (PyObject *, PyObject *args) |
| long | writeConfigEntry (long widget, QString key, QString value) |
| PyObject * | py_write_config_entry (PyObject *, PyObject *args) |
| QString | readConfigEntry (long widget, QString key) |
| PyObject * | py_read_config_entry (PyObject *, PyObject *args) |
Function Documentation
Definition at line 45 of file config.cpp.
Config/addMenuConfigOption.
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 entries 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
Definition at line 54 of file config.cpp.
Config/readConfigEntry.
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
Definition at line 154 of file config.cpp.
Config/readMenuConfigOption.
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.
Definition at line 103 of file config.cpp.
Config/setMenuConfigOption.
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
Definition at line 79 of file config.cpp.
Config/writeConfigEntry.
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
Definition at line 129 of file config.cpp.
Definition at line 147 of file config.cpp.
| long readMenuConfigOption | ( | long | widget, | |
| QString | key | |||
| ) |
Definition at line 96 of file config.cpp.
| long setMenuConfigOption | ( | long | widget, | |
| QString | key, | |||
| bool | value | |||
| ) |
Definition at line 72 of file config.cpp.
Definition at line 120 of file config.cpp.
KDE 4.0 API Reference