Customize pyuic resource import statement?

When I use this command in windows:

python -m PyQt4.uic.pyuic user_interface.ui -o user_interface.py

After that I add a resource:

pyrcc4.exe -py3 images.qrc -o images.py

And I have two beautiful files, user_interface.py and images.py . The problem is that the user_interface.py file ends with this line of code:

... all QT stuff here.
import images_re

And since this is a module that is called from many parents, it needs to be imported as follows:

import myapp.gui.images_re

When I change the line of code, it works fine, but every time I change the user_interface.ui file and then execute the package, it will be overwritten and I will have to change it manually each time.

pyuic, ?
, pyuic ?
.py user_interface.py, , , images_re ?

+4
1

, ui, - from_imports. ui:

    from . import resources_rc

:

    pyuic4 --from-imports --output file.py file.ui

(NB: pyuic ).

+2

Source: https://habr.com/ru/post/1616979/


All Articles