PyQt6 and SIP v6 Snapshots Available

Kálmán Viktor viktorvector at gmail.com
Thu Sep 24 14:09:03 BST 2020


Personally I always used this to determine the path, I think in QML you
don't even need to worry about it.

    _root = QFileInfo(__file__).absolutePath()
    _root_url = 'qrc:' if _root.startswith(':') else _root
    logger.info('Root url is %s', str(_root_url))

    qml_path = QUrl(os.path.join(_root_url, 'qml/main.qml'))



Patrick Stinson <patrickkidd at gmail.com> ezt írta (időpont: 2020. szept.
24., Cs, 0:12):

> Phil,
>
> So the preferred way to embed binary resources in a statically linked
> (pyqtdeploy) app under PyQt6 will be to add “RESOURCES = whatever.qrc” to
> the project’s qmake (rather cmake?) rules? Or some non-rcc mechanism?
>
> If so, then one would have to somehow switch the file path strings between
> the rcc path for a pyqdeploy app and the relative path on the physical file
> system when running python from the terminal during development. Qml uses
> relative paths for resources such as pixmaps and other qml source files.
>
> That’s all I can think of right now. I am not familiar with pkg_resources.
>
> -Patrick
>
> > On Sep 23, 2020, at 1:17 PM, Eli Schwartz <eschwartz at archlinux.org>
> wrote:
> >
> > On 9/23/20 1:42 PM, Phil Thompson wrote:
> >> On 23/09/2020 18:33, Detlev Offenbach wrote:
> >>> Hi Phil,
> >>>
> >>> the download page says, that 'pyrcc' has been removed. What will be
> >>> the successor? The eric-ide sources use resource files and thus
> >>> depends on pyrcc.
> >>
> >> I don't plan a successor as I don't see the point of resource files in a
> >> Python context.
> >>
> >> What do you use it for?
> >>
> >> Phil
> >
> > +1
> >
> > qresource files are intended to embed random data files into
> > single-executable style software distributions, to reduce the number of
> > moving parts. This is as opposed to doing proper installation management
> > unix style, and is of limited use on Windows too, as long as people ship
> > Qt itself as shared libraries necessitating a directory structure.
> >
> > This is all fine and well for C++ programs where qresources get
> > statically linked into the executable itself, reducing the number of
> > files to be installed.
> >
> > What's the point of it for generating *.py files with that data? You end
> > up with multiple files to distribute anyway.
> >
> > pkg_resources.resource_filename() and its modern equivalent, the stdlib
> > importlib.resources, allows you to access real files through standard
> > pythonic mechanisms, without the wrapper abstractions and without an the
> > rcc compiler. There's no need to handle data blobs as python inline
> > strings, try to byte-compile something that doesn't really byte-compile
> > well, etc.
> >
> > The resulting files are easily introspectable and modifiable in the
> > built software bundle (because they are the original files) and only get
> > read at the time of use.
> >
> > Really -- what is the big attraction to using qresources in python?
> >
> > --
> > Eli Schwartz
> > Arch Linux Bug Wrangler and Trusted User
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200924/b08bc834/attachment.htm>


More information about the PyQt mailing list