• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

superkaramba

  • sources
  • kde-4.12
  • kdeutils
  • superkaramba
  • src
  • python
Functions
misc.cpp File Reference
#include "python/misc.h"
#include <Python.h>
#include <QObject>
#include <QList>
#include <kglobal.h>
#include <klocale.h>
#include <kservice.h>
#include <krun.h>
#include <kdebug.h>
#include "meters/meter.h"
#include "meters/imagelabel.h"
#include "meters/textlabel.h"
#include "meters/clickarea.h"
#include "python/meter.h"
#include "showdesktop.h"
#include "karambaapp.h"
#include "themefile.h"
#include "themelocale.h"
#include "../karamba.h"
#include "../systemtray.h"
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
Include dependency graph for misc.cpp:

Go to the source code of this file.

Functions

long acceptDrops (long widget)
 
long attachClickArea (long widget, long meter, QString LeftButton, QString MiddleButton, QString RightButton)
 
static long callTheme (long widget, char *path, char *str)
 
static void changeInterval (long widget, long interval)
 
long createClickArea (long widget, long x, long y, long w, long h, char *text)
 
long createServiceClickArea (long widget, long x, long y, long w, long h, char *name, char *exec, char *icon)
 
static QString getIncomingData (long widget)
 
QString getIp (char *device_name)
 
int getNumberOfDesktops (long widget)
 
const char * getPrettyName (long widget)
 
const char * getThemePath (long widget)
 
int hide (long widget)
 
static void management_popup (long widget)
 
long openNamedTheme (char *path, char *name, bool is_sub_theme)
 
long openTheme (char *path)
 
PyObject * py_accept_drops (PyObject *, PyObject *args)
 
PyObject * py_attach_clickArea (PyObject *, PyObject *args, PyObject *dict)
 
PyObject * py_call_theme (PyObject *, PyObject *args)
 
PyObject * py_change_interval (PyObject *, PyObject *args)
 
PyObject * py_create_click_area (PyObject *, PyObject *args)
 
PyObject * py_create_service_click_area (PyObject *, PyObject *args)
 
PyObject * py_execute_command (PyObject *, PyObject *args)
 
PyObject * py_execute_command_interactive (PyObject *, PyObject *args)
 
PyObject * py_get_incoming_data (PyObject *, PyObject *args)
 
PyObject * py_get_ip (PyObject *, PyObject *args)
 
PyObject * py_get_number_of_desktops (PyObject *, PyObject *args)
 
PyObject * py_get_pretty_name (PyObject *, PyObject *args)
 
PyObject * py_get_theme_path (PyObject *, PyObject *args)
 
PyObject * py_get_update_time (PyObject *, PyObject *args)
 
PyObject * py_hide (PyObject *, PyObject *args)
 
PyObject * py_language (PyObject *, PyObject *args)
 
PyObject * py_management_popup (PyObject *, PyObject *args)
 
PyObject * py_open_named_theme (PyObject *, PyObject *args)
 
PyObject * py_open_theme (PyObject *, PyObject *args)
 
PyObject * py_read_theme_file (PyObject *, PyObject *args)
 
PyObject * py_reload_theme (PyObject *, PyObject *args)
 
PyObject * py_remove_click_area (PyObject *, PyObject *args)
 
PyObject * py_run_command (PyObject *, PyObject *args)
 
PyObject * py_set_incoming_data (PyObject *, PyObject *args)
 
PyObject * py_set_update_time (PyObject *, PyObject *args)
 
PyObject * py_show (PyObject *, PyObject *args)
 
PyObject * py_toggle_show_desktop (PyObject *, PyObject *args)
 
PyObject * py_translate_all (PyObject *, PyObject *args)
 
PyObject * py_userLanguage (PyObject *, PyObject *args)
 
PyObject * py_userLanguages (PyObject *, PyObject *args)
 
PyObject * py_want_right_button (PyObject *, PyObject *args)
 
long removeClickArea (long widget, long click)
 
static void set_want_right_button (long widget, long yesno)
 
static long setIncomingData (long widget, char *path, char *obj)
 
int show (long widget)
 
long toggleShowDesktop (long)
 
int translateAll (long widget, int x, int y)
 

Function Documentation

long acceptDrops ( long  widget)

Definition at line 58 of file misc.cpp.

long attachClickArea ( long  widget,
long  meter,
QString  LeftButton,
QString  MiddleButton,
QString  RightButton 
)

Definition at line 175 of file misc.cpp.

static long callTheme ( long  widget,
char *  path,
char *  str 
)
static

Definition at line 412 of file misc.cpp.

static void changeInterval ( long  widget,
long  interval 
)
static

Definition at line 799 of file misc.cpp.

long createClickArea ( long  widget,
long  x,
long  y,
long  w,
long  h,
char *  text 
)

Definition at line 367 of file misc.cpp.

long createServiceClickArea ( long  widget,
long  x,
long  y,
long  w,
long  h,
char *  name,
char *  exec,
char *  icon 
)

Definition at line 350 of file misc.cpp.

static QString getIncomingData ( long  widget)
static

Definition at line 431 of file misc.cpp.

QString getIp ( char *  device_name)

Definition at line 651 of file misc.cpp.

int getNumberOfDesktops ( long  widget)

Definition at line 546 of file misc.cpp.

const char* getPrettyName ( long  widget)

Definition at line 251 of file misc.cpp.

const char* getThemePath ( long  widget)

Definition at line 267 of file misc.cpp.

int hide ( long  widget)

Definition at line 618 of file misc.cpp.

static void management_popup ( long  widget)
static

Definition at line 764 of file misc.cpp.

long openNamedTheme ( char *  path,
char *  name,
bool  is_sub_theme 
)

Definition at line 447 of file misc.cpp.

long openTheme ( char *  path)

Definition at line 470 of file misc.cpp.

PyObject* py_accept_drops ( PyObject *  self,
PyObject *  args 
)

Misc/acceptDrops.

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

Definition at line 67 of file misc.cpp.

PyObject* py_attach_clickArea ( PyObject *  self,
PyObject *  args,
PyObject *  dict 
)

Misc/attachClickArea.

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

Definition at line 198 of file misc.cpp.

PyObject* py_call_theme ( PyObject *  self,
PyObject *  args 
)

Misc/callTheme.

SYNOPSIS long callTheme(widget, theme, info) DESCRIPTION Calls a theme - identified by the pretty name - and passes it a string. This will work, despite superkaramba being multithreaded, because it uses the DCOP interface to contact the other theme. If you need to pass complex arguments (dictionaries, lists etc.) then use the python "repr" and "eval" functions to marshall and unmarshall the data structure. ARGUMENTS

  • long widget – karamba
  • string theme – path to theme to be called
  • string info – a string containing the info to be passed to the theme RETURN VALUE 1 if successful

Definition at line 506 of file misc.cpp.

PyObject* py_change_interval ( PyObject *  self,
PyObject *  args 
)

Misc/changeInterval.

SYNOPSIS long changeInterval(widget, interval) DESCRIPTION Calling this changes your widget's refresh rate (ms) ARGUMENTS

  • long widget – karamba
  • int interval – interval, in ms RETURN VALUE 1 if successful

Definition at line 805 of file misc.cpp.

PyObject* py_create_click_area ( PyObject *  self,
PyObject *  args 
)

Misc/createClickArea.

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 a handle to the click area

Definition at line 400 of file misc.cpp.

PyObject* py_create_service_click_area ( PyObject *  self,
PyObject *  args 
)

Misc/createServiceClickArea.

SYNOPSIS long createServiceClickArea(widget, x, y, w, h, name_of_command, cmd_to_run, icon_to_display) 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. For more information on the difference between createClickArea and createServiceClickArea, see the KDE documentation about KService, and the difference between KRun::run and KRun::runCommand. ARGUMENTS

  • long widget – karamba
  • long x – x coordinate
  • long y – y coordinate
  • long w – width
  • long h – height
  • string name_of_command – name to be displayed
  • string cmd_to_run – command to be run
  • string icon_to_display – name of icon to be displayed RETURN VALUE a handle to the click area

Definition at line 388 of file misc.cpp.

PyObject* py_execute_command ( PyObject *  self,
PyObject *  args 
)

Misc/execute.

SYNOPSIS long execute(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

  • string command – command to execute RETURN VALUE 1 if successful

Definition at line 108 of file misc.cpp.

PyObject* py_execute_command_interactive ( PyObject *  self,
PyObject *  args 
)

Misc/executeInteractive.

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 separate 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
  • list command – command to execute RETURN VALUE 1 if successful

Definition at line 118 of file misc.cpp.

PyObject* py_get_incoming_data ( PyObject *  self,
PyObject *  args 
)

Misc/getIncomingData.

SYNOPSIS long getIncomingData(widget) DESCRIPTION Obtains the last data received by any other theme that set the "incoming data" of this theme. This isn't particularly sophisticated and could benefit from the data being placed in an FIFO queue instead. ARGUMENTS

  • long widget – karamba RETURN VALUE string containing last information received from setIncomingData

Definition at line 488 of file misc.cpp.

PyObject* py_get_ip ( PyObject *  self,
PyObject *  args 
)

Misc/getIp.

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

Definition at line 753 of file misc.cpp.

PyObject* py_get_number_of_desktops ( PyObject *  self,
PyObject *  args 
)

Misc/getNumberOfDesktop.

SYNOPSIS long getNumberOfDesktop(widget) DESCRIPTION Returns number fo desktops ARGUMENTS

  • long widget – karamba RETURN VALUE number of desktops

Definition at line 553 of file misc.cpp.

PyObject* py_get_pretty_name ( PyObject *  self,
PyObject *  args 
)

Misc/getPrettyName.

SYNOPSIS string getPrettyName(theme) DESCRIPTION When a theme is created (with openNamedTheme), there is an option to give the theme an alternative name. This is useful if you open several widgets from the same theme: you need to give them unique names in order to contact them (for example, with callTheme or with setIncomingData) ARGUMENTS

  • string theme – path to new theme RETURN VALUE the pretty name of the theme

Definition at line 258 of file misc.cpp.

PyObject* py_get_theme_path ( PyObject *  self,
PyObject *  args 
)

Misc/getThemePath.

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

Definition at line 273 of file misc.cpp.

PyObject* py_get_update_time ( PyObject *  self,
PyObject *  args 
)

Misc/getUpdateTime.

SYNOPSIS long getUpdateTime(widget) DESCRIPTION returns the last stored update time. intended for use so that the next refresh interval can work out how long ago the mouse was last moved over the widget. ARGUMENTS

  • long widget – karamba RETURN VALUE last stored update time (from setUpdateTime)

Definition at line 743 of file misc.cpp.

PyObject* py_hide ( PyObject *  self,
PyObject *  args 
)

Misc/hide.

SYNOPSIS string hide(widget) DESCRIPTION hide theme ARGUMENTS

  • long widget – karamba RETURN VALUE 1 if successful

Definition at line 625 of file misc.cpp.

PyObject* py_language ( PyObject *  self,
PyObject *  args 
)

Misc/language.

SYNOPSIS string language(widget) DESCRIPTION Returns a string containing default language of a translation file. ARGUMENTS

  • long widget – karamba RETURN VALUE default language or empty string if no translation files found.

Definition at line 283 of file misc.cpp.

PyObject* py_management_popup ( PyObject *  self,
PyObject *  args 
)

Misc/managementPopup.

SYNOPSIS long managementPopup(widget) DESCRIPTION There's a management menu for SuperKaramba themes which allows themes to be loaded, closed, moved to other screens. If you want this popup menu to appear, call this function. ARGUMENTS

  • long widget – karamba RETURN VALUE 1 if successful

Definition at line 770 of file misc.cpp.

PyObject* py_open_named_theme ( PyObject *  self,
PyObject *  args 
)

Misc/openNamedTheme.

SYNOPSIS long openNamedTheme(theme, pretty_name, is_sub_theme) DESCRIPTION Opens a new theme, giving it a pretty (alternative and by your own choice unique) name. If you do not want the theme to be loaded when superkaramba is first started up (but instead want it to only be opened by this function call) then set is_sub_theme to 1. Themes opened with openNamedTheme will be unique. If a theme with the same pretty name already exists, openNamedTheme will have no effect. If you want duplicate themes (and a bit of a mess), use openTheme, instead. ARGUMENTS

  • string theme – path to new theme
  • string pretty_name – the name to be associated with the new widget
  • long is_sub_theme – sets persistence (save state) of the theme RETURN VALUE a handle to the widget created

Definition at line 516 of file misc.cpp.

PyObject* py_open_theme ( PyObject *  self,
PyObject *  args 
)

Misc/openTheme.

SYNOPSIS long openTheme(theme) DESCRIPTION Opens new theme. ARGUMENTS

  • string theme – path to new theme RETURN VALUE 1 if successful

Definition at line 526 of file misc.cpp.

PyObject* py_read_theme_file ( PyObject *  self,
PyObject *  args 
)

Misc/readThemeFile.

SYNOPSIS string readThemeFile(widget, file) DESCRIPTION Returns a string containing the file ARGUMENTS

  • long widget – karamba
  • string file – name of the file to read RETURN VALUE file contents

Definition at line 325 of file misc.cpp.

PyObject* py_reload_theme ( PyObject *  self,
PyObject *  args 
)

Misc/reloadTheme.

SYNOPSIS long reloadTheme(theme) DESCRIPTION Reloads current theme. ARGUMENTS

  • long widget – karamba RETURN VALUE a handle to the widget created

Definition at line 534 of file misc.cpp.

PyObject* py_remove_click_area ( PyObject *  self,
PyObject *  args 
)

Misc/removeClickArea.

SYNOPSIS long removeClickArea(widget, clickarea) DESCRIPTION This function deletes a clickable area. ARGUMENTS

  • long widget – karamba
  • long clickarea – handle to the click area RETURN VALUE 1 if successful

Definition at line 380 of file misc.cpp.

PyObject* py_run_command ( PyObject *  self,
PyObject *  args 
)

Misc/run.

SYNOPSIS long run(name, command, icon, list_of_args) DESCRIPTION This command simply executes a program or command on the system. The difference between run and execute is that run takes arguments, and the name of the icon to be displayed. ARGUMENTS

  • string name – name to be displayed
  • string command – command to execute
  • string icon – name of icon to be displayed
  • string list_of_args – arguments to be passed to the command RETURN VALUE 1 if successful

Definition at line 79 of file misc.cpp.

PyObject* py_set_incoming_data ( PyObject *  self,
PyObject *  args 
)

Misc/setIncomingData.

SYNOPSIS long setIncomingData(widget, theme, info) DESCRIPTION Contacts a theme - identified by the pretty name - and stores a string to be associated with the remote theme. The difference between setIncomingData and callTheme is that the theme is not notified by setIncomingData that the data has arrived. Previous information, if any, is overwritten. Use getIncomingData to retrieve the last stored information. setIncomingData is not very sophisticated, and could benefit from having info passed to it put into a queue, instead of being overwritten. ARGUMENTS

  • long widget – karamba
  • string theme – path to theme to have information passed to it.
  • string info – a string containing the info to be passed to the theme RETURN VALUE 1 if successful

Definition at line 496 of file misc.cpp.

PyObject* py_set_update_time ( PyObject *  self,
PyObject *  args 
)

Misc/setUpdateTime.

SYNOPSIS long getUpdateTime(widget, updated_time) DESCRIPTION returns the last stored update time. intended for use so that the next refresh interval can work out how long ago the mouse was last moved over the widget. ARGUMENTS

  • long widget – karamba
  • long updated_time – the update time to be associated with the widget RETURN VALUE 1 if successful

Definition at line 732 of file misc.cpp.

PyObject* py_show ( PyObject *  self,
PyObject *  args 
)

Misc/show.

SYNOPSIS string show(widget) DESCRIPTION show theme ARGUMENTS

  • long widget – karamba RETURN VALUE 1 if successful

Definition at line 607 of file misc.cpp.

PyObject* py_toggle_show_desktop ( PyObject *  self,
PyObject *  args 
)

Misc/toggleShowDesktop.

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

Definition at line 240 of file misc.cpp.

PyObject* py_translate_all ( PyObject *  self,
PyObject *  args 
)

Misc/translateAll.

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

Definition at line 588 of file misc.cpp.

PyObject* py_userLanguage ( PyObject *  self,
PyObject *  args 
)

Misc/language.

SYNOPSIS string userLanguage(widget) DESCRIPTION Returns a string containing the global KDE user language. ARGUMENTS

  • long widget – karamba RETURN VALUE user language or empty string.

Definition at line 294 of file misc.cpp.

PyObject* py_userLanguages ( PyObject *  self,
PyObject *  args 
)

Misc/userLanguages.

SYNOPSIS string userLanguages(widget) DESCRIPTION Returns a list (array) containing the language name abbreviations for the preferred interface languages user chose for KDE session in Region & Language settings. Having the whole array of preferred languages available is important for cases when you cannot provide interface translation for the 1st preferred language, but can for consecutive languages. (Implemented in version 0.42.) ARGUMENTS

  • long widget – karamba RETURN VALUE list (array) with user languages in the order of preference.

Definition at line 304 of file misc.cpp.

PyObject* py_want_right_button ( PyObject *  self,
PyObject *  args 
)

Misc/wantRightButton.

SYNOPSIS long wantRightButton(widget, want_receive_right_button) DESCRIPTION There's a management menu for SuperKaramba themes which allows themes to be loaded, closed, moved to other screens. Not all themes will want this management interface. call karamba.wantRightButton(widget, 1) if you want to receive MouseUpdate button notifications. ARGUMENTS

  • long widget – karamba
  • long want_receive_right_button – whether the widget will receive right clicks RETURN VALUE 1 if successful

Definition at line 787 of file misc.cpp.

long removeClickArea ( long  widget,
long  click 
)

Definition at line 339 of file misc.cpp.

static void set_want_right_button ( long  widget,
long  yesno 
)
static

Definition at line 781 of file misc.cpp.

static long setIncomingData ( long  widget,
char *  path,
char *  obj 
)
static

Definition at line 422 of file misc.cpp.

int show ( long  widget)

Definition at line 600 of file misc.cpp.

long toggleShowDesktop ( long  )

Definition at line 233 of file misc.cpp.

int translateAll ( long  widget,
int  x,
int  y 
)

Definition at line 564 of file misc.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal