def setMessage(message): from Katana import QtCore, QtGui layoutsMenus = [x for x in QtGui.qApp.topLevelWidgets() if type(x).__name__ == 'LayoutsMenu'] KatanaWindow = layoutsMenus[0].parent().parent() widget = QtGui.QDialog(parent=KatanaWindow) title_layout = QtGui.QVBoxLayout() button_layout = QtGui.QHBoxLayout() title = QtGui.QLabel() button = QtGui.QPushButton() font = QtGui.QFont() font.setPixelSize(16) title.setText(message) title.setFont(font) title.setAlignment(QtCore.Qt.AlignHCenter) button.setText("Confirm!") button.clicked.connect(widget.close) button.setFixedHeight(30) title_layout.addStretch() title_layout.addWidget(title) title_layout.addStretch() button_layout.addStretch() button_layout.addWidget(button) button_layout.addStretch() mainLayout = QtGui.QVBoxLayout() mainLayout.addLayout(title_layout) mainLayout.addLayout(button_layout) widget.setWindowTitle("GafferThreeRigs.Warning") widget.setLayout(mainLayout) widget.setFixedHeight(130) widget.show()
def widget(self): layoutsMenus = [ x for x in QtGui.qApp.topLevelWidgets() if type(x).__name__ == 'LayoutsMenu' ] KatanaWindow = layoutsMenus[0].parent().parent() saveTo = self.getParameter('saveTo').getValue(0) widget = QtGui.QDialog(parent=KatanaWindow) title_layout = QtGui.QVBoxLayout() button_layout = QtGui.QHBoxLayout() title = QtGui.QLabel() button = QtGui.QPushButton() font = QtGui.QFont() font.setPixelSize(16) if saveTo: title.setText("MaterialX baking succeeded!") else: title.setText("Please enter the saving path!") title.setFont(font) title.setAlignment(QtCore.Qt.AlignHCenter) button.setText("Confirm!") button.clicked.connect(widget.close) button.setFixedHeight(30) title_layout.addStretch() title_layout.addWidget(title) title_layout.addStretch() button_layout.addStretch() button_layout.addWidget(button) button_layout.addStretch() mainLayout = QtGui.QVBoxLayout() mainLayout.addLayout(title_layout) mainLayout.addLayout(button_layout) widget.setWindowTitle("MaterialXAssign") widget.setLayout(mainLayout) widget.setFixedHeight(130) widget.show()