[PyQt] Problem with resource imports in pyuic generated files

Baz Walter bazwal at ftml.net
Tue Feb 16 20:59:23 GMT 2016


On 16/02/16 18:56, Elvis Stansvik wrote:
> 2016-02-16 19:54 GMT+01:00 Elvis Stansvik <elvstone at gmail.com>:
>> 2016-02-16 19:35 GMT+01:00 Baz Walter <bazwal at ftml.net>:
>>> So the python package directory contains python modules and nothing else.
>>> The resource module generated by pyrcc just goes in the same directory as
>>> the ones generated by pyuic, which solves the import issue.
>>
>> Ah yes, probably a good idea to to break the .ui files out of the
>> python package as well. Thanks.
>>
>> For now, I'll have to keep the generated _ui.py and _rc.py in the same
>> package. This is okay, but I would rather have them split up (e.g. a
>> ui/ or perhaps forms/ package with the .ui files, and a resources/
>> package for the resources). So for me, something like a
>
> I should say, the reason I'd prefer to be able to do this is that some
> of my resources are not really "UI" things per se, but more like
> static application data, so it would make more sense to have a general
> "resources" package for them.
>

The modules generated by pyuic will probably be the only ones that 
explicitly import the resources module. What would be the point of a 
separate sub-package? From a programming point of view, the only 
namespace that matters is the one provided by the resource system itself 
- and the best place to organize that is the qrc file (it has support 
for aliases, if needed).

-- 
Regards
Baz Walter


More information about the PyQt mailing list