[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] uic.loadUiType does not load external resources
From:       Vader <golem.md () gmail ! com>
Date:       2019-10-20 12:42:51
Message-ID: 1571575371983-0.post () n6 ! nabble ! com
[Download RAW message or body]

Hello, PyQT devs!

After creating a custom widget that uses external images (with QT Designer),
I've noticed that when I load it with uic.loadUiType, the external images
are not loaded. When I use uic.loadUI instead, everything is fine.
After a short investigation, I figured out that UIParser.parse is called
without the "basedir" argument there.

uic.loadUI -> DynamicUILoader.loadUI -> self.parse(filename,
resource_suffix, basedir)
vs
uic.loadUiType -> compiler.UICompiler().compileUi ->
self.parse(input_stream, resource_suffix) 

Apparently, loadUi takes into account the case where the input stream object
is a file. In that case, it extracts the file path and uses it as an
argument to "self.parse". Contrary, compileUi does nothing like this.
Changing the call to "self.parse" in the loadUiType sequence to use the
"basedir" in the same way it is used by DynamicUILoader fixes the problem.

Please, consider applying this fix in the next version of PyQT.
Thanks!



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic