[PyKDE] Custom import statements
A.T. Hofkamp
a.t.hofkamp at tue.nl
Thu Jan 23 14:59:01 GMT 2003
On Wed, 22 Jan 2003, Sven Over wrote:
> My question: how can I make pyuic put a certain "import" statement at the
> beginning of a generated py-file? I'm working on a graphical frontend for a
> device connected to a VME bus. To be quick, I write most of the code into qt
> designer, so that pyuic puts it in its py-file. To accessing the device I
> need a "import VME" statement at the beginning of the py-file. How do I
> achieve that pyuic puts it there for me. For now, I have to edit the py-file
> after every execution of pyuic.
I am also new, so I have no idea what pyuic does, but assuming that you
have a generated file "pyuic_out", the easiest solution is something like
echo "import VME" | cat - pyuic_out > pyuic.py
(echo writes the single line at the input, cat concatenates the input and
the generated file to puic.py.)
More advanced approaches can be made by using other text-processing tools,
such as sed, awk, (obviously) Python, and (if you know what to do with it)
Perl.
Albert
--
Unlike popular belief, the .doc format is not an open publically available format.
More information about the PyQt
mailing list