def QCapsulate(self, widget, name, blocking = False, nude = False):
class QuickWindow(QtWidgets.QMainWindow):<EOL><INDENT>class Signals(QtCore.QObject):<EOL><INDENT>close = QtCore.Signal()<EOL>show  = QtCore.Signal()<EOL><DEDENT>def __init__(self, blocking = False, parent = None, nude = False):<EOL><INDENT>super().__init__(parent)<EOL>self.propagate = True <EOL>self.setStyleSheet(style.main_gui)<EOL>if (blocking):<EOL><INDENT>self.setWindowModality(QtCore.Qt.ApplicationModal)<EOL><DEDENT>if (nude):<EOL><INDENT>self.setWindowFlags(QtCore.Qt.Dialog)<EOL><DEDENT>self.signals = self.Signals()<EOL><DEDENT>def closeEvent(self, e):<EOL><INDENT>if (self.propagate):<EOL><INDENT>self.signals.close.emit()<EOL><DEDENT>e.accept()<EOL><DEDENT>def showEvent(self, e):<EOL><INDENT>if (self.propagate):<EOL><INDENT>self.signals.show.emit()<EOL><DEDENT>e.accept()<EOL><DEDENT>def setPropagate(self):<EOL><INDENT>self.propagate = True<EOL><DEDENT>def unSetPropagate(self):<EOL><INDENT>self.propagate = False<EOL><DEDENT><DEDENT>win = QuickWindow(blocking = blocking, nude = nude)<EOL>win.setCentralWidget(widget)<EOL>win.setLayout(QtWidgets.QHBoxLayout())<EOL>win.setWindowTitle(name)<EOL>return win<EOL>
Helper function that encapsulates QWidget into a QMainWindow