convert qt file to python in Maya 2024

69 views
Skip to first unread message

Pacifique Nzitonda

unread,
Jun 3, 2024, 4:11:46 PMJun 3
to Python Programming for Autodesk Maya
Hi all, in Maya 2020 I used to import pyside2uic and convert .ui to .py
How do we do it in Maya 2024?
Thanks

Justin Israel

unread,
Jun 3, 2024, 6:55:42 PMJun 3
to python_in...@googlegroups.com
Does this link help?

--
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/de8e4f24-270e-44ee-a369-4a383493b8a1n%40googlegroups.com.

Pacifique Nzitonda

unread,
Jun 4, 2024, 3:29:47 AMJun 4
to Python Programming for Autodesk Maya
Hi Justin, I had already read this but I want to do it directly in Maya not using external console. I want to do it that way because I'm still going back and forth between the code in Maya and Qt Designer. So I want to be able to reload the converted .py all the time.
Thanks

Justin Israel

unread,
Jun 4, 2024, 3:41:31 AMJun 4
to python_in...@googlegroups.com


On Tue, Jun 4, 2024, 7:29 PM Pacifique Nzitonda <nzitonda...@gmail.com> wrote:
Hi Justin, I had already read this but I want to do it directly in Maya not using external console. I want to do it that way because I'm still going back and forth between the code in Maya and Qt Designer. So I want to be able to reload the converted .py all the time.
Thanks

What am I missing? The code in the Option B is something you can run in Maya. It isn't shell commands. 


On Tuesday, June 4, 2024 at 12:55:42 AM UTC+2 Justin Israel wrote:
On Tue, Jun 4, 2024 at 8:11 AM Pacifique Nzitonda <nzitonda...@gmail.com> wrote:
Hi all, in Maya 2020 I used to import pyside2uic and convert .ui to .py
How do we do it in Maya 2024?
Thanks

Does this link help?

--
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/de8e4f24-270e-44ee-a369-4a383493b8a1n%40googlegroups.com.

--
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.

Pacifique Nzitonda

unread,
Jun 4, 2024, 4:16:32 AMJun 4
to Python Programming for Autodesk Maya
Oh sorry! What I didn't mention is that I want to get autocompletion but the QUiLoader() doesn't provide it. 

Justin Israel

unread,
Jun 4, 2024, 6:16:59 AMJun 4
to python_in...@googlegroups.com


On Tue, Jun 4, 2024, 8:16 PM Pacifique Nzitonda <nzitonda...@gmail.com> wrote:
Oh sorry! What I didn't mention is that I want to get autocompletion but the QUiLoader() doesn't provide it. 

This is a different problem. You said it didn't work because you thought it was a console shell approach. But now that you see it is a code approach, your actual problem is about autocomplete? 

Pacifique Nzitonda

unread,
Jun 4, 2024, 7:32:03 AMJun 4
to Python Programming for Autodesk Maya
I'm sorry maybe I didn't explain well the issue.
What I'm looking for is a way to do something like this in Maya 2024 Script Editor:

https://codefile.io/f/gJMC306hSL

I'm learning stuff about qt that's why It would be easier if I could convert the .ui to .py each time I run my script inside Maya 2024

Justin Israel

unread,
Jun 4, 2024, 7:05:45 PMJun 4
to python_in...@googlegroups.com
On Tue, Jun 4, 2024 at 11:32 PM Pacifique Nzitonda <nzitonda...@gmail.com> wrote:
I'm sorry maybe I didn't explain well the issue.
What I'm looking for is a way to do something like this in Maya 2024 Script Editor:

https://codefile.io/f/gJMC306hSL

I'm learning stuff about qt that's why It would be easier if I could convert the .ui to .py each time I run my script inside Maya 2024

If I test the following code in the Maya script editor, from the example link I previously shared, it seems to work just fine in loading the ui file and giving me a QDialog. Maya script editor can then autocomplete fields on the QDialog object:

from PySide2.QtUiTools import QUiLoader
from PySide2.QtCore import QFile, QIODevice

def load(ui_file_name):
    ui_file = QFile(ui_file_name)
    if not ui_file.open(QIODevice.ReadOnly):
        print("Cannot open {}: {}".format(ui_file_name, ui_file.errorString()))
        return
    loader = QUiLoader()
    window = loader.load(ui_file)
    ui_file.close()
    return window

win = load("test.ui")

Each time I call load() it will return me a new instance of the dialog. 
 

Pacifique Nzitonda

unread,
Jun 7, 2024, 9:17:39 AMJun 7
to Python Programming for Autodesk Maya
Thanks a lot, it is all good now.
Oh by the way, thank you also for the "Python for VFX" Vol  2 (Python for Maya Artist). Produced by CMI STUDIOS.
That helped me so much when I started learning python.

Justin Israel

unread,
Jun 7, 2024, 4:33:28 PMJun 7
to python_in...@googlegroups.com


On Sat, Jun 8, 2024, 1:17 AM Pacifique Nzitonda <nzitonda...@gmail.com> wrote:
Thanks a lot, it is all good now.
Oh by the way, thank you also for the "Python for VFX" Vol  2 (Python for Maya Artist). Produced by CMI STUDIOS.
That helped me so much when I started learning python.

Very welcome! 

Reply all
Reply to author
Forward
0 new messages