QResource (QRC) and

31 views
Skip to first unread message

klaass...@gmail.com

unread,
Sep 7, 2015, 3:31:31 PM9/7/15
to Python Programming for Autodesk Maya
Hi there everybody!

I'm currently working on improving my tool creation workflow and wanted to include images in my UI's.

---------------------------------------------
TL,DR:
- Maya 2014
- PySide
- NOT pre-compiling ui-file, but using: pysideuic.compileUi()
- QRC (image resource) causing compilation error:
# Error: ImportError: file <string> line 49: No module named qrctest_qrc_rc #
(Note: qrc-file is named; qrctest_qrc.qrc) (XML)
(Note2: The error is probably already caused from reading the implementation of a qrc resource in the ui file; qrctest_ui.ui) (XML)
----------------------------------------------

Right now I'm working with something similar to what Frederik Averpil has going on here; https://github.com/fredrikaverpil/pyVFX-boilerplate

Main difference is that I'm only focused on PySide (in combination with Maya 2014), so the 'boilerplate'-code that I'm using is a lot shorter.

Workflow is as follows;
1) Create UI with QtDesigner
2) Copy and adept boilerplate code for the new project
3) Attach functionality to buttons etc.
4) Source in Maya & enjoy UI

This workflow breaks when I try to implement images through the resource browser (QRC-file) in QtDesigner.

Why this workflow?
By not having to pre-compile I can do fast iterations and don't have to hassle with copy-pasting compiled code. yay! Unfortunately the QRC just doesn't seem to work.

To test this, I created a small project:
-qrctest.py - http://pastebin.ubuntu.com/12306839/
-qrctest_ui.ui (XML)* - http://pastebin.ubuntu.com/12306896/
-qrctest_qrc.qrc (XML) - http://pastebin.ubuntu.com/12306884/

* There's a # at line 1 to prevent pastebin from complaining about web-stuff.

Has anybody got this working?

Kind regards,


Nico

Justin Israel

unread,
Sep 7, 2015, 3:50:28 PM9/7/15
to Python Programming for Autodesk Maya

I've never used resource files without compiling them via rcc. When you use them in Designer, as you know, it will put a reference to them in your UI file. When you convert them to python via uic, it will expect the qrc to have also been compiled. I don't even know of there is a dynamic rcc operation that you can run which is similar to the uic you perform at runtime.
Maybe that boilerplate thing can be extended to suit your workflow and detect and perform the rcc at runtime before the uic happens. This would not be suitable for production, since it would be slower, and still require all the images to be present and the pathing to be correct. But it could at least suit the prototyping workflow you have chosen.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b32eda9d-6071-4ed8-aa6e-1a0e5257d520%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Israel

unread,
Sep 7, 2015, 3:52:22 PM9/7/15
to Python Programming for Autodesk Maya

We have duplicate threads here. ignore this thread and I will repaste in the original.

Reply all
Reply to author
Forward
0 new messages