PySide to PySide2

Thank you for your response
I have change the QtWidgets.WindowStaysOnTopHint with QtCore.Qt

and now i have this error:

  # Error: TypeError: file <maya console> line 43: 'PySide2.QtWidgets.QDialog' called with wrong argument types:
      PySide2.QtWidgets.QDialog(PySide2.QtWidgets.QWidget, Shiboken.ObjectType)
    Supported signatures:
      PySide2.QtWidgets.QDialog(PySide2.QtWidgets.QWidget = NULL, PySide2.QtCore.Qt.WindowFlags = Qt.WindowFlags()) #

Did you just do QtCore.Qt or QtCore.Qt.WindowStaysOnTopHint?

At first i did the QtCore.Qt and the above error appeared
and now i did the QtCore.Qt.WindowStaysOnTopHint

and i have this error:

# Error: AttributeError: file <maya console> line 43: type object 'PySide2.QtCore.Qt' has no attribute 'WindowStaysOnTopHint' #

So at least in my local install of PySide2 this very much exists: PySide2.QtCore.Qt.WindowStaysOnTopHint

You might try:
from PySide2.QtCore import Qt
and then use Qt.WindowStaysOnTopHint in that spot.

I did that and now i have this:
# Error: AttributeError: file <maya console> line 62: 'module' object has no attribute 'Qt' #

Looks like you have a typo. It’s ‘Window’ instead of ‘Windows’

Yeah i saw that typo when i post the reply, i misspelled it here, but inside maya its QtCore.Qt.WindowStaysOnTopHint

It seems like something else is at play then, because I don’t know how that would happen to you.

In a fresh session of Maya, does this work:

from PySide2.QtCore import Qt
print(Qt.WindowStaysOnTopHint)

Yes this is working, no errors
PySide2.QtCore.Qt.WindowType.Qt.WindowStaysOnTopHint

But only these two lines you wrote are working.
The full script is executing correct, but when i am calling it with showUI()
i have the errors

I just checked and PySide2.QtCore.Qt.WindowType.Qt.WindowStaysOnTopHint does not exist. Unless this is explicitly written somewhere in the code…

As bob.w mentioned PySide2.QtCore.Qt.WindowStaysOnTopHint is the correct alias.

Make sure to include this import at the top of your script:

from PySide2 import QtCore

And give this a try:

class bSkinSaverUI(QtWidgets.QDialog):
    def __init__(self, parent=getMayaWindow()):
        super(bSkinSaverUI, self).__init__(parent=parent)
        self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
1 Like

Thank you very much guys, finally it worked!!

1 Like

Hello I test the solution the code looks with no errors, but when I run showUI() , send me a lot of errors :
this is one of many…
showUI()
Error: AttributeError: file line 101: ‘module’ object has no attribute ‘SIGNAL’