On Sun, Dec 24, 2017, 11:02 PM Nitin Singh <[email protected]> wrote:

>
>
> Hi Guys,
>
> I am having this issue in maya 2018.
>
> I made a UI in pyqt4 designer. I got it all working but for some reason
> Maya launches new version of UI when I run the script. It doesn't close the
> old already opened UI.
> The title of window is different and scaling doesn't work. I have tried to
> solve it for few days but it doesn't work at all, any help will great.
> I have attached the print screen of Maya and designer along with the .UI
> file I am laoding in Maya 2018.
>
>
> ########################################################################################################################################################################
>
> ########################################################################################################################################################################
>
> from maya import cmds
> from maya import mel
> from maya import OpenMayaUI as omui
> import os.path
> import os, glob, time
> import sys
> import getpass
> import maya.mel as mel
>
>
> try:
>   from PySide2.QtCore import *
>   from PySide2.QtGui import *
>   from PySide2.QtWidgets import *
>   from PySide2.QtUiTools import *
>   from shiboken2 import wrapInstance
> except ImportError:
>   from PySide.QtCore import *
>   from PySide.QtGui import *
>   from PySide.QtUiTools import *
>   from shiboken import wrapInstance
>
>
>
>
> mayaMainWindowPtr = omui.MQtUtil.mainWindow()
> mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), QWidget)
>
> class CreateNodeUI(QWidget):
>     def __init__(self, *args, **kwargs):
>         super(CreateNodeUI,self).__init__(*args, **kwargs)
>         self.setParent(mayaMainWindow)
>
>         self.setWindowFlags( Qt.Window )
>         self.initUI()
>
>
>     def initUI(self):
>         loader = QUiLoader()
>         file = QFile("C:/Users/nitin.singh/Desktop/polyReduce_001.ui")
>         file.open(QFile.ReadOnly)
>         self.ui = loader.load(file, parentWidget=self)
>         file.close()
>
>
>
> def main():
>     ui = CreateNodeUI()
>     ui.show()
>     return ui
> if __name__ == '__main__':
>     main()
>

There is no logic in your code that would try and close a previously open
widget when launching a new instance. Common patterns in the Maya commands
api include looking for a window with the same object name and deleting it.
The same could be done in pure Qt if you wanted to check for top level
widgets with the same object name. But you aren't doing either of those
things here.




>
> ########################################################################################################################################################################
> ########################################################################################################################################################################
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/bf1f0625-4a7b-4ba8-b9b1-73abf4b4477e%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/bf1f0625-4a7b-4ba8-b9b1-73abf4b4477e%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0XiQF0sCarTFX9vnuLBa9Azmoh8g%3DGWTGXhZs3T%3DaaDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to