[PyKDE] pyuic and custom widgets

Tuvi, Selim stuvi at SLAC.Stanford.EDU
Mon Aug 4 20:39:01 BST 2003


If you are using PyQt 3.6 or later you can do this. From the PyQt online documentation page 2 (x113.html):

It is sometimes useful to be able to include some specific Python code in the output generated by pyuic. For example, if you are using custom widgets, pyuic has no way of knowing the name of the Python module containing the widget and so cannot generate the required import statement. To help get around this, pyuic will extract any lines entered in the Comment field of Qt Designer's Form Settings dialog that begin with Python: and copies them to the generated output.

Here's a simple example showing the contents of the Comment field.

This comment will be ignored by pyuic.
Python:
Python:# Import our custom widget.
Python:from foo import bar
 

Here's the corresponding output from pyuic.

from qt import *

# Import our custom widget.
from foo import bar
 

-Selim

Selim Tuvi, Research Engineering Group, SLAC
GLAST, I&T Online, MS 98
Tel:650-926-3376 Fax:650-926-4335
 

-----Original Message-----
From: Vincent Wagelaar [mailto:vincent at ricardis.tudelft.nl] 
Sent: Sunday, August 03, 2003 8:11 PM
To: pykde at mats.imk.fraunhofer.de
Subject: [PyKDE] pyuic and custom widgets


Hi,

I've created an ui-file containing a custom widget. How do I tell pyuic to 
automatically add the custum-widget module to the generated py-file.

Cheers,
Vincent

_______________________________________________
PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde




More information about the PyQt mailing list