#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, logging
from qt import *
from kdecore import *
from khtml import *

class HTMLPart(KHTMLPart):
    pass

class ScreenShoter(QObject):
    def eventFilter(self, object, event):
        # if keypressed .... write screen shoot...
        logging.debug("Event: "+repr(object)+" , "+repr(event))
        return False

def main():
    logging.getLogger().setLevel(logging.DEBUG)
    KCmdLineArgs.init(sys.argv,"kadaboum","kadaboum","")
    app = KApplication()

    win=HTMLPart()
    win.show()
    app.installEventFilter(ScreenShoter(win))

    win.begin()
    win.write("<html><body><p>KHTML almost Rocks!</p></body></html>")
    win.end()
        
    app.setMainWidget(win.widget())
 
    app.exec_loop()

main()
