[HOWTO] (Python Plasmoids – Part 1) Write Hello World Plasma Applet in Python

I am new to KDE and I have come to like the plasmoids on the Desktop. They can be used to display information (eg. Weather, Time, News) or can be used to carry out some tasks (upload images/text to web, check mail etc) easily.

I don’t have any experience of Plasmoid development. I have decided to learn to write Plasmoids. I have moderate knowledge of Python.. I am learning Plasmoid development in Python and will be posting my experience. Feel free to learn with me or correct me if I am wrong.

I will be using Fedora 14 with KDE 4.5 for all my development and testing. However, other distros with any sub-version of KDE 4 should work fine. I will be citing all the references and where you can learn more.

I will be using Kwrite and KDevelop to develop plasmoids. However, you can pick any editor of choice.

For Hello World plasmoid, create a directory called hello anywhere you want. Also, create the following directory structure inside hello:

├── contents
│   └── code

The directory structure must be as shown above. or the plasmoid will not work.

Now, we will need a metadata for the plasmoid. This metadata file will contain the name, version, author-name, type of plasmoids and other information about the plasmoid. It should be inside the plasmoid directory (i.e. inside hello in this case). Here is my sample of metadata.desktop.

[Desktop Entry]
Name=Hello World
Comment=A Basic Hello World Example


Most of the fields are self-explanatory and to learn about the fields and other choices, see here.

As we have specified in X-Plasma-MainScript field in metadata.desktop, we will now create the file hello/contents/code/main.py. Note that you can use any filename for main.py but you will have to change in metadata.desktop accordingly.

The following is the very basic main.py which does absolutely nothing:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript
class MainApplet(plasmascript.Applet):
    def __init__(self,parent,args=None):
def CreateApplet(parent):
    return MainApplet(parent)

If the above plasmoid is run, you will see no output at all, just an empty plasmoid.
To run it, cd to the directory where you created the hello directory and run the following:

plasmoidviewer hello

If everything goes right, you will be able to see something like the following:

If any error occurs, you can see the output in the terminal to see whats wrong and hopefully fix it.

After running the application, lets analyse what we have done here.

Line 1-4 are import statements. If you are familiar with Python, you must be familiar with them. They are basically statements which tells the interpretor where to look for the functions and classes used in the program. Those are the minimum ones you will need for your Python plasmoids to work.

Lines 6-8 define a class derived from plasmascript.Applet. There must be at least one such class for your plasmoid to work. The name of the class may be anything you like. The class’ __init__ function initializes just the same function of base class which is to say it does nothing at all. While developing plasmoids later, you may want to do some stuff even prior to initialization of plasmoid. That stuff goes in this function.

There must be yet another function Createapplet() which must take 1 argument “parent” and pass it as initializer for the object of class derived from plasmascript.Applet and return the object. This function is in lines 10-11.

We have returned the Applet object as it is without modifications. We will now add some stuff to the Applet object before returning. In this tutorial, we will just add a label saying “Hello World”. To add a label however, we need to have a layout. So,we set a layout and then add a label on top of it.
To do that, we will be using init() method which is called after the applet is initialized and added. Here is the new code for main.py:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript

class MainApplet(plasmascript.Applet):
    def __init__(self,parent,args=None):
    def init(self):
        layout=QGraphicsLinearLayout(Qt.Vertical, self.applet)
        label = Plasma.Label(self.applet)
        label.setText("Hello World")
def CreateApplet(parent):
    return MainApplet(parent)

The added code is the init() from line 10-15. First, a variable layout is set as QGraphicsLinearLayout(). This takes two arguments, one is the parent and the other is either Qt.Vertical or Qt.Horizontal. This layout orientation parameter decides whether the added items (if there are more than one) are arranged vertically or horizontally.

In line 12, a new Plasma.Label object is created. It takes in parent as the constructor argument. Other plasma widgets are available here. There is no Python specific documents as of now but the C++ documents work fine and it is easy to figure out how to use it in Python.

In line 13, we use a method setText() of Plasma.Label to set the text of the label and in the next line, we add the item to the layout we created earlier. Finally, in line 15 we set the layout we created as the label for the current applet.

When done testing, you may want to install the plasmoid to see how it looks on the desktop. To do that, you must zip it install it using plasmapkg. Change to hello/ directory and run the following to zip it to hello.zip:

zip -r ../hello.zip ./

Now, run the following to install it:

plasmapkg -i hello.zip

Now, you can add the plasmoid to your desktop. To remove it, just run:

plasmapkg -r hello

Here is what we have at the end:


This is a simple tutorial from a newbie to create Plasmoids in Python. However, we did not do any useful work with it. In the next tutorial, I will try to cover my experience creating something useful.



[HOWTO] Install Firefox 4 in Fedora 14

Firefox 4 is currently in beta and not available in the Fedora repository. However, it can be installed by adding Spot repository from FedoraPeople. To install, open up the terminal and run the following from terminal as root (to be root, run su and enter root password):

wget http://repos.fedorapeople.org/repos/spot/firefox4/fedora-firefox4.repo -O /etc/yum.repos.d/firefox4.repo
yum install firefox4

When done, Firefox 4 is ready to use.

[HOWTO] Install VirtualBox 4.0 Final in Fedora

To install VirtualBox 4.0 in Fedora, first make sure you have removed old version of virtualbox and then open the terminal and type in su and enter password to login as root and type the following commands:

wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo --output-document=/etc/repos.d/virtualbox.repo
yum update
yum install VirtualBox-4.0

VirtualBox will be installed and ready to use.

Hope this helps.

[HOWTO] Increase your ibibo TeenPatti Cash by stealing/hacking from others

Ibibo Teen patti is a widely played online card game. It is flash game available as Facebook application. It can also be played directly from ibibo.com.

Me and my friends have found a vulnerability which allows stealing from any player online. In this post, I will describe how to steal ibibo cash from Facebook users only. Stealing from ibibo.com players is also basically same, however in this post I will focus on stealing from Facebook users only. Read along for how to.

Disclaimer: Using the information in this page to steal ibibo cash from others may not be compliant with ibibo’s terms of service. This article is for educational purposes only. The author will not be responsible for anything you do with the information in this page.
Note: This hack works perfectly at the time of writing this. However, it may be fixed in the later version of ibibo Teen Patti.


Firefox with Firebug addon.
Note to Firefox 4 users: As of now, stable version of Firebug is not compatible with Firefox 4. Please see Howto install Firebug in Firefox 4.

Other Requirements

You need at least 3 players to play. You can login as 3 users yourself in the same computer (using multiple browsers or multiple browser profiles) or you can use help from 1 or two friends, but do note that you need a total of 3 accounts logged into Facebook at the same time. You also need a link to Facebook profile page (only the profile page URL, eg: http://www.facebook.com/user.name, not the login credentials) of a user who has a lot of ibibo cash. It can be your friends or anyone who has a lot of cash. Lets call the three users A, B and U (you) and the victim (whose cash you want to steal) as V for simplicity. It is also better to have the friends online (preferably voice chatting) or in the same room so that you can discuss your moves.


This will not work properly if V is playing ibibo at the same time. Try to make sure that V is not online (if possible). Otherwise the process will most likely be interrupted.
Also, note that in this tutorial, U will be making your friends A and B rich with V’s money. Later you can switch roles and ask them to follow this tutorial to make U rich.


Login to Facebook and connect to ibibo Teen Patti application. Make sure A, B and U are in the same server. Choose a room with the least number of people with lots of empty tables and join the same room. Don’t join any tables yet.

Getting access to V’s money

The idea here is that U get access to V’s money, play with your friends B and C and make them win.
Step 1:
To do that, you will need to open V’s Facebook Profile Page. In the profile page, Click on View>Page Source (or press Ctrl+U) and search for “user:” (without quotes) and you will find something like this:


Copy the number next to “user:” (9999999999 in the above example) and close the profile page.
Step 2:
Go to the page where you have opened Teen Patti Facebook Application and click on the Firebug icon (in the status bar of Firefox), and then the Firebug window will come up. Click on the arrow on top (inspect) and then click on the playing area of ibibo teenpatti. In the Firebug window, you should be able to see username= field. Edit it to replace it with V’s profile ID (eg. 9999999999) you copied earlier. Then, find ../TeenPatti/TeenPattiLoaderX-Y.swf in the same embed code. Add a questionmark at the end of the swf followed by anything you like (so that it looks like ../TeenPatti/TeenPattiLoader1-0.swf?anything_you_like or just ../TeenPatti/TeenPattiLoader1-0.swf?) and press enter.

If you are confused, watch this video to see this step in action.

Once you have done this, the game will reload. After reload, you will be logged in to the application as the victim V and have access to V’s money.

Play and Lose

Now, join an empty room and start a game. Increase the bid as much as you can and always pack or go “Back to Lobby”. Give away as much money as A and B want.

Additional Tips

# Communicate all along the process so that everything goes good.
# Join new empty room each time so that you can skip the 15 seconds wait.
# Ask your friends to play blind and double each time they play, and U double too, so that V loses more than s/he normally would.
# If your friends A for example, runs out of money, U and B simply click “Back to Lobby” and A will still win.
# Watch out for intruders. If there is someone else in the room already, don’t join.

When A and B are done, Suggest A or B to follow the same thing as U did so that you can win next time.

Best of Luck.

Special Thanks To

fr3ak, [A]bu

[SOLVED] “Process exited with status 0” in kdevelop

I have recently installed KDevelop and was looking for a good editor for programming. I found KDevelop was mentioned in many discussions. So, I decided to give it a try. However, when I ran it, I got the following error:

Process error – KDevelop
Process exited with status 0

However, it did not seem to affect the functionality after closing the dialog, it was quite annoying. I ran it from the terminal and looked for possible error messages, however, I could not find anything.
Later, I noticed that the error had magically stopped showing any more. I had installed a few packages after that and I thought that might have solved the problem. After a few hit and trials (of removing the recently installed packages), I found that removing the “git” package brought the error back again.

So, if you are running into similar problems, just install the package git. However, if you do not intend to use git and refuse to install it, you can also disable the plugin by navigating to Settings>Configure KDevelop>Plugins and removing the check mark next to “Git Support”.

[HOWTO] Install Oxygen-transparent and make your KDE Desktop look awesome in Fedora 14

Oxygen-transparent is a modification of KDE Oxygen-style to add cool transparency. It was supposed to be merged to KDE 4.6, but the idea has been dropped due to issues with the theme. However, it can be installed in KDE 4.5 and 4.6 currently. I am using KDE 4.5 in Fedora 14 and here is how I got it installed.

However, before installing, do note what the developer has to say:
– this will erase your current oxygen installation;
– this will likely be erased by any future update of oxygen by your distribution packages;
– again, this is experimental

Having said that, lets continue.

Installing Build Dependencies
Run the following command as root to install build dependencies. To run as root, type “su” followed by your password and then enter the following.

yum install kdebase-workspace-devel kdelibs-devel subversion libXrender-devel libX11-devel gcc-c++ cmake gcc wget

Getting The Helper Script
To make the installation easy developer HugoPereira has written a script available at KDE-Look.org. Download and save the script to an empty directory and make it executable.

To download the currently available version of the script, you can run the following commands:

mkdir /tmp/oxygen-transparent
cd /tmp/oxygen-transparent
wget http://kde-look.org/CONTENT/content-files/127752-oxygen-setup.pl --output-document=oxygen-setup.pl
chmod +x oxygen-setup.pl

Running The Helper Script
You can run the helper script (as root or any normal user) by typing in the following:


The script will download the latest sources from svn, then runs cmake and compiles the code locally.

If the compilation is successful, you should get a mesage:

— done

type “cd build; make install” (as root, or using sudo) to install.
report problems to “hugo[at-the-rate]oxygen-icons.org”.

Run the following as root and the new theme should be installed:

cd build; make install

That should install the modified oxygen theme.

Log out and log back in to see the changes in effect. Also, after logging back in, you can configure the theme by running oxygen-settings (Alt+F2 and type in oxygen-settings). Open up “System Settings”> “Application Appearance” and press “Configure” to adjust transparency values.

Hope this helps.

[SOLVED] CMake Error: your CXX compiler: “CMAKE_CXX_COMPILER-NOTFOUND” was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

I am running Fedora KDE Spin. I was trying to compile a program. I tried running cmake but I got the following error:

CMake Error: your CXX compiler: “CMAKE_CXX_COMPILER-NOTFOUND” was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

I already had gcc and cpp packages installed but I was still getting the above error.

I later figured that the package gcc-c++ was not installed. I installed it via yum and the error was gone:

yum install gcc-c++

Hope this helps.

[HOWTO] Move controls (maximize, minimize, close) to the left in KDE 4

I have used Ubuntu Lucid since its early alpha stages to the final and then continued using it until lately. I am used to having title bar control buttons (i.e. maximize, minimize, close) on the left side of the window. I recently moved to Fedora 14 KDE Edition and was having problems with the control buttons. So, I moved them to the left. Here is how it is done.

Right click on the title bar and select “Configure Window Behaviour”.

Click on “Window Decorations” in the left pane.

Click on “Configure Buttons” and you should see your current title structure. Drag around to get the following configuration.

Hope this helps.

[HOWTO] Enable MP3/AVI/MPEG/FLV and other audio/video formats playable in Fedora 14

I just installed Fedora 14 KDE Spin and like many other Linux distros, it does not play MP3, MPEG and several other formats by default. To enable playback of these proprietary formats, you must install non-free codecs. To get those, I installed the Livna and RPM Fusion repos by clicking the following links and opening each with KPackageKit:
RPM Fusion Free
RPM Fusion Non-Free

Wait for them to be installed and when done search KPackageKit for SMplayer and VLC. For audio playback, you can install a great KDE Audio Player known as Amarok. You can play almost any format with VLC but you might want to keep another player handy for playback. To enable almost any media support for Amarok and SMplayer, you must install gstreamer-plugins-bad and gstreamer-plugins-ugly and xine-lib-extras-freeworld.

Hope this helps.

[SOLVED] Could not create a python ScriptEngine for the [name-of-plasmoid] widget

I recently installed Fedora 14 KDE Live Spin and am trying to get my hands into plasmoid development. I picked python as a language of choice but was getting the following error while trying to run plasmoids:

The object could not be created for the following reason:
Could not create a python ScriptEngine for the [name-of-plasmoid] widget.

I checked if PyQT4, PyKDE4 and kdebase-workspace-python-applet were installed and they were but I was still getting the errors. I had almost given up but then I realized that I had just upgraded a lot of packages. So, I just rebooted and I was able to add plasmoids without problems.
If you are getting this error, you must check if you can run the plasmoid with plasmoidviewer from the terminal and check for errors in the terminal.
Hope this helps.