def listItemRightClicked(self, QPos): self.listMenu = QtGui.QMenu() self.listMenu.setStyleSheet(""" QMenu { background-color: #313131; border: 1px solid ; } QMenu::item::selected { background-color: #1e1e1e; } """) import_mtl = self.listMenu.addAction("Import Material") import_klf = self.listMenu.addAction("Import Lookfile") import_Lmtl = self.listMenu.addAction("Create Material") delete_mtl = self.listMenu.addAction("Delete Material") self.connect(import_mtl, QtCore.SIGNAL("triggered()"), self.importMtl) self.connect(import_klf, QtCore.SIGNAL("triggered()"), self.importKlf) self.connect(import_Lmtl, QtCore.SIGNAL("triggered()"), self.importLmtl) self.connect(delete_mtl, QtCore.SIGNAL("triggered()"), self.deleteMtl) parentPosition = self.listWidget.mapToGlobal(QtCore.QPoint(0, 0)) self.listMenu.move(parentPosition + QPos) self.listMenu.show()
def __init__(self, *args): """ Initialize and configure the button widget """ Widgets.FilterablePopupButton.__init__(self, *args) self.setFixedHeight(24) self.setFlat(False) self.setSorting(False) QtCore.QObject.connect(self, QtCore.SIGNAL('aboutToShow'), self.__on_aboutToShow) QtCore.QObject.connect(self, QtCore.SIGNAL('itemChosen'), self.__on_itemChosen) self.__pathToDisplayInfo = {} self.__pixmaps = \ {'camera': QtGui.QPixmap(ScenegraphIconManager.GetPixmap('camera')), 'light': QtGui.QPixmap(ScenegraphIconManager.GetPixmap('light'))} self.__scenegraphPixmap = None # Argument is reference to the widget which allows us to get the node if args[0]: self.__node = args[0].getNode() # displayMode will be set to either <DISPLAY_LIGHTS, DISPLAY_CAMERAS, # DISPLAY_LIGHTS | DISPLAY_CAMERAS> if the mode is # DISPLAY_LIGHTS | DISPLAY_CAMERAS, then this indicates that the button # is the big center one at the bottom of the viewports. It will draw # the camera/light name in text, rather than pixmaps as its icon. self.__displayMode = 0 self.setAcceptDrops(True)
def __init__(self, parent): UI4.Tabs.BaseTab.__init__(self, parent) QtGui.QVBoxLayout(self) self.layout().setContentsMargins(4, 4, 4, 4) self._MonitorColorControl__monitorGammaWidget = QT4Color.MonitorGammaWidget( self) self.layout().addWidget(self._MonitorColorControl__monitorGammaWidget, 0) self.connect(self._MonitorColorControl__monitorGammaWidget, QtCore.SIGNAL('valueChanged'), self._MonitorColorControl__monitorChanged_CB) self._MonitorColorControl__colorGradeWidget = QT4Color.ColorGradeWidget( self, title='Primary Color Grade', createChildrenInScroll=True) self.layout().addWidget(self._MonitorColorControl__colorGradeWidget, 10) self.connect(self._MonitorColorControl__colorGradeWidget, QtCore.SIGNAL('valueChanged'), self._MonitorColorControl__gradeChanged_CB) self._MonitorColorControl__updateTimer = QtCore.QTimer(self) self.connect(self._MonitorColorControl__updateTimer, QtCore.SIGNAL('timeout()'), self._MonitorColorControl__timer_CB) Utils.EventModule.RegisterCollapsedHandler( self._MonitorColorControl__monitor_drawStateUpdated_CB, 'monitor_drawStateUpdated', None, True)
def buildWidgets(self, hints): """Creates most of the UI widgets""" label = QtGui.QLabel(" (PyMock)", self) label.setProperty('smallFont', True) label.setProperty('boldFont', True) p = label.palette() p.setColor(QtGui.QPalette.WindowText, QtGui.QColor(255, 200, 0)) p.setColor(QtGui.QPalette.Text, QtGui.QColor(255, 200, 0)) label.setPalette(p) self.layout().addWidget(label) self.layout().addWidget(QtGui.QLabel("mock://")) self.__showEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.layout().addWidget(self.__showEdit) self.layout().addWidget(QtGui.QLabel("/")) self.__shotEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.layout().addWidget(self.__shotEdit) self.layout().addWidget(QtGui.QLabel("/")) self.__assetEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.layout().addWidget(self.__assetEdit) self.layout().addWidget(QtGui.QLabel("/")) self.__versionEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.layout().addWidget(self.__versionEdit) self.connect(self.__showEdit, QtCore.SIGNAL("lostFocus"), self.__lostFocus) self.connect(self.__shotEdit, QtCore.SIGNAL("lostFocus"), self.__lostFocus) self.connect(self.__assetEdit, QtCore.SIGNAL("lostFocus"), self.__lostFocus) self.connect(self.__versionEdit, QtCore.SIGNAL("lostFocus"), self.__lostFocus)
def __init__(self): QtGui.QFrame.__init__(self) QtGui.QHBoxLayout(self) self.__showList = self.__buildListWidget("Show", self.layout()) self.__shotList = self.__buildListWidget("Shot", self.layout()) self.__nameList = self.__buildListWidget("Asset", self.layout()) self.__versionList = self.__buildListWidget("Version", self.layout()) self.connect(self.__showList, QtCore.SIGNAL("itemSelectionChanged()"), self.__updateShow) self.connect(self.__shotList, QtCore.SIGNAL("itemSelectionChanged()"), self.__updateShot) self.connect(self.__nameList, QtCore.SIGNAL("itemSelectionChanged()"), self.__updateAsset) self.connect(self.__versionList, QtCore.SIGNAL("itemSelectionChanged()"), self.__updateVersion) self.__widgetsDict = { "show": self.__showList, "shot": self.__shotList, "name": self.__nameList, "version": self.__versionList, } self.__showList.clear() self.__showList.addItems(_getShows())
def __init__(self): """Builds the initial combose box UI""" QtGui.QFrame.__init__(self) QtGui.QVBoxLayout(self) assetFrame = QtGui.QFrame(self) QtGui.QHBoxLayout(assetFrame) self.layout().addWidget(assetFrame) assetFrame.layout().addWidget(QtGui.QLabel("show:")) self.__showCombobox = QtGui.QComboBox() assetFrame.layout().addWidget(self.__showCombobox) assetFrame.layout().addWidget(QtGui.QLabel("shot:")) self.__shotCombobox = QtGui.QComboBox() assetFrame.layout().addWidget(self.__shotCombobox) assetFrame.layout().addWidget(QtGui.QLabel("asset:")) self.__assetCombobox = QtGui.QComboBox() assetFrame.layout().addWidget(self.__assetCombobox) assetFrame.layout().addWidget(QtGui.QLabel("version:")) self.__versionCombobox = QtGui.QComboBox() assetFrame.layout().addWidget(self.__versionCombobox) self.connect(self.__showCombobox, QtCore.SIGNAL("currentIndexChanged(QString)"), self.__updateShow) self.connect(self.__shotCombobox, QtCore.SIGNAL("currentIndexChanged(QString)"), self.__updateShot) self.connect(self.__assetCombobox, QtCore.SIGNAL("currentIndexChanged(QString)"), self.__updateAsset) self.connect(self.__versionCombobox, QtCore.SIGNAL("currentIndexChanged(QString)"), self.__updateVersion) # Modify the integrated QListViews to lay out the items every time the # view is resized, so that changes in the application font preferences # are correctly reflected for combobox in (self.__showCombobox, self.__shotCombobox, self.__assetCombobox, self.__versionCombobox): combobox.view().setResizeMode(QtGui.QListView.Adjust) self.__sandboxCheckBox = QtGui.QCheckBox('Save to Sandbox', self) self.layout().addWidget(self.__sandboxCheckBox) self.__showCombobox.addItems(_getShows())
def __init__(self, castingSheetNode, parent, node, label, state): QtGui.QAction.__init__(self, label, parent) self.__node = node self.__state = state self.__castingSheetNode = castingSheetNode self.connect(self, QtCore.SIGNAL('triggered(bool)'), self.__go)
def __init__(self, parent, label, parentPath, nodeName, preselectMethod): QtGui.QAction.__init__(self, label, parent) self.__parentPath = parentPath self.__nodeName = nodeName self.__preselectMethod = preselectMethod self.connect(self, QtCore.SIGNAL('triggered(bool)'), self.go)
def buildWidgets(self, hints): """Creates most of the UI widgets""" label = QtGui.QLabel(" (PyMock)", self) label.setProperty('smallFont', True) label.setProperty('boldFont', True) p = label.palette() p.setColor(QtGui.QPalette.WindowText, QtGui.QColor(255, 200, 0)) p.setColor(QtGui.QPalette.Text, QtGui.QColor(255, 200, 0)) label.setPalette(p) self.layout().addWidget(label) self.__protocolLabel = QtGui.QLabel("mock://") self.layout().addWidget(self.__protocolLabel) self.__showEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.layout().addWidget(self.__showEdit) self.layout().addWidget(QtGui.QLabel("/")) self.__shotEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.layout().addWidget(self.__shotEdit) self.layout().addWidget(QtGui.QLabel("/")) self.__assetEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.layout().addWidget(self.__assetEdit) self.layout().addWidget(QtGui.QLabel("/")) self.__versionEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.layout().addWidget(self.__versionEdit) self.connect(self.__showEdit, QtCore.SIGNAL("lostFocus"), self.__lostFocus) self.connect(self.__shotEdit, QtCore.SIGNAL("lostFocus"), self.__lostFocus) self.connect(self.__assetEdit, QtCore.SIGNAL("lostFocus"), self.__lostFocus) self.connect(self.__versionEdit, QtCore.SIGNAL("lostFocus"), self.__lostFocus) # Add a context menu to the protocol label self.__protocolLabel.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.connect( self.__protocolLabel, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.onContextMenu) self.__popupMenu = QtGui.QMenu(self) self.__popupMenu.addAction("Swap protocol", self.onSwapProtocol)
def __init__(self): QtGui.QFrame.__init__(self) QtGui.QHBoxLayout(self) self.__tabWidget = QtGui.QTabWidget(self) self.layout().addWidget(self.__tabWidget) assetTab = QtGui.QFrame(self) QtGui.QHBoxLayout(assetTab) self.__tabWidget.addTab(assetTab, "Asset") self.__showList = self.__buildListWidget("Show", assetTab.layout()) self.__shotList = self.__buildListWidget("Shot", assetTab.layout()) self.__nameList = self.__buildListWidget("Asset", assetTab.layout()) self.__versionList = self.__buildListWidget("Version", assetTab.layout()) self.connect(self.__showList, QtCore.SIGNAL("itemSelectionChanged()"), self.__updateShow) self.connect(self.__shotList, QtCore.SIGNAL("itemSelectionChanged()"), self.__updateShot) self.connect(self.__nameList, QtCore.SIGNAL("itemSelectionChanged()"), self.__updateAsset) self.connect(self.__versionList, QtCore.SIGNAL("itemSelectionChanged()"), self.__updateVersion) sandboxTab = QtGui.QFrame(self) QtGui.QHBoxLayout(sandboxTab) self.__tabWidget.addTab(sandboxTab, "Sandbox") self.__sandboxList = self.__buildListWidget("Sandbox", sandboxTab.layout()) self.__widgetsDict = { "show": self.__showList, "shot": self.__shotList, "name": self.__nameList, "version": self.__versionList, "sandbox": self.__sandboxList, } self.__showList.clear() self.__showList.addItems(_getShows()) self.__sandboxList.addItems(_getSandboxFiles())
def __buildToolbar(self, parent): self.__toolbarLayout = QtGui.QHBoxLayout() parent.layout().addLayout(self.__toolbarLayout) self.__scopePopup = QtGui.QComboBox(parent) self.connect(self.__scopePopup, QtCore.SIGNAL('currentIndexChanged(const QString &)'), self.__refresh) self.__scopePopup.addItems([ 'Selected ShadingNodes', 'All ShadingNodes', 'Upstream of NetworkMaterial' ]) self.__toolbarLayout.addWidget(self.__scopePopup) self.__shadingNetworkMaterialsPopup = QtGui.QComboBox(parent) self.__shadingNetworkMaterialsPopup.addItems( [x.getName() for x in self.__getNetworkMaterials()]) self.connect(self.__shadingNetworkMaterialsPopup, QtCore.SIGNAL('currentIndexChanged(const QString &)'), self.__refresh) self.__shadingNetworkMaterialsPopup.hide() self.__toolbarLayout.addWidget(self.__shadingNetworkMaterialsPopup) self.__toolbarLayout.addStretch() self.__filterField = Widgets.FilterFieldWidget(parent) self.connect(self.__filterField, QtCore.SIGNAL('filterUpdate'), self.__filterUpdate) self.__toolbarLayout.addWidget(self.__filterField) self.__statusBar = QtGui.QLabel('', parent) parent.layout().addWidget(self.__statusBar)
def dropEvent(self, event): """ Handle drop events on the camera/light picker button """ if event.source() == self: return if event.mimeData().hasFormat('scenegraph/paths'): locations = str(event.mimeData().data('scenegraph/paths')).split() if len(locations) == 1: location = locations[0] if _GetLocationType(self.__node, location) in ('light', 'camera'): self.emit(QtCore.SIGNAL('itemChosen'), None, [location, 'camera'])
def setDisplayMode(self, mode): """ Set display mode and corresponding tool tips, icons, etc. """ self.__displayMode = mode if self.__displayMode == (DISPLAY_LIGHTS | DISPLAY_CAMERAS): switchArea = self.getWidgetSwitchArea() self.__topHBox = QtGui.QFrame(switchArea) switchArea.layout().addWidget(self.__topHBox) self.__topHBox.setLayout(QtGui.QHBoxLayout()) spacer = QtGui.QLabel('', self) self.__topHBox.layout().addWidget(spacer) self.__topHBox.layout().setStretchFactor(spacer, 100) self.__lightsCheckbox = QtGui.QCheckBox("Lights", self.__topHBox) self.__lightsCheckbox.setChecked(True) self.__topHBox.layout().addWidget(self.__lightsCheckbox) QtCore.QObject.connect(self.__lightsCheckbox, QtCore.SIGNAL('stateChanged(int)'), self.__on_lightsCheckbox_stateChanged) self.__camerasCheckbox = QtGui.QCheckBox("Cameras", self.__topHBox) self.__camerasCheckbox.setChecked(True) self.__topHBox.layout().addWidget(self.__camerasCheckbox) QtCore.QObject.connect(self.__camerasCheckbox, QtCore.SIGNAL('stateChanged(int)'), self.__on_camerasCheckbox_stateChanged) self.setToolTip("Choose Light or Camera") elif mode & DISPLAY_LIGHTS: self.setScenegraphPixmap(self.__pixmaps['light']) self.setToolTip("Choose Light") else: self.setScenegraphPixmap(self.__pixmaps['camera']) self.setToolTip("Choose Camera")
def __init__(self, parent): BaseTab.__init__(self, parent) # directories self.matlibPath = os.getenv('LIGHTSHADER_MATLIB') self.directory = os.path.join(self.matlibPath, 'material_library') self.resources = os.path.join(self.matlibPath, 'resources') ######################################################### # functions self.buildUI() self.categories() self.populate() # for right click self.listWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.listWidget.connect( self.listWidget, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.listItemRightClicked)
def __init__(self, parent, itemClass): QtGui.QAction.__init__(self, "Assign Attribute File", parent) self.__itemClass = itemClass self.connect(self, QtCore.SIGNAL('triggered(bool)'), self.__go)
def __call__(self, f): for signalText in self.__signalList: self.__target.connect(self.__target, QtCore.SIGNAL(signalText), f) return f
def __init__(self, parent, node): """ Initializes an instance of the class. """ QtGui.QWidget.__init__(self, parent) self.__node = node # Get the SuperTool's parameters rootLocationsParameter = self.__node.getParameter('rootLocations') passesParameter = self.__node.getParameter('passes') saveToParameter = self.__node.getParameter('saveTo') writeMatexOutButton = self.__node.getParameter("writeMaterialxOut") CreateParameterPolicy = UI4.FormMaster.CreateParameterPolicy self.__rootLocationsParameterPolicy = CreateParameterPolicy( None, rootLocationsParameter) self.__passesParameterPolicy = CreateParameterPolicy( None, passesParameter) self.__saveToParameterPolicy = CreateParameterPolicy( None, saveToParameter) self.__writeMatexOutButtonPolicy = CreateParameterPolicy( None, writeMatexOutButton) WidgetFactory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory rootLocationsWidget = WidgetFactory.buildWidget( self, self.__rootLocationsParameterPolicy) passesWidget = WidgetFactory.buildWidget(self, self.__passesParameterPolicy) saveToWidget = WidgetFactory.buildWidget(self, self.__saveToParameterPolicy) writeMatexOutButtonWidget = WidgetFactory.buildWidget( self, self.__writeMatexOutButtonPolicy) # Build a group widget self.group_layout = passesWidget.getPopdownWidget().layout() self.add_button = QtGui.QPushButton("Add New Pass") self.remove_button = QtGui.QPushButton("Remove Last Pass") self.connect(self.add_button, QtCore.SIGNAL('clicked(bool)'), self.onAddButtonPressed) self.connect(self.remove_button, QtCore.SIGNAL('clicked(bool)'), self.onRemoveButtonPressed) # parameter = self.__node.getParameters().getChild("look_origin") # if not parameter: # parameter = self.__node.getParameters().createChildString("look_origin", 'default') # policy = UI4.FormMaster.CreateParameterPolicy(None, parameter) # widget = WidgetFactory.buildWidget(self, policy) if not passesParameter.getChild("default"): passesParameter.createChildString("default", 'default') self.button_layout = QtGui.QHBoxLayout() self.button_layout.addWidget(self.add_button) self.button_layout.addWidget(self.remove_button) self.group_layout.addLayout(self.button_layout) line = QtGui.QFrame() line.setFrameShape(QtGui.QFrame.HLine) line.setFrameShadow(QtGui.QFrame.Sunken) # Create a layout and add the parameter editing widgets to it mainLayout = QtGui.QVBoxLayout() mainLayout.addWidget(rootLocationsWidget) mainLayout.addWidget(passesWidget) mainLayout.addWidget(line) mainLayout.addWidget(saveToWidget) mainLayout.addWidget(writeMatexOutButtonWidget) # Apply the layout to the widget self.setLayout(mainLayout)
def __init__(self, parent, node): """ Initialize the editor and set up UI """ self.__node = node self.__preselectionKey = None self.__lightselectionKey = None self.__editorKey = None self.__updating = False QtGui.QWidget.__init__(self, parent) QtGui.QHBoxLayout(self) self.__treeLayout = QtGui.QVBoxLayout() self.layout().addLayout(self.__treeLayout) # toolbar { self.__treeToolbarLayout = QtGui.QHBoxLayout() self.__treeLayout.addLayout(self.__treeToolbarLayout) self.__addButton = UI4.Widgets.ToolbarButton( 'Add Render Pass', self, UI4.Util.IconManager.GetPixmap('Icons/plus16.png'), rolloverPixmap = UI4.Util.IconManager.GetPixmap( 'Icons/plusHilite16.png')) @connectsignal(self.__addButton, 'clicked()') def addButtonClick(): renderPass = self.__node.addRenderPass('pass1') self.__preselectionKey = hash(renderPass.getShadowBranchNode()) self.__treeToolbarLayout.addWidget(self.__addButton) self.__treeToolbarLayout.addStretch() # } self.__treeStretchBox = UI4.Widgets.StretchBox(self, allowHorizontal=True, allowVertical=True) self.__treeLayout.addWidget(self.__treeStretchBox) ####################################################################### # Set up the treeWidget which represents the passes treeWidget = QT4Widgets.SortableTreeWidget(self.__treeStretchBox) treeWidget.setHeaderLabels(['Name']) treeWidget.setSelectionMode(QtGui.QTreeWidget.ExtendedSelection) treeWidget.setAllColumnsShowFocus(True) treeWidget.setRootIsDecorated(False) treeWidget.header().setResizeMode(QtGui.QHeaderView.ResizeToContents) treeWidget.header().setClickable(False) treeWidget.header().hide() treeWidget.setDraggable(True) ####################################################################### # treeWidget events @connectsignal(treeWidget, 'mousePressEvent') def treeWidgetMousePressEvent(event): """ Handle mouse events """ # Set up context menu (right-click) if event.button() == QtCore.Qt.RightButton: item = treeWidget.itemAt(event.pos()) if not item: return scriptItem = item.getItemData() item.setHiliteColor(QtGui.QColor(32,32,32)) treeWidget.update(treeWidget.indexFromItem(item)) menu = QtGui.QMenu(None) # Add 'Delete' action menu.addAction('Delete', scriptItem.delete) menu.addSeparator() # Add 'View From ShadowBranch Node' action def viewNode(): NodegraphAPI.SetNodeViewed( scriptItem.getShadowBranchNode(), True, exclusive=True) action = menu.addAction('View From ShadowBranch Node',viewNode) action.setIcon(UI4.Util.IconManager.GetIcon( 'Icons/AttributeEditor/blue_snapback.png')) # Show menu pos = event.pos() pos = treeWidget.mapToGlobal(QtCore.QPoint( pos.x(), pos.y())) try: menu.exec_(pos) finally: item.setHiliteColor(None) treeWidget.update(treeWidget.indexFromItem(item)) event.accept() @connectsignal(treeWidget, 'keyPressEvent') def keyPressEvent(event): """ Handle key events """ selectedItems = treeWidget.selectedItems() if not selectedItems: return # Single selection for now scriptItem = selectedItems[0].getItemData() # Delete key: Remove selected items if event.key() == QtCore.Qt.Key_Delete: for item in selectedItems: item.getItemData().delete() # Configure treeWidget callbacks and delegates self.__treeWidget = treeWidget self.__treeWidget.setItemDelegate( self.RenderPassItemDelegate(self.__treeWidget)) self.__handleDragEvents(self.__treeWidget) self.connect(treeWidget, QtCore.SIGNAL('itemSelectionChanged()'), self.__selectionChangedCallback) # Add treeWidget to layout self.__treeStretchBox.layout().addWidget(treeWidget) self.__treeStretchBox.setFixedHeight(160) self.__treeStretchBox.setFixedWidth(120) self.__treeLayout.addStretch() # Layout settings self.__editorMainLayout = QtGui.QVBoxLayout() self.layout().addLayout(self.__editorMainLayout, 10) self.__editorMainLayout.addSpacing(4) self.__editorWidget = QtGui.QWidget(self) self.__editorMainLayout.addWidget(self.__editorWidget) QtGui.QVBoxLayout(self.__editorWidget) self.__editorMainLayout.addStretch() # Create lightSettings widget containing the UI for a light self.__lightSettingsWidget = QtGui.QWidget(self) self.__editorWidget.layout().addWidget(self.__lightSettingsWidget) QtGui.QVBoxLayout(self.__lightSettingsWidget)
def __selectionChangedCallback(self): """ Is called when a pass is selected. This will create the UI for altering the shadowBranch and adding new light passes to another tree list. """ # Don't respond to changes while we update if self.__updating: return selectedItems = self.__treeWidget.selectedItems() # If more than one item is selected, don't display settings if len(selectedItems) != 1: self.__clearEditor() return if not selectedItems: selectedItem = None selectedKey = None else: selectedItem = selectedItems[0] selectedKey = hash(selectedItem.getItemData().getShadowBranchNode()) if self.__editorKey == selectedKey: return self.__editorKey = selectedKey if self.__editorKey is None: return self.__clearEditor() renderPass = selectedItem.getItemData() # Shadow Branch shadowBranchNode = renderPass.getShadowBranchNode() policy = UI4.FormMaster.CreateParameterPolicy(None, shadowBranchNode.getParameters()) # Hints can be used to specify additional options. Setting 'hideTitle' # to true will display the contents of the parameter group directly # rather than showing them as group with a title. policy.getWidgetHints()['hideTitle'] = False self.__editorWidget.layout().addWidget( UI4.FormMaster.ParameterWidgetFactory.buildWidget( self.__editorWidget, policy)) ####################################################################### # Set up Add button and define click action addLightButton = LightPickerButton(self) addLightButton.setDisplayMode(DISPLAY_LIGHTS) addLightButton.setText('Add light') addLightButton.setIcon(UI4.Util.IconManager.GetIcon( 'Icons/plus16.png')) @connectsignal(addLightButton, 'itemChosen') def addButtonClick(value, meta): lightPath = meta[0] type = meta[1] self.addLightPass(lightPath) self.__editorWidget.layout().addWidget(addLightButton) self.__addLightButton = addLightButton # Light list stretch box self.__lightListStretchBox = UI4.Widgets.StretchBox(self, allowHorizontal=False, allowVertical=True) self.__editorWidget.layout().addWidget(self.__lightListStretchBox) ####################################################################### # Set up the lightListWidget which represents the light passes lightListWidget = QT4Widgets.SortableTreeWidget(self.__lightListStretchBox) lightListWidget.setHeaderLabels(['Name']) lightListWidget.setSelectionMode(QtGui.QTreeWidget.ExtendedSelection) lightListWidget.setAllColumnsShowFocus(True) lightListWidget.setRootIsDecorated(False) lightListWidget.setDraggable(True) lightListWidget.setMinimumHeight(100) self.__lightListStretchBox.layout().addWidget(lightListWidget) self.__lightListStretchBox.setMinHeight(100) self.__lightListStretchBox.setFixedHeight(100) ####################################################################### # lightListWidget events # Configure treeWidget that holds passes self.__lightWidget = lightListWidget self.__handleLightListEvents(self.__lightWidget) self.connect(lightListWidget, QtCore.SIGNAL('itemSelectionChanged()'), self.__lightSelectionChangedCallback) self.__editorWidget.layout().addWidget(self.__lightSettingsWidget) self.updateLightList()
def __buildScriptArea(self, parent): self.__presetToolbar = QtGui.QHBoxLayout() parent.layout().addLayout(self.__presetToolbar) self.__presetToolbar.addWidget(QtGui.QLabel('Presets:', parent)) self.__presetsMenu = QtGui.QComboBox(parent) self.__presetsMenu.addItems( self.__presetNames ) self.__presetToolbar.addWidget(self.__presetsMenu) self.__presetLoadButton = QtGui.QPushButton('Load', parent) self.connect(self.__presetLoadButton, QtCore.SIGNAL('clicked()'), self._loadPreset) self.__presetToolbar.addWidget(self.__presetLoadButton) self.__presetToolbar.addStretch() self.__scriptText = TabbableTextEdit(parent) parent.layout().addWidget(self.__scriptText) self.__scriptToolbar = QtGui.QHBoxLayout() parent.layout().addLayout(self.__scriptToolbar) self.__scriptHelp = QT4FormWidgets.InputWidgets.HelpButton( parent) self.__scriptHelp.setAutoDefault(False) self.__scriptHelp.setHelpText(""" local variables: <br> <b>nodeName</b>, <b>paramName</b> these are inputs, changing has no result<br> <b>dstName</b>, <b>dstPage</b> change these values sets exposure<br> <b>hints</b> set fields of this dict to assign widget hints<br> <b>persistentData</b>, a dictionary that is reset each time 'Run Script' is pressed, rather than just for each parameter. Useful if you wish to store data about previously visited parameters, for example. """) self.__scriptToolbar.addWidget(self.__scriptHelp) self.__scriptScope = QtGui.QComboBox(parent) self.__scriptToolbar.addWidget(QtGui.QLabel('Apply Script To', parent)) self.__scriptScope.addItems( ['All Visible Items', 'Selected Visible Items', 'All Items']) self.__scriptToolbar.addWidget(self.__scriptScope) self.__scriptToolbar.addStretch() self.__undoDepth = 0 self.__scriptUndoButton = QtGui.QPushButton('Undo', parent) self.__scriptUndoButton.setEnabled(False) self.connect(self.__scriptUndoButton, QtCore.SIGNAL('clicked()'), self.__undo) self.__scriptToolbar.addWidget(self.__scriptUndoButton) self.__scriptRunButton = QtGui.QPushButton('Run Script', parent) #self.__scriptRunButton.setEnabled(False) self.connect(self.__scriptRunButton, QtCore.SIGNAL('clicked()'), self.__evaluateScript) self.__scriptToolbar.addWidget(self.__scriptRunButton)
def __init__(self, parent, node): node.upgrade() self.__node = node QtGui.QWidget.__init__(self, parent) QtGui.QVBoxLayout(self) self.__frozen = True self.__updateTreeOnIdle = False self.__selectedPonyPolicy = None self.__preselectName = None # location FormWidget locationPolicy = UI4.FormMaster.CreateParameterPolicy( None, self.__node.getParameter('location')) factory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory w = factory.buildWidget(self, locationPolicy) self.layout().addWidget(w) # toolbar self.__toolbarLayout = QtGui.QHBoxLayout() self.layout().addItem(self.__toolbarLayout) self.__addButton = UI4.Widgets.ToolbarButton( 'Add Pony', self, UI4.Util.IconManager.GetPixmap('Icons/plus16.png'), rolloverPixmap=UI4.Util.IconManager.GetPixmap( 'Icons/plusHilite16.png')) self.connect(self.__addButton, QtCore.SIGNAL('clicked()'), self.__addButtonClicked) self.__toolbarLayout.addWidget(self.__addButton) self.__toolbarLayout.addStretch() # tree widget self.__treeStretchBox = UI4.Widgets.StretchBox(self, allowHorizontal=False, allowVertical=True) self.layout().addWidget(self.__treeStretchBox) self.__treeWidget = QT4Widgets.SortableTreeWidget( self.__treeStretchBox) self.__treeWidget.setHeaderLabels(['Name']) self.__treeWidget.setSelectionMode(QtGui.QTreeWidget.SingleSelection) self.__treeWidget.setAllColumnsShowFocus(True) self.__treeWidget.setRootIsDecorated(False) self.__treeWidget.header().setResizeMode( QtGui.QHeaderView.ResizeToContents) self.__treeWidget.header().setClickable(False) self.connect(self.__treeWidget, QtCore.SIGNAL('itemSelectionChanged()'), self.__treeWidgetSelectionChanged) self.connect(self.__treeWidget, QtCore.SIGNAL('keyPressEvent'), self.__treeWidgetKeyPressCallback) self.__treeStretchBox.layout().addWidget(self.__treeWidget) self.__treeStretchBox.setFixedHeight(120) self.__formItemTree = QT4FormWidgets.FormItemTree(self) self.layout().addWidget(self.__formItemTree) self.__updateTreeContents() self.layout().addStretch()
def __init__(self, parent, assetName, itemClass): QtGui.QAction.__init__(self, "Assign Look File", parent) self.__assetName = assetName self.__itemClass = itemClass self.connect(self, QtCore.SIGNAL('triggered(bool)'), self.__go)
def __init__(self, parent, node): QtGui.QAction.__init__(self, "Add Pony", parent) self.__node = node if node: self.connect(self, QtCore.SIGNAL('triggered(bool)'), self.__triggered)
def __buildUI(self): layout = QtGui.QVBoxLayout(self) fileLayout = QtGui.QHBoxLayout() formatLayout = QtGui.QHBoxLayout() filenamePolicy = UI4.FormMaster.CreateParameterPolicy( None, self.__node.getParameter('Filename')) factory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory filenameLine = factory.buildWidget(self, filenamePolicy) fileLayout.addWidget(filenameLine) formatPolicy = UI4.FormMaster.CreateParameterPolicy( None, self.__node.getParameter('Format')) formatParam = factory.buildWidget(self, formatPolicy) BitDepthPolicy = UI4.FormMaster.CreateParameterPolicy( None, self.__node.getParameter('BitDepth')) BitDepthParam = factory.buildWidget(self, BitDepthPolicy) tiledPolicy = UI4.FormMaster.CreateParameterPolicy( None, self.__node.getParameter('Tiled')) tiledParam = factory.buildWidget(self, tiledPolicy) mergePolicy = UI4.FormMaster.CreateParameterPolicy( None, self.__node.getParameter('MergeAOVs')) mergeParam = factory.buildWidget(self, mergePolicy) formatLayout.addWidget(formatParam) formatLayout.addWidget(BitDepthParam) formatLayout.addWidget(tiledParam) overallListLayout = QtGui.QHBoxLayout() globalListLayout = QtGui.QVBoxLayout() sceneListLayout = QtGui.QVBoxLayout() __labelAOV1 = QtGui.QLabel('AOV List') __labelAOV2 = QtGui.QLabel('Scene AOVs') globalListLayout.addWidget(__labelAOV1) sceneListLayout.addWidget(__labelAOV2) self.globalAovsList = QtGui.QListWidget() self.globalAovsList.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) self.globalAovsList.itemDoubleClicked.connect(self.__addButtonClicked) globalListLayout.addWidget(self.globalAovsList) self.scenAovsList = QtGui.QListWidget() self.scenAovsList.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) self.scenAovsList.itemDoubleClicked.connect(self.__removeButtonClicked) self.scenAovsList.itemClicked.connect(self.showNodeParams) sceneListLayout.addWidget(self.scenAovsList) btnLayout = QtGui.QHBoxLayout() __addAovBtn = QtGui.QPushButton('>>') self.connect(__addAovBtn, QtCore.SIGNAL('clicked()'), self.__addButtonClicked) globalListLayout.addWidget(__addAovBtn) customBtn = QtGui.QPushButton('Custom') customBtn.clicked.connect(self.__customClicket) btnLayout.addWidget(customBtn) __removeAovBtn = QtGui.QPushButton('<<') self.connect(__removeAovBtn, QtCore.SIGNAL('clicked()'), self.__removeButtonClicked) btnLayout.addWidget(__removeAovBtn) __scrollWidget = QtGui.QWidget() # __scrollWidget.setMinimumHeight(350) __scrollWidget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.scrollLayout = QtGui.QVBoxLayout(__scrollWidget) scrollArea = QtGui.QScrollArea() scrollArea.setWidgetResizable(True) scrollArea.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) scrollArea.setMinimumHeight(200) scrollArea.setWidget(__scrollWidget) sceneListLayout.addLayout(btnLayout) overallListLayout.addLayout(globalListLayout) overallListLayout.addLayout(sceneListLayout) layout.addLayout(fileLayout) layout.addLayout(formatLayout) layout.addWidget(mergeParam) layout.addWidget(QHLine()) layout.addLayout(overallListLayout) # layout.addLayout(btnLayout) layout.addWidget(scrollArea)