Question about dcop bindings in python.

Shaggy Wolf shaggy.wolf.2006 at gmail.com
Fri Aug 8 22:20:10 BST 2008


On Fri, Aug 8, 2008 at 2:28 PM, Steven W. Orr <steveo at syslang.net> wrote:

> I've looked but I didn't see anything that was useful. I wrote a shell
> script that uses dcop to run the 3ddesk program:
>
> #! /bin/bash
>
> typeset -i desktop="$1"
> [[ -z "$desktop" ]] && exit 0
> # Get current desktop
> curr_desk=$(dcop kwin KWinInterface currentDesktop)
> if [[ $curr_desk == $desktop ]]
> then
>     dcop kwin KWinInterface refresh
> else
>     exec 3ddesk --gotocolumn=$desktop
> fi
>
> I want to write this in python and I'm sort of stuck. Can someone please
> tell me how to get the equiv of this line of shell into python?
>
> dcop kwin KWinInterface currentDesktop
>
> I got as far as
>
> #! /usr/bin/python
> import pcop
> import pydcop
>
> and after that I'm verstumpfed.
>
> Also, I ran kdcop to see the tree but when I select python mode I don't
> see that it actuallty does anything. Is it suppoed to tell me what to do
> in python or does it not work yet?
>
> TIA
>
> --
> Time flies like the wind. Fruit flies like a banana. Stranger things have
>  .0.
> happened but none stranger than this. Does your driver's license say Organ
> ..0
> Donor?Black holes are where God divided by zero. Listen to me! We are all-
> 000
> individuals! What if this weren't a hypothetical question?
> steveo at syslang.net
> ___________________________________________________
> This message is from the kde mailing list.
> Account management:  https://mail.kde.org/mailman/listinfo/kde.
> Archives: http://lists.kde.org/.
> More info: http://www.kde.org/faq.html.
>

Hi,
You could use something like this:

#!/usr/bin/env python
from pydcop import *

#This will create a pointer (as it were) to the dcop object
desktop = DCOPApplication("kwin")

#You can then perform all the actions that you can on the command line
currentDesktop = desktop.KWinInterface.currentDesktop()

HTH,
Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde/attachments/20080808/e65e8e45/attachment.htm>
-------------- next part --------------
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.


More information about the kde mailing list