def createLayout(w): w.setGeometry(400, 400, 200, 500) '''Util Menu''' w.utilBox = QtGui.QComboBox() w.utilBox.addItems(['Set Attributes', 'Copy', 'Re-arrange', 'Clone Channel Box', 'Lock/Hide toggle']) '''Attribute Box''' w.attributeBox = QtGui.QGroupBox("") w.attributeLayout = QtGui.QVBoxLayout() w.attributeBox.setLayout(w.attributeLayout) w.attributeDisplayWidget = QtGui.QWidget() w.attributeDisplayLayout = QtGui.QHBoxLayout() w.attributeDisplayWidget.setLayout(w.attributeDisplayLayout) w.showAll = QtGui.QCheckBox("Show all") w.reload = qt.iconButton("{0}/refreshing.png".format(iconDir), "Reload Attributes", [25,25]) w.attributeDisplayLayout.addWidget(w.showAll) w.attributeDisplayLayout.addWidget(w.reload) w.attributeList = QtGui.QListWidget() w.attributeList.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) w.attributeList.setDragDropMode(QtGui.QAbstractItemView.NoDragDrop) w.clearSelection = QtGui.QPushButton("Clear selection") w.attributeLayout.addWidget(w.attributeDisplayWidget) w.attributeLayout.addWidget(w.attributeList) w.attributeLayout.addWidget(w.clearSelection) '''Options Box''' w.optionsWidget = QtGui.QWidget() w.optionsLayout = QtGui.QHBoxLayout() w.optionsWidget.setLayout(w.optionsLayout) w.inputField = QtGui.QLineEdit('') w.runButton = QtGui.QPushButton("Set Attributes") w.optionsLayout.addWidget(w.inputField) w.optionsLayout.addWidget(w.runButton) # Create main layout ''' Create the main layouts and add widgets ''' w.mainLayout = QtGui.QVBoxLayout() w.setLayout(w.mainLayout) w.mainLayout.setContentsMargins(2, 2, 2, 2) w.mainLayout.addWidget(w.header) w.mainLayout.addWidget(w.utilBox) w.mainLayout.addWidget(w.attributeBox) w.mainLayout.addWidget(w.optionsWidget) w.mainLayout.addWidget(w.brand) # Create Connections ''' SIGNALS ''' w.showAll.stateChanged.connect(lambda: showAll(w)) w.reload.clicked.connect(lambda: refresh(w)) w.runButton.clicked.connect(lambda: utilsRun(w)) w.utilBox.currentIndexChanged.connect(lambda: utilsChanged(w)) w.clearSelection.clicked.connect(lambda: clearSel(w))
def createLayout(w): w.setGeometry(800, 400, 250, 300) # Your custom widgets come here w.attributeBox = QtGui.QGroupBox("Animation Cycler") w.attributeLayout = QtGui.QVBoxLayout() w.attributeBox.setLayout(w.attributeLayout) w.attributeDisplayWidget = QtGui.QWidget() w.attributeDisplayLayout = QtGui.QHBoxLayout() w.attributeDisplayWidget.setLayout(w.attributeDisplayLayout) w.showAll = QtGui.QCheckBox("Show all") w.reload = qt.iconButton("{0}/refreshing.png".format(iconDir), "Reload Attributes", [25,25]) w.attributeDisplayLayout.addWidget(w.showAll) w.attributeDisplayLayout.addWidget(w.reload) w.attributeList = QtGui.QListWidget() w.attributeList.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) w.attributeList.setDragDropMode(QtGui.QAbstractItemView.NoDragDrop) w.clearSelection = QtGui.QPushButton("Clear selection") w.attributeLayout.addWidget(w.attributeDisplayWidget) w.attributeLayout.addWidget(w.attributeList) w.attributeLayout.addWidget(w.clearSelection) '''Options Box''' w.optionsWidget = QtGui.QWidget() w.optionsLayout = QtGui.QHBoxLayout() w.optionsWidget.setLayout(w.optionsLayout) w.inputField = QtGui.QLineEdit('') w.runButton = QtGui.QPushButton("Set Attributes") w.optionsLayout.addWidget(w.inputField) w.optionsLayout.addWidget(w.runButton) # Create main layout and add your widgets ''' Create the main layouts and add widgets ''' w.mainLayout = QtGui.QVBoxLayout() w.setLayout(w.mainLayout) w.mainLayout.setContentsMargins(2, 2, 2, 2) w.mainLayout.addWidget(w.header) #w.header is the default studio.coop header #w.mainLayout.addWidget(yourWidget) w.mainLayout.addWidget(w.help) #w.help is the default studio.coop footer