Languages/Python/PyKDE Knotify Tutorial

    From KDE TechBase
    Revision as of 22:37, 9 August 2010 by Hefee (talk | contribs) (minimal kde application)
    (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


    Development/Tutorials/Python/PyKDE_KNotify_Tutorial


    Python KNotify Tutorial
    Tutorial Series   Python
    Previous   None
    What's Next  
    Further Reading   Qt Signals and Slots in python, Introduction to PyQT4, Using PyKDE4

    Abstract

    The aim of this tutorial is to give a sample class to include Notifications and Jobs to your own python programms, so the user can see what is going on (for example a backup system, that tells you that is backuping right now). It assumes a basic working knowledge of Python and PyKDE4. For now only the Job part is mentioned, 'cause that is the only part I've created right now.

    Further plans

    To add the Notification part also to this tutorial.

    Instruction

    We start with a minimal KDE Appliciation (Using PyKDE4):

    1. ! /usr/bin/python
    2. -*- coding: utf-8 -*-

    if __name__ == "__main__":

       import sys
       
       from PyKDE4.kdecore import KCmdLineArgs, KAboutData, KLocalizedString, ki18n
       from PyKDE4.kdeui import KApplication    
       
       appName     = "default"
       catalog     = ""
       programName = ki18n ("default")  
       version     = "1.0"
       description = ki18n ("Default Example")  
       license     = KAboutData.License_GPL
       copyright   = ki18n ("(c) 2010 Sandro Knauß") 
       text        = ki18n ("none") 
       homePage    = "techbase.kde.org"
       bugEmail    = "[email protected]"
    
       aboutData   = KAboutData (appName, catalog, programName, version, description,
                                 license, copyright, text, homePage, bugEmail)
    


       KCmdLineArgs.init (sys.argv, aboutData)
       
       app = KApplication ()