uic.load (was: [PyQt] Re: Problem with latest PyQt4 snapshot)

Phil Thompson phil at riverbankcomputing.com
Tue Sep 22 21:40:26 BST 2009


On Tue, 22 Sep 2009 20:35:21 +0200, Arnold Krille <arnold at arnoldarts.de>
wrote:
> On Tuesday 22 September 2009 19:57:46 Phil Thompson wrote:
>> On Tue, 22 Sep 2009 19:42:27 +0200, Arnold Krille <arnold at arnoldarts.de>
>> > on a side note: Is it possible to have uic.load() respect the
>> > python-library
>> > dirs?
>> I'm not convinced it's a good idea...
> 
> Security issues?

Not particularly.

> I think it would be quite cool if
> 
>  uic.load( ffado.widgets.mixer, self )
> 
> loaded the ffado/widgets.mixer.ui the same as
> 
>  import ffado.widgets.mixer
> 
> imports ffado/widgets/mixer.py(c), regardless whether its local (ie.
> relative) 
> found or "only" system-wide.
> 
>> It's easy enough to implement something yourself using __file__.
> 
> Currently I created an own function which knows about the install path
> (which 
> is inside the standard python library paths. Well, to be exact, my
function
> 
> first checks if the desired ui-file is reachable via relative paths when
a 
> developer is testing ffado-mixer without installing it. Only if that
> doesn't 
> work, the absolute installation path is used.

It's the wrong place to put such functionality. There's less of a problem
with a separate load_from_path() function but that would still be far less
control than import gives you - and experience has shown that that level of
control is necessary.

Phil


More information about the PyQt mailing list