[PyKDE] 2 Bugs in pyuic for custom widgets
Torsten Marek
shlomme at gmx.net
Fri Jan 27 11:27:35 GMT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andreas Pakulat schrieb:
> Hi,
>
> first I thought you forgot my "fixes" for making custom widgets work.
> However you just implemented them in a better way.
>
> Problem is: Both "fixes" don't work anymore :-(
>
> The first one is trivial: I used regexp's for the substitution of "/"
> and ".h" for the header-tag. Now you did use plain string functions, but
> string.replace doesn't need "/" to be escaped. Thus the
> header.replace("\/") actually needs to be header.replace("/").
>
> The 2nd problem seems to be a bigger thing: The findtext method does
> _not_ return the default value when it finds an empty element. The
> problem is in ElementPath.findtext():
>
> def findtext(self, element, default=None):
> import logging
> logging.debug("EP: %s, %s" % (element, default))
> logging.debug("EP: %s" % self.tag)
> tag = self.tag
> if tag is None:
> logging.debug("EP: tag is none")
> nodeset = self.findall(element)
> if not nodeset:
> return default
> return nodeset[0].text or ""
> for elem in element:
> logging.debug("EP: elem: %s" % elem)
> if elem.tag == tag:
> return elem.text or ""
> logging.debug("EP: Returning: %s" % default)
> return default
>
Hi again,
if I had read the API documentation correctly, this bug would not have entered
the code. The default is only returned if the element is not found. But
<extends> is found, only that it's empty - so function is correct.
best regards
Torsten
- --
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFD2gOnfMVFHqJEyFgRAmr2AJsETSFmzA9leUt68y1yAMTiyxtP4QCdE/FI
QGqPw/1ioriGajY89w3ZWfA=
=jnVx
-----END PGP SIGNATURE-----
More information about the PyQt
mailing list