QT designer e RLpy

Has anyone managed to use a *.ui generated by qtdesigner, in other words, has anyone managed to implement it and call the components from Python code for iClone8?

I should point out that I am familiar with QTdesigner’s “View Python Code” and pyside2-uic, but these produce ‘generic’ Python code, which is not always applicable to scripts for iclone (please correct me if I am wrong).

You need something like PyQt to use Qt GUIs in Python:

https://wiki.python.org/moin/PyQt

1 Like

Thank you for your reply. Unfortunately, it seems to me that this applies to a ‘generic’ Python, which is not the case with RLpy. I really don’t know how to enrich RLpy libraries or classes, which don’t seem to comply with Object Oriented language standards, such as inheritance, for example. It’s frustrating.

Are you referring to using a .ui file in an IC/CC Python script?
Here is some sample code for using a .ui file for your reference. You can also check this page:
(IC Python API:Using Pyside2 For Creating User Interface - Reallusion Wiki!)

Hope this helps!

def create_dialog():
    # initialize dialog
    main_widget = wrapInstance(int(RLPy.RUi.GetMainWindow()), PySide2.QtWidgets.QWidget)    
    dlg = PySide2.QtWidgets.QDialog(main_widget)    # set parent to main window
    
    ui_file = QFile(os.path.dirname(__file__) + "/FacialMocap.ui")
    ui_file.open(QFile.ReadOnly)
    ui_widget = PySide2.QtUiTools.QUiLoader().load(ui_file) # load .ui file
    ui_file.close()
    ui_layout = PySide2.QtWidgets.QVBoxLayout()
    ui_layout.setContentsMargins( 0, 0, 0, 0 )
    ui_layout.addWidget(ui_widget)
    dlg.setLayout(ui_layout)
    dlg.setWindowTitle("Facial Mocap Sample")
    dlg.resize(ui_widget.size().width(), ui_widget.size().height())
    dlg.setMinimumSize(ui_widget.size())
    dlg.setMaximumSize(ui_widget.size())

    # connect button signals
    ui_connect_btn = ui_widget.findChild(PySide2.QtWidgets.QPushButton, "qtConnectBtn")
    if ui_connect_btn:
        ui_connect_btn.clicked.connect(do_connect)
    ui_start_btn = ui_widget.findChild(PySide2.QtWidgets.QPushButton, "qtStartBtn")
    if ui_start_btn:
        ui_start_btn.clicked.connect(trigger_mocap)
    return dlg
1 Like

Lovely, I’ll try it and hope it works.

1 Like