[PyQt] pyuic4 vs uic.loadUI

pard pardmeister at gmail.com
Wed Sep 29 08:40:21 BST 2010


Hi All

Thanks for the replies, it's food for thought. I will be packaging my code
with py2exe. If there's a snag in packaging them correctly then perhaps it's
best for me to compile the ui. Unless of course someone has an idea as to
what could be Sebastian's problem. Loading the ui file does seem a whole lot
easier however, and having worked with wxpython and xrc, it wasn't much of a
paradigm shift for me I suppose. But hey, we live, we learn. And again,
thank you for the replies, if others still have more, please keep them
coming. They are helpful.

Pard

On 28 September 2010 22:10, Sebastian Elsner <sebastianelsner at freenet.de>wrote:

>  Hmm interesting topic, I recently had to switch back from ui files to py
> files because I couldnt get py2exe to package the ui files correctly (Any
> help appreciated though)
> Secondly using ui files I loose the comfort of auto-completion with pydev
> and Eclipse, because pydev wouldnt know how to deal with the ui xml data. If
> there is anybody out there having advice on that, I'd gladly take it :)
>
>
> Am 28.09.2010 21:46, schrieb fpp:
>
>  On Tue, Sep 28, 2010 at 6:19 PM, pard<pardmeister at gmail.com>  wrote:
>>
>>> Hi
>>> I have found that some people use pyuic4 to compile their ui files and
>>> some
>>> load them dynamically using loadUI.
>>> Does anyone have the pro's and con's of each of these methods? What is
>>> the
>>> recommended PyQT way of doing this?
>>>
>> Thanks for starting the discussion, I've often wondered myself. I have
>> no opinion one way or another, but since most seem to favour loadUI,
>> I'll play the devil's advocate for pyuic4 :-)
>>
>> I can think of several reasons to prefer compiled ui files :
>>
>> 1) if you're using eric4 as an IDE, it does everything for you, so why not
>> ?
>>
>> 2) on a reasonably recent PC, and for common UIs, the additional
>> launch time, CPU&  memory usage due to loadUI are probably not even
>> measurable, compared to the Python, Qt and PyQt startup load.
>> For extremely complex and widget-heavy UIs this might be less evident
>> : parsing XML is not the most efficient thing in the world after all.
>> And if we're running on mobile platforms with more limited
>> power/CPU/RAM and slow Flash I/O, like Nokia's Symbian or Maemo
>> smartphones, it could become quite perceptible.
>>
>> 3) during the early design phases, it's sometimes handy to be able to
>> manually modify a generated Python UI file, just to check out the
>> effect of some minor change, without having to do it in Designer
>> (especially if it involves sizers :-)
>>
>> 4) if for some reason you wish or need to distribute only binaries, as
>> sometimes happens, you can exclude the .ui source files and ship only
>> the UI .pyc/pyo files.
>> Dumb, yes, but not entirely impossible :-)
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100929/6beea0f0/attachment-0001.html>


More information about the PyQt mailing list