Jump to content

PyQT Window keeps reopening on initial opening of hip file


shadowst17

Recommended Posts

hey guys,

I have a pyQT window that is parented to the main Houdini Window but every time I reopen the scene it's opens the PyQT window again.

 

class Manager(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super(Manager, self).__init__(parent)

        self.setWindowTitle('Manager')
        self.setFixedSize(700, 450)


dialog = Manager()
dialog.setParent(hou.ui.mainQtWindow(), QtCore.Qt.Window)
dialog.show()

According to the docs I need to unparent it in the close event which I have done but it still seems to open. What am I missing?
 

def closeEvent(self, event):
    self.setParent(None)
    self.close()

 

Link to comment
Share on other sites

3 hours ago, shadowst17 said:

What am I missing?

The point of parenting.

You most likely want your UI shown on-demand (i.e clicking a shell button, menu or in python panel). Parenting to the main and not expecting it to show up doesn't make much sense.

3 hours ago, shadowst17 said:

every time I reopen the scene

Which means you have your code executed either in 123/456.py or in hou.session or in HDA's event handlers. Decide when you want this ui to be shown and call dialog.show() from there.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...