instance() returns a QtCore.QCoreApplication object and activeWindow() returns a QtGui.QWidget
On Tue, Apr 3, 2012 at 7:02 PM, Ivan Busquets <[email protected]>wrote: > Ah, that might be the problem right there. > > Don't have access to other QApplication methods at hand, but do you > get anything from the following commands? Or just 'None' again? > > from PySide import QtCore, QtGui > app = QtGui.QApplication > print app.instance(), app.activeWindow() > > > On Tue, Apr 3, 2012 at 6:51 PM, Brogan Ross <[email protected]> wrote: > > Actually, it returns blank :( > > > > > > > > > > > > On Tue, Apr 3, 2012 at 6:45 PM, Ivan Busquets <[email protected]> > > wrote: > >> > >> Sorry to hear that didn't work for you either > >> > >> Not an expert on PyQt/PySide (and much less on Windows :p), but if > >> you're getting a segfault with the above example, it sounds like the > >> parent of your MainWindow widget is not being set correctly. > >> > >> What do you get if you run this? (You should get the title of your > >> main Nuke window) > >> > >> from PySide import QtCore, QtGui > >> app = QtGui.QApplication.activeWindow() > >> print app.windowTitle() > >> > >> > >> > >> > >> On Tue, Apr 3, 2012 at 6:40 PM, Brogan Ross <[email protected]> > wrote: > >> > Oh also, sadly we are in a Windows facility and the Qt.Qindow doesn't > >> > seem > >> > to promote the widget. > >> > And for "In the background", I mean I'd like the window to display but > >> > then > >> > if you click back in the Nuke interface, I'd like the window go behind > >> > nuke. > >> > If I use your example it does that, but I get the crash at close. > >> > > >> > > >> > > >> > > >> > On Tue, Apr 3, 2012 at 6:17 PM, Brogan Ross <[email protected]> > >> > wrote: > >> >> > >> >> For a second there I thought this was gonna work. Well, I mean it > >> >> does. > >> >> It creates a separate window, but it brings me back to the original > >> >> issue > >> >> of Nuke crashing if the window is still open when closing Nuke. > >> >> I'm going to try going make to setting the global variable and see > if I > >> >> can get that working with an onClose callback. > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> On Tue, Apr 3, 2012 at 3:03 PM, Ivan Busquets < > [email protected]> > >> >> wrote: > >> >>> > >> >>> When you say you want it to be "in the background", do you mean that > >> >>> it's stealing focus from the parent's window when it's created? Or > >> >>> that the OS doesn't see it as a separate window? > >> >>> > >> >>> As Nathan said, setting the Qt.Window flag on your Dialog/Widget > >> >>> "should" promote it to its own Window, but I've only tried that in > >> >>> Linux, so I don't know if this is any different on other platforms. > >> >>> > >> >>> As a workaround, if you already have your Widget/Dialog class, you > >> >>> could just make a QMainWindow class as a container, and add your > >> >>> widget to it. I've done this before to re-use a QWidget in different > >> >>> places, for example. > >> >>> > >> >>> The example below is just a quick test, but it might give you an > idea: > >> >>> > >> >>> from PySide import QtCore, QtGui > >> >>> > >> >>> class NewWindow(QtGui.QMainWindow): # This is your MainWindow > >> >>> container > >> >>> def __init__(self, parent=None): > >> >>> super(NewWindow, self).__init__(parent) > >> >>> self.ownWidget = myWidget() # Add your own widget to this > >> >>> window > >> >>> self.setCentralWidget(self.ownWidget) > >> >>> > >> >>> class myWidget(QtGui.QDialog): > >> >>> def __init__(self, parent=None): > >> >>> super(myWidget, self).__init__(parent) > >> >>> self.setLayout(QtGui.QVBoxLayout()) > >> >>> self.textlabel = QtGui.QLabel("some text") > >> >>> self.layout().addWidget(self.textlabel) > >> >>> > >> >>> f = NewWindow(QtGui.QApplication.activeWindow()) # Create a > >> >>> NewWindow instance as a child of Nuke > >> >>> f.show() > >> >>> > >> >>> > >> >>> Hope that helps. > >> >>> > >> >>> Cheers, > >> >>> Ivan > >> >>> > >> >>> On Tue, Apr 3, 2012 at 1:52 PM, Brogan Ross <[email protected]> > >> >>> wrote: > >> >>> > Nathan, that doesn't seem to work for me. It still leaves the > >> >>> > window > >> >>> > on top > >> >>> > of Nuke. > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > > >> >>> > On Tue, Apr 3, 2012 at 10:02 AM, Nathan Rusch > >> >>> > <[email protected]> > >> >>> > wrote: > >> >>> >> > >> >>> >> As I mentioned last night (and after testing to confirm that it > >> >>> >> works), > >> >>> >> you set the Qt.Window flag on your Widget or Dialog (works for > >> >>> >> either). > >> >>> >> > >> >>> >> > >> >>> >> from PySide import QtCore, QtGui > >> >>> >> > >> >>> >> class ExtraNukeWindow(QtGui.QDialog): > >> >>> >> def __init__(self, parent=QtGui.QApplication.activeWindow()): > >> >>> >> super(ExtraNukeWindow, self).__init__(parent) > >> >>> >> self.setWindowFlags(QtCore.Qt.Window) > >> >>> >> > >> >>> >> ExtraNukeWindow().show() > >> >>> >> > >> >>> >> > >> >>> >> -Nathan > >> >>> >> > >> >>> >> -----Original Message----- From: Matthieu Cadet > >> >>> >> Sent: Tuesday, April 03, 2012 9:02 AM > >> >>> >> > >> >>> >> To: Nuke Python discussion > >> >>> >> Subject: Re: [Nuke-python] PySide window makes nuke crash on > close > >> >>> >> > >> >>> >> @Johan, yep i've made made a mistake in my code sample, normally > i > >> >>> >> always set parent=None in the __init__\ > >> >>> >> but if i put like you say : > >> >>> >> > >> >>> >> def __init__(self,parent=QtGui.QApplication.activeWindow()) > >> >>> >> > >> >>> >> Nuke don't crashs!!!! this is exactly what i want, but..., when > set > >> >>> >> the parent to Nuke, > >> >>> >> the QDialog is now part of Nuke window, it's no more a separated > >> >>> >> window ( is not listed > >> >>> >> in the taskbar in Windows, and cannot be accessed by Alt+Tab > switch > >> >>> >> ) > >> >>> >> > >> >>> >> @Brogan, have you found any trick for doing what you want for > your > >> >>> >> custom PySide window? > >> >>> >> > >> >>> >> On Tue, Apr 3, 2012 at 7:05 AM, Nathan Rusch > >> >>> >> <[email protected]> > >> >>> >> wrote: > >> >>> >>> > >> >>> >>> I’m not in front of any functional PySide installs at the > moment, > >> >>> >>> but > >> >>> >>> if > >> >>> >>> I > >> >>> >>> remember correctly, you just need to call > >> >>> >>> self.setWindowFlags(Qt.Window) > >> >>> >>> in > >> >>> >>> your QDialog’s __init__. > >> >>> >>> > >> >>> >>> -Nathan > >> >>> >>> > >> >>> >>> > >> >>> >>> From: Brogan Ross > >> >>> >>> Sent: Monday, April 02, 2012 9:44 PM > >> >>> >>> To: Nuke Python discussion > >> >>> >>> Subject: Re: [Nuke-python] PySide window makes nuke crash on > close > >> >>> >>> > >> >>> >>> I'm in the same boat as, Matthieu. I don't want the dialog to > >> >>> >>> lock > >> >>> >>> up > >> >>> >>> Nuke. I need it to just appear and be available if needed. > >> >>> >>> > >> >>> >>> I was doing things slightly different than Matthieu > >> >>> >>> > >> >>> >>> class TestWindow(QtGui.QWidget): > >> >>> >>> def __init__(self, parent=None): > >> >>> >>> QtGui.QWidget.__init__(self, parent) > >> >>> >>> self.setLayout(QtGui.QVBoxLayout()) > >> >>> >>> self.line = QtGui.QLabel("some text") > >> >>> >>> self.layout() > >> >>> >>> > >> >>> >>> tw = TestWindow() > >> >>> >>> tw.show() > >> >>> >>> > >> >>> >>> > >> >>> >>> However, if I switch it over to QDialog and use activeWindow() > as > >> >>> >>> a > >> >>> >>> Johan > >> >>> >>> said, everything works fine, no crashing. With one exception. > >> >>> >>> The > >> >>> >>> window > >> >>> >>> stays on top of Nuke and I want it to be able to be in the > >> >>> >>> background. > >> >>> >>> > >> >>> >>> Sorry, I'm very new to PyQt/PySide. > >> >>> >>> > >> >>> >>> > >> >>> >>> Thanks > >> >>> >>> > >> >>> >>> > >> >>> >>> > >> >>> >>> > >> >>> >>> > >> >>> >>> > >> >>> >>> ________________________________ > >> >>> >>> _______________________________________________ > >> >>> >>> Nuke-python mailing list > >> >>> >>> [email protected], > >> >>> >>> http://forums.thefoundry.co.uk/ > >> >>> >>> > >> >>> >>> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> >>> >>> > >> >>> >>> > >> >>> >>> _______________________________________________ > >> >>> >>> Nuke-python mailing list > >> >>> >>> [email protected], > >> >>> >>> http://forums.thefoundry.co.uk/ > >> >>> >>> > >> >>> >>> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> >>> >>> > >> >>> >> > >> >>> >> > >> >>> >> > >> >>> >> -- > >> >>> >> Matthieu Cadet > >> >>> >> Compositor Artist & TD, > >> >>> >> nWave Digital > >> >>> >> [email protected] > >> >>> >> _______________________________________________ > >> >>> >> Nuke-python mailing list > >> >>> >> [email protected], > >> >>> >> http://forums.thefoundry.co.uk/ > >> >>> >> > >> >>> >> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> >>> >> _______________________________________________ > >> >>> >> Nuke-python mailing list > >> >>> >> [email protected], > >> >>> >> http://forums.thefoundry.co.uk/ > >> >>> >> > >> >>> >> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> >>> > > >> >>> > > >> >>> > > >> >>> > _______________________________________________ > >> >>> > Nuke-python mailing list > >> >>> > [email protected], > >> >>> > http://forums.thefoundry.co.uk/ > >> >>> > > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> >>> > > >> >>> _______________________________________________ > >> >>> Nuke-python mailing list > >> >>> [email protected], > http://forums.thefoundry.co.uk/ > >> >>> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> >> > >> >> > >> > > >> > > >> > _______________________________________________ > >> > Nuke-python mailing list > >> > [email protected], http://forums.thefoundry.co.uk/ > >> > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> > > >> _______________________________________________ > >> Nuke-python mailing list > >> [email protected], http://forums.thefoundry.co.uk/ > >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > > > > > > _______________________________________________ > > Nuke-python mailing list > > [email protected], http://forums.thefoundry.co.uk/ > > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > _______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
