Discussion:
[Maya-Python] Pyside UI dropping behind maya main UI
Jakob Kousholt
2018-11-29 09:38:47 UTC
Permalink
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()
--
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_maya+***@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.
Justin Israel
2018-11-29 20:21:47 UTC
Permalink
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
Post by Jakob Kousholt
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
main_window_ptr = omui.MQtUtil.mainWindow()
return wrapInstance(long(main_window_ptr), QtWidgets.QWidget)
super(gSubmission, self).__init__(parent)
self.setWindowTitle("Temp")
ui.close()
pass
ui = gSubmission()
ui.show()
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/678a5041-d94d-4403-bb03-78ef3b3d6db4%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/678a5041-d94d-4403-bb03-78ef3b3d6db4%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA01dFt4wSwNKADZ7yG7x40yF9vpuTgN3jjxDQ8ra7fYWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Jakob Kousholt
2018-11-29 21:21:33 UTC
Permalink
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
Post by Justin Israel
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
Post by Jakob Kousholt
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
main_window_ptr = omui.MQtUtil.mainWindow()
return wrapInstance(long(main_window_ptr), QtWidgets.QWidget)
super(gSubmission, self).__init__(parent)
self.setWindowTitle("Temp")
ui.close()
pass
ui = gSubmission()
ui.show()
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/678a5041-d94d-4403-bb03-78ef3b3d6db4%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/678a5041-d94d-4403-bb03-78ef3b3d6db4%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA01dFt4wSwNKADZ7yG7x40yF9vpuTgN3jjxDQ8ra7fYWw%40mail.gmail.com
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA01dFt4wSwNKADZ7yG7x40yF9vpuTgN3jjxDQ8ra7fYWw%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAEKd6ba9BxzcvBde8j5tBwG4k0Z9TvS%3D4jQD1bVTH88FFXPcTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...