Pyside UI dropping behind maya main UI

105 views
Skip to first unread message

Jakob Kousholt

unread,
Nov 29, 2018, 4:38:47 AM11/29/18
to Python Programming for Autodesk Maya
Hi,

So I am slowly getting the hang of pyside, but a thing I have postponed too long is to figure out how to make the UI sit on top of mayas main UI like every other UI inside of maya. So far my code is this: (any other unrelated tips on a better boileterplate is most welcome too)

from PySide2 import QtCore, QtGui, QtWidgets
from shiboken2 import wrapInstance


import maya.OpenMayaUI as omui

def maya_main_window():
    main_window_ptr = omui.MQtUtil.mainWindow()
    return wrapInstance(long(main_window_ptr), QtWidgets.QWidget)
    
class gSubmission(QtWidgets.QMainWindow):
    
    def __init__(self, parent=maya_main_window()):
        super(gSubmission, self).__init__(parent)
        
        self.setWindowTitle("Temp")
        
    
if __name__ == "__main__":
    
    try:
        ui.close()
    except:
        pass
        
    ui = gSubmission()
    ui.show()
    


Justin Israel

unread,
Nov 29, 2018, 3:22:04 PM11/29/18
to python_in...@googlegroups.com
Which version of Maya and which operating system are you using? Setting the parent to the Maya main window, the way you are doing, should result in the window staying above Maya (tested on Linux/Maya 2018). However it won't force it to stay above every single child window in Maya. 

Justin


--
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/678a5041-d94d-4403-bb03-78ef3b3d6db4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jakob Kousholt

unread,
Nov 29, 2018, 4:21:50 PM11/29/18
to python_inside_maya
Hey Justin,

Arh, I see. I was trying on mac, but it seems to be working as I intend on Windows 10. Maya version is 2018 in both cases. Any idea how I can make it work on mac too? Thanks

Reply all
Reply to author
Forward
0 new messages