PySide: QTreeListWidget deleting an Item, editing an Item

This example creates a QTreeListWidget to display a folder-structure.

import sys, os
from PySide.QtCore import *
from PySide.QtGui import *

class TreeTest(QTreeWidget):
    def __init__(self, parent = None):
        super(TreeTest, self).__init__(parent)
        actionEdit = QAction("New Folder", self)
        actionDelete = QAction("Delete", self)
    def addItem(self, name, parent):
        item = QTreeWidgetItem(parent)
        item.setText(0, name)
        #It is important to set the Flag Qt.ItemIsEditable
        item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled | Qt.ItemIsEditable)

        return item
    def addItemAction(self):
        parent = self.currentItem()
        if parent is None:
            parent = self.invisibleRootItem()
        new_item = self.addItem("New Folder", parent)
    def deleteItem(self):
        root = self.invisibleRootItem()
        for item in self.selectedItems():
            (item.parent() or root).removeChild(item)
if __name__ == '__main__':
    app = QApplication(sys.argv)
    test = QWidget()
    treeWidget = TreeTest()
    layout = QHBoxLayout()
    treeWidget.addItem("top", treeWidget.invisibleRootItem())
    item = treeWidget.addItem("item", treeWidget.invisibleRootItem())
    treeWidget.addItem("subitem", item)

PySide: Using standard system Icons

You can add Icons to many types of QWidgets. PySide provides you with a method to access the native system icons.
A complete list of icons can be found here: PySide.QtGui.PySide.QtGui.QStyle.StandardPixmap

To apply the QIcon you need to

btn = QPushButton("Folder")
style =
icon = style.standardIcon(QStyle.SP_DirIcon)
#or short:

Here a small example:

import sys
from PySide.QtCore import *
from PySide.QtGui import *

class Widget(QWidget):
    def __init__(self, parent= None):
        super(Widget, self).__init__()
        btn_folder = QPushButton("Folder")
        btn_one = QPushButton("Play")
        btn_two = QPushButton("Stop")
        btn_three = QPushButton("Pause")
        layout = QHBoxLayout()
if __name__ == '__main__':
    app = QApplication(sys.argv)
    dialog = Widget()


WordPress: (Part 3) Plugins

In this last part, i will give a short overview of WordPress Plugins and some General tips.


WordPress has the possibility to be extended with several Plugins to enhance the experience.

Default Plugins

Hello Dolly!

This is a Plugin to simply delete and make you comfortable installing and removing Plugins


Is an important plugin that prevents people spamming on your posts & pages. You have to register to fully use the plugin (free)

My Recommended Plugins:

Jetpack by

Jetpack is a collection of tools that are installed by default on It adds basic functionality like statistics, as well as social network features, latex integration, advanced galleries etc.

Plugin Site:

Link Indication by Michael Wöhrer

Adds small icons at the end of links to indicate the type of file.

Plugin site:

SyntaxHighlighter Evolved by Viper007Bond

Adds the possibility to display source code in WordPress

Plugin site:

wp-jquery-lightbox by Ulf Benjaminsson

Adds a neat box when displaying a single image

Plugin site:

General Tips

About Page

Create and maintain your about page, it is one of the most commonly visited sites on a blog.


When logging into WordPress admin area it always notifies you if new security patches are out for WordPress. Always check first if your theme and plugins work with that new version, then make a backup and then update WordPress.

Google Stuff

Google provides many different tools for WordPress. However for everything there are also alternatives (well search google you’ll find something)


This allows your RSS feed to be handled by google and in essence you could change the location of your blog and all subscribers to your blog automatically get the feed from your new location. In addition it provides Statistics how many people are subscribed to your blog.


This is one of the more creepy plugins from google, in essence it keeps track how much time people spent visiting your site, what they click, where they are from, what kind of computer they use etc.


Well Adsense is one way to make money with your blog, in essence it is a banner controlled by google and whenever somebody clicks the ad you get some money like 5cents. Well you get a check when you should get 70bucks, so it could take some time.

Personal reasons

It is always best to have your own personal reasons why you maintain a website or a blog. But always keep in mind that the site is there to enrich the internet in some way.

Be mindful that you always will receive negative comments on the internet, you can ignore them, however if they are constructive you should at least listen.

And as always remember to have fun.

Part 1 – Part 2

WordPress: (Part 2) Themes and Menus

Now that the site is installed and configured you can take care of choosing a theme and configuring the menus. (See Part 1)


There are many free themes available, as well as themes that come as a price. Finally there is the possibility of hiring a professional WordPress Theme Designer to customize your site.


Search for new themes with WordPress

To find themes you can navigate to Appearances and then on the top “Install Themes” and then start searching for themes.If you download or purchase a theme from another site, you also have to go to Appearances > Install Themes, and then choose on the top “Upload

Custom Themes

Upload a custom theme

A selection of themes can be found at smashing magazine:


After you have selected and installed your theme you usually define a menu for your site. In most cases you would want the user to be able to browse categories. However you also can let the site navigate to Pages or custom URLs.

To allow the user to browse categories you first have to define categories, this is found under Posts > Categories.  Whenever you create a new Post you should set a Category, if not it will be stored in the Category “Uncategorized“.

Here you set up your Categories

Here you set up your Categories

After you have set up the categories you can add them to your Menu. Important: You can set up multiple Menus, however one menu is always set to the “Primary Navigation”.

There is a Save Menu Button and a Save Primary Navigation Button

There is a Save Menu Button and a Save Primary Navigation Button

Watch out that you always use the “Save Menu” button to save any changes.


Depending on your theme, it supports Widgets (small feature extensions). To add Widgets to your site, drag  a widget from available Widgets and drop it where you want it (e.g. The Main Sidebar)

After you have dragged it you can configure it and how it looks.

Additional Widgets are available when installing Plugins see Part 3

Widgets, simply drag and drop widgets

Widgets, simply drag and drop widgets

Continue to Part 3