Re: [PyQt] pyuic4 vs uic.loadUI

2010-09-29 Thread David Douard
   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)

I usually use both of them to deal with this problem.

My python code which depends on ui files (ie. class which heritate from 
widgets made in designer) tries to load ui file using uic.loadUI, and if it 
fails, it tries to load the class from the module made by pyuic4.

This allows me to use .ui files directly during development process. Then when 
I must release the code, the setup.py generates the python modules from ui 
file (using pyuic4), and these modules are packaged by distutils (which is 
used for py2exe or to build debian packages).

This king of stuff is used for example in hgview 
(http://www.logilab.org/project/hgview) 

David


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] pyuic4 vs uic.loadUI

2010-09-29 Thread Juan Manuel Santos

From: Sebastian Elsner sebastianels...@freenet.de
To: pyqt@riverbankcomputing.com
Date: Tuesday 28 September 2010
   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)

The same thing happened to me when developing under PyGTK using Glade. I had 
to manually copy the glade files inside the dist directory generated by py2exe. 
Py2exe does not (can not :) ) track these type of dependencies on the project, 
since you are opening a file from inside your code.

Try manually copying the ui files in the same directory structure but under 
dist (or whatever directory py2exe creates for you with your .exe in it).

Cheers
Juan Manuel
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] pyuic4 vs uic.loadUI

2010-09-28 Thread pard
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?

Regards
Pard
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] pyuic4 vs uic.loadUI

2010-09-28 Thread Sebastian Wiesner
Hi,

I prefer uic.loadUi, it's simply much more convenient and much easier to use.

It saves the tedious invocation of pyuic4 during development.  And no
risk of weird errors caused by a forgotten compilation of your user
interface ... the application automatically uses the user interface,
that you just saved in the designer.  And you can deploy UI files with
standard distutils as package data along with the application code
(pyuic4 would require some custom solution to compile UI files during
installation or packaging, unless you want to have generated could
lingering around in the source tree).

So basically it just works, whereas pyuic4 means additional work.
UI compilers are fine for C++, where you have to compile anyway, but
in Python things are easier.   Just my opinion ...

Sebastian Wiesner
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyuic4 vs uic.loadUI

2010-09-28 Thread Wolfgang Rohdewald
On Dienstag 28 September 2010, Sebastian Wiesner wrote:
 So basically it just works, whereas pyuic4 means additional
 work. UI compilers are fine for C++, where you have to
 compile anyway, but in Python things are easier.   Just my
 opinion ...

+1

however I never tested how much time either variant takes 
for the application to start. In my case, kajongg, there
are only 2 small .ui so time does not matter

-- 
Wolfgang
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyuic4 vs uic.loadUI

2010-09-28 Thread Tyler W. Wilson


On 9/28/2010 1:19 PM, Wolfgang Rohdewald wrote:

On Dienstag 28 September 2010, Sebastian Wiesner wrote:

So basically it just works, whereas pyuic4 means additional
work. UI compilers are fine for C++, where you have to
compile anyway, but in Python things are easier.   Just my
opinion ...

+1

however I never tested how much time either variant takes
for the application to start. In my case, kajongg, there
are only 2 small .ui so time does not matter



+1
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyuic4 vs uic.loadUI

2010-09-28 Thread Hans-Peter Jansen
On Tuesday 28 September 2010, 18:19:43 pard 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?

Being impatient, I always keep an eye on any avoidable delays, and that's 
one of them. And since I have to run auxiliary tools anyway (pyrcc4, 
pylupdate4, lrelease), compiling the UI is more or less free anyway..

Here are some simplified Makefile excerpts:

PYRESOURCES = $(patsubst %.qrc,%_rc.py,resources.qrc)
PYUIFILES = $(patsubst %.ui,Ui_%.py,$(wildcard *.ui))

%_rc.py: %.qrc
pyrcc4 -o $@ $

%.py: %.ui
pyuic4 -o $@ $

all: $(PYUIFILES) $(PYRESOURCES)

Pete
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] pyuic4 vs uic.loadUI

2010-09-28 Thread Sebastian Elsner
 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, pardpardmeis...@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 listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt