Hello world,

I got a (beginner?) problem initializing some objects, for instance of the 
class KAboutData:
  *works:
     from kdecore import KAboutData 
     (how to be sure of the kdecore version used? I suspect it's from kde 3,
     help(KAboutData) is not explicit) 
  *does not work, although is favoured by documentation [0]:
     from PyKDE4.kdecore import KAboutData'.
     (help(KAboutData) refers to kde4 classes)

However, it seems I cannot use both kinds of imports in the same program (both 
wrap the QObject class...).

So, should I use only the first kind of import ? Will it work ?

I join a small test generating errors on a debian and an ubuntu:
% python test.py pykde4
->
debian sid/experimental on sept 4th 2008 :
TypeError: argument 1 of KAboutData() has an invalid type
  Python             2.5.2
  python-kde4        4.0.2-1-1
  python-sip4        4.7.7-1
TypeError: argument 3 of KAboutData() has an invalid type
  kubuntu 8.4
  Python             2.5.2
  python-kde4        4:4.0.3-0ubuntu1.2
  python-sip4        4.7.3-1ubuntu2

Thank you for clues !


[0] http://www.riverbankcomputing.co.uk/static/Docs/PyKDE4/using.html

-- 
Feth

"""
Supposed to work fine with 'kdecore'.

Errors with "pykde4":
debian sid/experimental on sept 4th 2008 :
  Python             2.5.2
  python-kde4        4.0.2-1-1
  python-sip4        4.7.7-1
  TypeError: argument 1 of KAboutData() has an invalid type
kubuntu 8.4
  Python             2.5.2
  python-kde4        4:4.0.3-0ubuntu1.2
  python-sip4        4.7.3-1ubuntu2
  TypeError: argument 3 of KAboutData() has an invalid type
"""
from sys import argv

class testapp(object):
   appname     = 'testapp'
   progname    = 'Testapp'
   version     = '0'
   description = 'bling'
   copyright   = 'bling'
   moretext    = 'bling'
   homepage    = 'bling'
   bugaddr     = 'bling'

def test(cls):
  about_data = cls(
    testapp.appname,
    testapp.progname,
    testapp.version,
    testapp.description,
    cls.License_Custom,
    testapp.copyright,
    testapp.moretext,
    testapp.homepage,
    testapp.bugaddr)

if "kdecore" in argv:
  from kdecore import KAboutData
  test(KAboutData)
  print "success"
elif "pykde4" in argv:
  from PyKDE4.kdecore import KAboutData
  test(KAboutData)
  print "success"
else:
  print "usage: %s kdecore|pykde4" % argv[0]
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to