def __init__(self):
# set maya main window as parent or it will disappear quickly:
main_window_ptr = omui.MQtUtil.mainWindow()
mayaMainWindow = wrapInstance(long(main_window_ptr), QtGui.QWidget)
super(GUI, self).__init__(mayaMainWindow) # Initialize with mayaMainWindow as a parent
self.resize(250, 150) # Set the size of window
self.center()
self.setWindowTitle('Skrypt - Maya') # Set the title of window
self.setWindowFlags(QtCore.Qt.Tool) # The tool window will always be kept on top of parent (maya_main_window)
# Delete UI on close to avoid winEvent error
# self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
grid = QtGui.QGridLayout() # Create a grid layout
grid_internal = QtGui.QGridLayout()
self.label_info = QtGui.QLabel('Uruchom skrypt wciskajac `start`') # Create a label GUI element
btn_step = QtGui.QPushButton('Krok po kroku') # Create a button
btn_start = QtGui.QPushButton('Wszystkie kroki')
self.connect(btn_start, SIGNAL("clicked()"), self.fn_no_steps) # Connect button to function
self.connect(btn_step, SIGNAL("clicked()"), self.fn_step)
self.times_list = QtGui.QListWidget(self) # Create a list widget
btn_save = QtGui.QPushButton('Zapisz wyniki')
btn_reset = QtGui.QPushButton('Wyczysc scene')
grid.addWidget(self.label_info, 0, 0) # Add the widget to the layout
grid_internal.addWidget(btn_step, 0, 0)
grid_internal.addWidget(btn_start, 0, 1)
grid.addLayout(grid_internal, 1, 0)
grid.addWidget(self.times_list, 2, 0)
grid.addWidget(btn_save, 3, 0)
grid.addWidget(btn_reset, 4, 0)
self.data_table = DataTable()
self.data_table.target_list = self.times_list
self.data_table.target_label = self.label_info
self.connect(btn_reset, SIGNAL("clicked()"), self.data_table.reset)
self.connect(btn_save, SIGNAL("clicked()"), self.data_table.save)
self.setLayout(grid) # Set the layout of the window
评论列表
文章目录