def __init__(self, node): # QtModule.QGraphicsItem.__init__(self) self.label_widget = None self.text_widget = None self.headerFont = QtGui.QFont() self.paramsFont = QtGui.QFont() self.x_offset = 10 self.y_offset = 10 self.radius = 10 # node parameters self.showBorder = True self.justify = QtCore.Qt.AlignLeft # left:center:right self.text = '' self.opacity = 0.5 self.bgColor = QtGui.QColor(128, 128, 128) self.textColor = QtGui.QColor(0, 0, 0) self.selectedColor = QtGui.QColor(250, 250, 250) self.node = node if self.node is not None: self.updateGfxNode() (x, y) = self.node.offset self.setPos(x, y) self.PenBorderNormal = QtGui.QPen(QtGui.QBrush(self.textColor), 1.0, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin) self.PenBorderSelected = QtGui.QPen(QtGui.QBrush(self.selectedColor), 2.0, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin) self.bgColor.setAlphaF(self.opacity) self.BrushNodeNormal = QtGui.QBrush(self.bgColor) # flag (new from QT 4.6...) self.setFlag(QtModule.QGraphicsItem.ItemSendsScenePositionChanges) self.setFlag(QtModule.QGraphicsItem.ItemSendsGeometryChanges) #self.setFlag ( QtModule.QGraphicsItem.ItemIsFocusable ) # qt graphics stuff self.setFlag(QtModule.QGraphicsItem.ItemIsMovable) self.setFlag(QtModule.QGraphicsItem.ItemIsSelectable) self.setZValue(1)
def setupUi ( self, FloatWidget ) : # self.widget = FloatWidget self.labels = [] self.controls = [] font = QtGui.QFont () labelFontMetric = QtGui.QFontMetricsF ( font ) label_wi = 0 char_wi = labelFontMetric.width ( 'x' ) array_size = self.widget.param.arraySize if array_size > 0 : label_wi = char_wi * ( len ( str ( array_size - 1 ) ) + 2 ) # [0] for i in range ( self.widget.param.arraySize ) : self.labels.append ( QtModule.QLabel ( FloatWidget ) ) self.labels [ i ].setMinimumSize ( QtCore.QSize ( label_wi, UI.HEIGHT ) ) self.labels [ i ].setMaximumSize ( QtCore.QSize ( label_wi, UI.HEIGHT ) ) self.labels [ i ].setAlignment ( QtCore.Qt.AlignRight ) self.labels [ i ].setText ( '[' + str ( i ) + ']' ) self.controls.append ( QtModule.QLineEdit ( FloatWidget ) ) self.controls [ i ].setMinimumSize ( QtCore.QSize ( UI.FIELD_WIDTH, UI.HEIGHT ) ) self.controls [ i ].setMaximumSize ( QtCore.QSize ( UI.FIELD_WIDTH, UI.HEIGHT ) ) sp = QtModule.QSpacerItem ( 0, 0, UI.SP_EXPAND, UI.SP_MIN ) hl = QtModule.QHBoxLayout () hl.addWidget ( self.labels [ i ] ) hl.addWidget ( self.controls [ i ] ) hl.addItem ( sp ) self.widget.param_vl.addLayout ( hl ) self.connectSignals ( FloatWidget ) QtCore.QMetaObject.connectSlotsByName ( FloatWidget )
def updateNodeParams(self, node): # self.ui.list_inputs.clear() self.ui.list_outputs.clear() linkedFont = QtGui.QFont() linkedFont.setItalic(True) linkedBrush = QtGui.QBrush() linkedBrush.setColor(QtCore.Qt.blue) # setup input params list for param in node.inputParams: item = QtModule.QListWidgetItem(param.label) item.setData(QtCore.Qt.UserRole + 1, QtCore.QVariant(param)) item.setData(QtCore.Qt.UserRole + 2, QtCore.QVariant(node)) if node.isInputParamLinked(param): item.setFont(linkedFont) item.setForeground(linkedBrush) self.ui.list_inputs.addItem(item) # setup output params list for param in node.outputParams: item = QtModule.QListWidgetItem(param.label) item.setData(QtCore.Qt.UserRole + 1, QtCore.QVariant(param)) item.setData(QtCore.Qt.UserRole + 2, QtCore.QVariant(node)) if node.isOutputParamLinked(param): item.setFont(linkedFont) item.setForeground(linkedBrush) self.ui.list_outputs.addItem(item)
def setupUi(self, StringWidget): # self.widget = StringWidget self.labels = [] self.controls = [] font = QtGui.QFont() labelFontMetric = QtGui.QFontMetricsF(font) label_wi = 0 char_wi = labelFontMetric.width('x') array_size = self.widget.param.arraySize if array_size > 0: label_wi = char_wi * (len(str(array_size - 1)) + 2) # [0] for i in range(self.widget.param.arraySize): self.labels.append(QtModule.QLabel(StringWidget)) self.labels[i].setMinimumSize(QtCore.QSize(label_wi, UI.HEIGHT)) self.labels[i].setMaximumSize(QtCore.QSize(label_wi, UI.HEIGHT)) self.labels[i].setAlignment(QtCore.Qt.AlignRight) self.labels[i].setText('[' + str(i) + ']') self.controls.append(QtModule.QLineEdit(StringWidget)) self.controls[i].setMinimumSize( QtCore.QSize(UI.LABEL_WIDTH, UI.HEIGHT)) self.controls[i].setMaximumSize(QtCore.QSize(UI.MAX, UI.HEIGHT)) hl = QtModule.QHBoxLayout() hl.setStretch(0, 0) hl.setStretch(1, 1) hl.addWidget(self.labels[i]) hl.addWidget(self.controls[i]) self.widget.param_vl.addLayout(hl) self.connectSignals(StringWidget) QtCore.QMetaObject.connectSlotsByName(StringWidget)
def setupUi ( self, NormalWidget ) : # self.widget = NormalWidget self.labels = [] self.controls = [] font = QtGui.QFont () labelFontMetric = QtGui.QFontMetricsF ( font ) label_wi = 0 char_wi = labelFontMetric.width ( 'x' ) array_size = self.widget.param.arraySize if array_size > 0 : label_wi = char_wi * ( len ( str ( array_size - 1 ) ) + 2 ) # [0] for i in range ( self.widget.param.arraySize ) : self.labels.append ( QtModule.QLabel ( NormalWidget ) ) self.labels [ i ].setMinimumSize ( QtCore.QSize ( label_wi, UI.HEIGHT ) ) self.labels [ i ].setMaximumSize ( QtCore.QSize ( label_wi, UI.HEIGHT ) ) self.labels [ i ].setAlignment ( QtCore.Qt.AlignRight ) self.labels [ i ].setText ( '[' + str ( i ) + ']' ) elem = [] elem.append ( QtModule.QLineEdit( NormalWidget ) ) elem.append ( QtModule.QLineEdit( NormalWidget ) ) elem.append ( QtModule.QLineEdit( NormalWidget ) ) elem.append ( QtModule.QComboBox ( NormalWidget ) ) elem [ 0 ].setMinimumSize ( QtCore.QSize ( UI.FIELD_WIDTH, UI.HEIGHT ) ) elem [ 1 ].setMinimumSize ( QtCore.QSize ( UI.FIELD_WIDTH, UI.HEIGHT ) ) elem [ 2 ].setMinimumSize ( QtCore.QSize ( UI.FIELD_WIDTH, UI.HEIGHT ) ) elem [ 0 ].setMaximumSize ( QtCore.QSize ( UI.FIELD_WIDTH, UI.HEIGHT ) ) elem [ 1 ].setMaximumSize ( QtCore.QSize ( UI.FIELD_WIDTH, UI.HEIGHT ) ) elem [ 2 ].setMaximumSize ( QtCore.QSize ( UI.FIELD_WIDTH, UI.HEIGHT ) ) elem [ 3 ].setEditable ( False ) elem [ 3 ].setMaximumSize ( QtCore.QSize( UI.MAX, UI.COMBO_HEIGHT ) ) for label in VALID_RSL_SPACES : elem [ 3 ].addItem ( label ) space = self.widget.param.spaceArray [ i ] if space != None : elem [ 3 ].setCurrentIndex ( elem [ 3 ].findText ( space ) ) self.controls.append ( elem ) sp = QtModule.QSpacerItem ( 0, 0, UI.SP_EXPAND, UI.SP_MIN ) hl = QtModule.QHBoxLayout () hl.addWidget ( self.labels [ i ] ) hl.addWidget ( elem [ 0 ] ) hl.addWidget ( elem [ 1 ] ) hl.addWidget ( elem [ 2 ] ) hl.addWidget ( elem [ 3 ] ) hl.addItem ( sp ) self.widget.param_vl.addLayout ( hl ) self.connectSignals ( NormalWidget ) QtCore.QMetaObject.connectSlotsByName ( NormalWidget )
def setupUi(self, ColorWidget): # print('>> Ui_ColorWidget_array.setupUi (%s)' % ColorWidget.param.label) self.widget = ColorWidget self.labels = [] self.controls = [] font = QtGui.QFont() labelFontMetric = QtGui.QFontMetricsF(font) label_wi = 0 char_wi = labelFontMetric.width('x') array_size = self.widget.param.arraySize if array_size > 0: label_wi = char_wi * (len(str(array_size - 1)) + 2) # [0] for i in range(self.widget.param.arraySize): self.labels.append(QtModule.QLabel(ColorWidget)) self.labels[i].setMinimumSize(QtCore.QSize(label_wi, UI.HEIGHT)) self.labels[i].setMaximumSize(QtCore.QSize(label_wi, UI.HEIGHT)) self.labels[i].setAlignment(QtCore.Qt.AlignRight) self.labels[i].setText('[' + str(i) + ']') elem = [] elem.append(ColorField(ColorWidget, self.widget.param.value[i], i)) elem.append(QtModule.QComboBox(ColorWidget)) elem[1].setEditable(False) elem[1].setMaximumSize(QtCore.QSize(UI.MAX, UI.COMBO_HEIGHT)) for label in VALID_RSL_COLOR_SPACES: elem[1].addItem(label) space = self.widget.param.spaceArray[i] if space != None: elem[1].setCurrentIndex(elem[1].findText(space)) self.controls.append(elem) sp = QtModule.QSpacerItem(0, 0, UI.SP_EXPAND, UI.SP_MIN) hl = QtModule.QHBoxLayout() hl.setContentsMargins(UI.SPACING, UI.SPACING, UI.SPACING, UI.SPACING) hl.setSpacing(UI.SPACING) hl.addWidget(self.labels[i]) hl.addWidget(elem[0]) hl.addWidget(elem[1]) hl.addItem(sp) self.widget.param_vl.addLayout(hl) self.connectSignals(ColorWidget) QtCore.QMetaObject.connectSlotsByName(ColorWidget)
def buildGui(self): # build the gui created with QtDesigner import sys self.ui = Ui_meRendererSetup() self.ui.setupUi(self) font = QtGui.QFont() if (sys.platform == 'win32'): # Runing on windows, override font sizes from Designer to default font.setPointSize(8) else: font.setPointSize(10) self.ui.labelPreset.setFont(font) self.ui.listPreset.setFont(font) self.ui.newButton.setFont(font) self.ui.deleteButton.setFont(font) self.ui.cancelButton.setFont(font) self.ui.okButton.setFont(font) self.ui.saveButton.setFont(font) self.ui.tabs.setFont(font) self.ui.labelName.setFont(font) self.ui.labelCmd.setFont(font) self.ui.labelFlags.setFont(font) self.ui.labelCompiler.setFont(font) self.ui.labelShaderInfo.setFont(font) self.ui.labelDefines.setFont(font) self.ui.labelShaderExt.setFont(font) self.ui.labelShaderExt.setFont(font) self.ui.labelTexMake.setFont(font) self.ui.labelTexInfo.setFont(font) self.ui.labelTexViewer.setFont(font) self.ui.labelTexExt.setFont(font) self.labelsReady = False for label in self.rendererPreset.getPresetNames(): self.ui.listPreset.addItem(label) self.labelsReady = True presetName = self.rendererPreset.getCurrentPresetName() idx = self.ui.listPreset.findText(presetName) print ">> buildGui:: set current renderer to: %s (%d)" % (presetName, idx) #self.ui.listPreset.setCurrentIndex ( -1 ) self.ui.listPreset.setCurrentIndex(idx)
def onNodeChanged(self): # if DEBUG_MODE: print '>> ExportShaderDialog.onNodeChanged' self.disconnectSignals() item = self.ui.list_nodes.currentItem() if not usePyQt5: node = item.data(QtCore.Qt.UserRole + 1).toPyObject() else: node = item.data(QtCore.Qt.UserRole + 1) print '* (%s) selected' % node.label self.ui.node.setNode(node) self.ui.prop_tabWidget.setCurrentIndex(0) if self.ui.list_nodes.currentRow() != 1: self.updateNodeParams(node) self.ui.list_inputs.clear() self.ui.list_outputs.clear() linkedFont = QtGui.QFont() linkedFont.setItalic(True) linkedBrush = QtGui.QBrush() linkedBrush.setColor(QtCore.Qt.blue) # setup input params list for param in node.inputParams: item = QtModule.QListWidgetItem(param.label) item.setData(QtCore.Qt.UserRole + 1, QtCore.QVariant(param)) item.setData(QtCore.Qt.UserRole + 2, QtCore.QVariant(node)) if node.isInputParamLinked(param): item.setFont(linkedFont) item.setForeground(linkedBrush) self.ui.list_inputs.addItem(item) # setup output params list for param in node.outputParams: item = QtModule.QListWidgetItem(param.label) item.setData(QtCore.Qt.UserRole + 1, QtCore.QVariant(param)) item.setData(QtCore.Qt.UserRole + 2, QtCore.QVariant(node)) if node.isOutputParamLinked(param): item.setFont(linkedFont) item.setForeground(linkedBrush) self.ui.list_outputs.addItem(item) else: self.updateComputedParams() self.connectSignals()
def setupMenuBar(self): # override font for menu from Designer's settings to system default import sys font = QtGui.QFont() if (sys.platform == 'win32'): # Runing on windows, override font sizes from Designer to default font.setPointSize(8) elif (sys.platform == 'darwin'): font.setPointSize(10) self.ui.menubar.setFont(font) self.ui.menuFile.setFont(font) self.ui.menuEdit.setFont(font) self.ui.menuCommand.setFont(font) self.ui.menuWindow.setFont(font) self.ui.menuHelp.setFont(font) self.buildRecentProjectsMenu() self.buildRecentNetworksMenu()
def setNodeCode(self, editNodeCode, mode='SL', readOnly=False): # self.editNodeCode = editNodeCode if self.editNodeCode is not None: code = self.editNodeCode doc = QtGui.QTextDocument() font = QtGui.QFont('Monospace') font.setFixedPitch(True) font.setPointSize(UI.FONT_HEIGHT) codeSyntax = CodeSyntaxHighlighter(doc, mode) self.ui.textEdit.setDocument(doc) self.ui.textEdit.setTabStopWidth(UI.TAB_SIZE) self.ui.textEdit.setFont(font) self.ui.textEdit.setLineWrapMode(QtModule.QTextEdit.NoWrap) self.ui.textEdit.setReadOnly(readOnly) else: code = '' self.ui.textEdit.setPlainText(code)
def __init__(self, text, param=None, bgFill=True): # QtModule.QGraphicsItem.__init__(self) self.text = text self.param = param self.help = None self.normalColor = QtGui.QColor(0, 0, 0) self.selectedColor = QtGui.QColor(240, 240, 240) self.alternateColor = QtGui.QColor(250, 170, 0) self.bgColor = QtGui.QColor(140, 140, 140) self.PenNormal = QtGui.QPen(self.normalColor) self.PenSelected = QtGui.QPen(self.selectedColor) self.PenAlternate = QtGui.QPen(self.alternateColor) self.bgBrush = QtGui.QBrush(self.bgColor) self.pen = self.PenNormal self.font = QtGui.QFont() self.justify = QtCore.Qt.AlignLeft self.bgFill = bgFill self.selected = False self.alternate = False self.bold = False self.italic = False self.editable = False self.processEvents = False self.setFlag(QtModule.QGraphicsItem.ItemIsMovable, False) self.setFlag(QtModule.QGraphicsItem.ItemIsSelectable, False) self.rect = QtCore.QRectF()
def buildGui(self): # label = QtModule.QLabel() label.setMinimumSize(QtCore.QSize(UI.NODE_LABEL_WIDTH, UI.HEIGHT)) label.setMaximumSize(QtCore.QSize(UI.NODE_LABEL_WIDTH, UI.HEIGHT)) font = QtGui.QFont() label.setFont(font) #label.setAlignment(QtCore.Qt.AlignCenter) label.setText('Label') self.nameEdit = QtModule.QLineEdit() self.nameEdit.setMaximumSize(QtCore.QSize(UI.MAX, UI.HEIGHT)) self.nameEdit.setEnabled(False) self.showConnectButton = QtModule.QToolButton(self) sizePolicy = QtModule.QSizePolicy(QtModule.QSizePolicy.Fixed, QtModule.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(20) sizePolicy.setVerticalStretch(20) sizePolicy.setHeightForWidth( self.showConnectButton.sizePolicy().hasHeightForWidth()) self.showConnectButton.setSizePolicy(sizePolicy) self.showConnectButton.setMaximumSize(QtCore.QSize(20, 20)) icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(':/show_icons/resources/show_connect.png'), QtGui.QIcon.Normal, QtGui.QIcon.On) self.showConnectButton.setIcon(icon) self.showConnectButton.setAutoRaise(False) self.showConnectButton.setCheckable(True) self.showConnectButton.setChecked(self.showConnected) self.showConnectButton.setToolTip('Show connected parameters') #self.showConnectButton.setIconSize ( QtCore.QSize ( 16, 16 ) ) self.showConnectButton.setObjectName('showConnectButton') headerLayout = QtModule.QHBoxLayout() headerLayout.setSpacing(UI.SPACING) headerLayout.setContentsMargins(UI.SPACING, UI.SPACING, UI.SPACING, UI.SPACING) headerLayout.setStretch(1, 1) headerLayout.addWidget(label) headerLayout.addWidget(self.nameEdit) headerLayout.addWidget(self.showConnectButton) mainLayout = QtModule.QVBoxLayout() mainLayout.addLayout(headerLayout) self.params_tabs = QtModule.QTabWidget(self) self.inputParamListTab = NodeParamListTab( self, self.gfxNode, isInput=True, showConnected=self.showConnected) self.params_tabs.addTab(self.inputParamListTab, 'Input') self.outputParamListTab = NodeParamListTab( self, self.gfxNode, isInput=False, showConnected=self.showConnected) self.params_tabs.addTab(self.outputParamListTab, 'Output') self.params_tabs.setCurrentIndex(0) mainLayout.addWidget(self.params_tabs) self.setLayout(mainLayout)
def __init__ ( self, node ) : # QtModule.QGraphicsItem.__init__ ( self ) self.node = node self.header = {} self.outputParamLabels = [] self.inputParamLabels = [] self.outputConnectors = [] self.inputConnectors = [] self.headerFont = QtGui.QFont () self.paramsFont = QtGui.QFont () self.x_offset = 10 self.y_offset = 10 self.radius = UI.NODE_RADIUS self.swatchSize = UI.SWATCH_SIZE self.hasSwatch = False self.shadow_offset = UI.SHADOW_OFFSET self.shadow_opacity = UI.SHADOW_OPACITY self.normalColor = QtGui.QColor ( 0, 0, 0 ) self.selectedColor = QtGui.QColor ( 250, 250, 250 ) alternateColor = QtGui.QColor ( 240, 140, 0 ) self.bgColor = self.get_bg_color () self.shadowColor = QtGui.QColor ( 0, 0, 0 ) self.shadowColor.setAlphaF ( self.shadow_opacity ) self.PenBorderNormal = QtGui.QPen( QtGui.QBrush ( self.normalColor ), 1.0, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin ) self.PenBorderSelected = QtGui.QPen( QtGui.QBrush ( self.selectedColor ), 2.0, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin ) self.PenNodeShaderParam = QtGui.QPen( QtGui.QColor( 250, 250, 250 ) ) self.BrushNodeNormal = QtGui.QBrush ( self.bgColor ) self.BrushShadow = QtGui.QBrush ( self.shadowColor ) self.PenShadow = QtGui.QPen ( self.shadowColor ) self.collapse = None # 'input' 'output' 'all' if self.node is not None : self.connectSignals () self.updateGfxNode () ( x, y ) = self.node.offset self.setPos ( x, y ) # flag (new from QT 4.6...) self.setFlag ( QtModule.QGraphicsItem.ItemSendsScenePositionChanges ) self.setFlag ( QtModule.QGraphicsItem.ItemSendsGeometryChanges ) # qt graphics stuff self.setFlag ( QtModule.QGraphicsItem.ItemIsMovable ) self.setFlag ( QtModule.QGraphicsItem.ItemIsSelectable ) self.setZValue ( 1 )
def setupUi(self, meRendererSetup): meRendererSetup.setObjectName("meRendererSetup") meRendererSetup.resize(447, 258) self.gridLayout = QtModule.QGridLayout(meRendererSetup) self.gridLayout.setObjectName("gridLayout") self.horizontalLayout = QtModule.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.labelPreset = QtModule.QLabel(meRendererSetup) self.labelPreset.setMinimumSize(QtCore.QSize(80, 0)) self.labelPreset.setMaximumSize(QtCore.QSize(16777215, 16777215)) font = QtGui.QFont() font.setFamily("MS Shell Dlg 2") font.setPointSize(10) self.labelPreset.setFont(font) self.labelPreset.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelPreset.setObjectName("labelPreset") self.horizontalLayout.addWidget(self.labelPreset) self.listPreset = QtModule.QComboBox(meRendererSetup) self.listPreset.setMinimumSize(QtCore.QSize(150, 0)) font = QtGui.QFont() font.setPointSize(10) self.listPreset.setFont(font) self.listPreset.setEditable(False) self.listPreset.setInsertPolicy(QtModule.QComboBox.InsertAtBottom) self.listPreset.setSizeAdjustPolicy(QtModule.QComboBox.AdjustToContentsOnFirstShow) self.listPreset.setFrame(True) self.listPreset.setObjectName("listPreset") self.horizontalLayout.addWidget(self.listPreset) spacerItem = QtModule.QSpacerItem(138, 20, QtModule.QSizePolicy.Expanding, QtModule.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) self.btnlt = QtModule.QHBoxLayout() self.btnlt.setSpacing(6) self.btnlt.setObjectName("btnlt") self.newButton = QtModule.QPushButton(meRendererSetup) self.newButton.setMinimumSize(QtCore.QSize(60, 0)) font = QtGui.QFont() font.setPointSize(8) self.newButton.setFont(font) self.newButton.setAutoDefault(False) self.newButton.setObjectName("newButton") self.btnlt.addWidget(self.newButton) self.deleteButton = QtModule.QPushButton(meRendererSetup) self.deleteButton.setMinimumSize(QtCore.QSize(60, 0)) font = QtGui.QFont() font.setPointSize(8) self.deleteButton.setFont(font) self.deleteButton.setAutoDefault(False) self.deleteButton.setObjectName("deleteButton") self.btnlt.addWidget(self.deleteButton) self.saveButton = QtModule.QPushButton(meRendererSetup) self.saveButton.setMinimumSize(QtCore.QSize(60, 0)) font = QtGui.QFont() font.setPointSize(8) self.saveButton.setFont(font) self.saveButton.setAutoDefault(False) self.saveButton.setObjectName("saveButton") self.btnlt.addWidget(self.saveButton) spacerItem1 = QtModule.QSpacerItem(40, 20, QtModule.QSizePolicy.Expanding, QtModule.QSizePolicy.Minimum) self.btnlt.addItem(spacerItem1) self.cancelButton = QtModule.QPushButton(meRendererSetup) self.cancelButton.setMinimumSize(QtCore.QSize(80, 0)) font = QtGui.QFont() font.setPointSize(8) self.cancelButton.setFont(font) self.cancelButton.setAutoDefault(False) self.cancelButton.setObjectName("cancelButton") self.btnlt.addWidget(self.cancelButton) self.okButton = QtModule.QPushButton(meRendererSetup) self.okButton.setMinimumSize(QtCore.QSize(80, 0)) font = QtGui.QFont() font.setPointSize(8) self.okButton.setFont(font) self.okButton.setAutoDefault(True) self.okButton.setDefault(True) self.okButton.setObjectName("okButton") self.btnlt.addWidget(self.okButton) self.btnlt.setStretch(3, 1) self.gridLayout.addLayout(self.btnlt, 5, 0, 1, 1) self.tabs = QtModule.QTabWidget(meRendererSetup) self.tabs.setMinimumSize(QtCore.QSize(0, 140)) self.tabs.setMaximumSize(QtCore.QSize(16777215, 140)) font = QtGui.QFont() font.setPointSize(10) font.setWeight(50) font.setItalic(False) font.setBold(False) self.tabs.setFont(font) self.tabs.setLayoutDirection(QtCore.Qt.LeftToRight) self.tabs.setAutoFillBackground(True) self.tabs.setTabPosition(QtModule.QTabWidget.North) self.tabs.setTabShape(QtModule.QTabWidget.Rounded) self.tabs.setElideMode(QtCore.Qt.ElideLeft) self.tabs.setUsesScrollButtons(False) self.tabs.setDocumentMode(False) self.tabs.setTabsClosable(False) self.tabs.setObjectName("tabs") self.tab1 = QtModule.QWidget() self.tab1.setObjectName("tab1") self.verticalLayout_2 = QtModule.QVBoxLayout(self.tab1) self.verticalLayout_2.setSpacing(2) self.verticalLayout_2.setContentsMargins(2, 4, 2, 2) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout_2 = QtModule.QHBoxLayout() self.horizontalLayout_2.setSpacing(4) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.labelName = QtModule.QLabel(self.tab1) self.labelName.setMinimumSize(QtCore.QSize(80, 0)) self.labelName.setBaseSize(QtCore.QSize(150, 0)) font = QtGui.QFont() font.setPointSize(10) self.labelName.setFont(font) self.labelName.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelName.setObjectName("labelName") self.horizontalLayout_2.addWidget(self.labelName) self.lineName = QtModule.QLineEdit(self.tab1) self.lineName.setFrame(True) self.lineName.setObjectName("lineName") self.horizontalLayout_2.addWidget(self.lineName) self.horizontalLayout_2.setStretch(1, 1) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtModule.QHBoxLayout() self.horizontalLayout_3.setSpacing(4) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.labelCmd = QtModule.QLabel(self.tab1) self.labelCmd.setMinimumSize(QtCore.QSize(80, 0)) self.labelCmd.setBaseSize(QtCore.QSize(150, 0)) font = QtGui.QFont() font.setPointSize(10) self.labelCmd.setFont(font) self.labelCmd.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelCmd.setObjectName("labelCmd") self.horizontalLayout_3.addWidget(self.labelCmd) self.lineCmd = QtModule.QLineEdit(self.tab1) self.lineCmd.setObjectName("lineCmd") self.horizontalLayout_3.addWidget(self.lineCmd) self.horizontalLayout_3.setStretch(1, 1) self.verticalLayout_2.addLayout(self.horizontalLayout_3) self.horizontalLayout_4 = QtModule.QHBoxLayout() self.horizontalLayout_4.setSpacing(4) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.labelFlags = QtModule.QLabel(self.tab1) self.labelFlags.setMinimumSize(QtCore.QSize(80, 0)) self.labelFlags.setBaseSize(QtCore.QSize(150, 0)) font = QtGui.QFont() font.setPointSize(10) self.labelFlags.setFont(font) self.labelFlags.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelFlags.setObjectName("labelFlags") self.horizontalLayout_4.addWidget(self.labelFlags) self.lineFlags = QtModule.QLineEdit(self.tab1) self.lineFlags.setObjectName("lineFlags") self.horizontalLayout_4.addWidget(self.lineFlags) self.horizontalLayout_4.setStretch(1, 1) self.verticalLayout_2.addLayout(self.horizontalLayout_4) spacerItem2 = QtModule.QSpacerItem(20, 26, QtModule.QSizePolicy.Minimum, QtModule.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem2) self.tabs.addTab(self.tab1, "") self.tab2 = QtModule.QWidget() self.tab2.setObjectName("tab2") self.verticalLayout = QtModule.QVBoxLayout(self.tab2) self.verticalLayout.setSpacing(2) self.verticalLayout.setContentsMargins(2, 4, 2, 2) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_5 = QtModule.QHBoxLayout() self.horizontalLayout_5.setSpacing(4) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.labelCompiler = QtModule.QLabel(self.tab2) self.labelCompiler.setMinimumSize(QtCore.QSize(80, 0)) font = QtGui.QFont() font.setPointSize(10) self.labelCompiler.setFont(font) self.labelCompiler.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelCompiler.setObjectName("labelCompiler") self.horizontalLayout_5.addWidget(self.labelCompiler) self.lineCompiler = QtModule.QLineEdit(self.tab2) self.lineCompiler.setObjectName("lineCompiler") self.horizontalLayout_5.addWidget(self.lineCompiler) self.horizontalLayout_5.setStretch(1, 1) self.verticalLayout.addLayout(self.horizontalLayout_5) self.horizontalLayout_6 = QtModule.QHBoxLayout() self.horizontalLayout_6.setSpacing(4) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.labelShaderInfo = QtModule.QLabel(self.tab2) self.labelShaderInfo.setMinimumSize(QtCore.QSize(80, 0)) font = QtGui.QFont() font.setPointSize(10) self.labelShaderInfo.setFont(font) self.labelShaderInfo.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelShaderInfo.setObjectName("labelShaderInfo") self.horizontalLayout_6.addWidget(self.labelShaderInfo) self.lineShaderInfo = QtModule.QLineEdit(self.tab2) self.lineShaderInfo.setObjectName("lineShaderInfo") self.horizontalLayout_6.addWidget(self.lineShaderInfo) self.horizontalLayout_6.setStretch(1, 1) self.verticalLayout.addLayout(self.horizontalLayout_6) self.horizontalLayout_7 = QtModule.QHBoxLayout() self.horizontalLayout_7.setSpacing(4) self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.labelDefines = QtModule.QLabel(self.tab2) self.labelDefines.setMinimumSize(QtCore.QSize(80, 0)) font = QtGui.QFont() font.setPointSize(10) self.labelDefines.setFont(font) self.labelDefines.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelDefines.setObjectName("labelDefines") self.horizontalLayout_7.addWidget(self.labelDefines) self.lineDefines = QtModule.QLineEdit(self.tab2) sizePolicy = QtModule.QSizePolicy(QtModule.QSizePolicy.Expanding, QtModule.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineDefines.sizePolicy().hasHeightForWidth()) self.lineDefines.setSizePolicy(sizePolicy) self.lineDefines.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.lineDefines.setObjectName("lineDefines") self.horizontalLayout_7.addWidget(self.lineDefines) self.horizontalLayout_7.setStretch(1, 1) self.verticalLayout.addLayout(self.horizontalLayout_7) self.horizontalLayout_8 = QtModule.QHBoxLayout() self.horizontalLayout_8.setSpacing(4) self.horizontalLayout_8.setSizeConstraint(QtModule.QLayout.SetNoConstraint) self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.labelShaderExt = QtModule.QLabel(self.tab2) sizePolicy = QtModule.QSizePolicy(QtModule.QSizePolicy.Fixed, QtModule.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.labelShaderExt.sizePolicy().hasHeightForWidth()) self.labelShaderExt.setSizePolicy(sizePolicy) self.labelShaderExt.setMinimumSize(QtCore.QSize(80, 0)) self.labelShaderExt.setMaximumSize(QtCore.QSize(16777215, 16777215)) font = QtGui.QFont() font.setPointSize(10) self.labelShaderExt.setFont(font) self.labelShaderExt.setLayoutDirection(QtCore.Qt.LeftToRight) self.labelShaderExt.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelShaderExt.setObjectName("labelShaderExt") self.horizontalLayout_8.addWidget(self.labelShaderExt) self.lineShaderExt = QtModule.QLineEdit(self.tab2) sizePolicy = QtModule.QSizePolicy(QtModule.QSizePolicy.Fixed, QtModule.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineShaderExt.sizePolicy().hasHeightForWidth()) self.lineShaderExt.setSizePolicy(sizePolicy) self.lineShaderExt.setMinimumSize(QtCore.QSize(50, 0)) self.lineShaderExt.setMaximumSize(QtCore.QSize(50, 16777215)) self.lineShaderExt.setLayoutDirection(QtCore.Qt.LeftToRight) self.lineShaderExt.setAutoFillBackground(False) self.lineShaderExt.setObjectName("lineShaderExt") self.horizontalLayout_8.addWidget(self.lineShaderExt) spacerItem3 = QtModule.QSpacerItem(40, 20, QtModule.QSizePolicy.Expanding, QtModule.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem3) self.horizontalLayout_8.setStretch(2, 1) self.verticalLayout.addLayout(self.horizontalLayout_8) spacerItem4 = QtModule.QSpacerItem(20, 0, QtModule.QSizePolicy.Minimum, QtModule.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem4) self.tabs.addTab(self.tab2, "") self.tab3 = QtModule.QWidget() self.tab3.setObjectName("tab3") self.verticalLayout_3 = QtModule.QVBoxLayout(self.tab3) self.verticalLayout_3.setSpacing(2) self.verticalLayout_3.setContentsMargins(2, 4, 2, 2) self.verticalLayout_3.setObjectName("verticalLayout_3") self.horizontalLayout_9 = QtModule.QHBoxLayout() self.horizontalLayout_9.setSpacing(4) self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.labelTexMake = QtModule.QLabel(self.tab3) self.labelTexMake.setMinimumSize(QtCore.QSize(80, 0)) self.labelTexMake.setMaximumSize(QtCore.QSize(16777215, 16777215)) font = QtGui.QFont() font.setPointSize(10) self.labelTexMake.setFont(font) self.labelTexMake.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelTexMake.setObjectName("labelTexMake") self.horizontalLayout_9.addWidget(self.labelTexMake) self.lineTexMake = QtModule.QLineEdit(self.tab3) self.lineTexMake.setObjectName("lineTexMake") self.horizontalLayout_9.addWidget(self.lineTexMake) self.verticalLayout_3.addLayout(self.horizontalLayout_9) self.horizontalLayout_10 = QtModule.QHBoxLayout() self.horizontalLayout_10.setSpacing(4) self.horizontalLayout_10.setObjectName("horizontalLayout_10") self.labelTexInfo = QtModule.QLabel(self.tab3) self.labelTexInfo.setMinimumSize(QtCore.QSize(80, 0)) font = QtGui.QFont() font.setPointSize(10) self.labelTexInfo.setFont(font) self.labelTexInfo.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelTexInfo.setObjectName("labelTexInfo") self.horizontalLayout_10.addWidget(self.labelTexInfo) self.lineTexInfo = QtModule.QLineEdit(self.tab3) self.lineTexInfo.setObjectName("lineTexInfo") self.horizontalLayout_10.addWidget(self.lineTexInfo) self.verticalLayout_3.addLayout(self.horizontalLayout_10) self.horizontalLayout_11 = QtModule.QHBoxLayout() self.horizontalLayout_11.setSpacing(4) self.horizontalLayout_11.setObjectName("horizontalLayout_11") self.labelTexViewer = QtModule.QLabel(self.tab3) self.labelTexViewer.setMinimumSize(QtCore.QSize(80, 0)) font = QtGui.QFont() font.setPointSize(10) self.labelTexViewer.setFont(font) self.labelTexViewer.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelTexViewer.setObjectName("labelTexViewer") self.horizontalLayout_11.addWidget(self.labelTexViewer) self.lineTexViewer = QtModule.QLineEdit(self.tab3) self.lineTexViewer.setObjectName("lineTexViewer") self.horizontalLayout_11.addWidget(self.lineTexViewer) self.verticalLayout_3.addLayout(self.horizontalLayout_11) self.horizontalLayout_12 = QtModule.QHBoxLayout() self.horizontalLayout_12.setSpacing(4) self.horizontalLayout_12.setObjectName("horizontalLayout_12") self.labelTexExt = QtModule.QLabel(self.tab3) self.labelTexExt.setMinimumSize(QtCore.QSize(80, 0)) self.labelTexExt.setMaximumSize(QtCore.QSize(16777215, 16777215)) font = QtGui.QFont() font.setPointSize(10) self.labelTexExt.setFont(font) self.labelTexExt.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelTexExt.setObjectName("labelTexExt") self.horizontalLayout_12.addWidget(self.labelTexExt) self.lineTexExt = QtModule.QLineEdit(self.tab3) sizePolicy = QtModule.QSizePolicy(QtModule.QSizePolicy.Fixed, QtModule.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineTexExt.sizePolicy().hasHeightForWidth()) self.lineTexExt.setSizePolicy(sizePolicy) self.lineTexExt.setMaximumSize(QtCore.QSize(50, 16777215)) self.lineTexExt.setObjectName("lineTexExt") self.horizontalLayout_12.addWidget(self.lineTexExt) spacerItem5 = QtModule.QSpacerItem(40, 20, QtModule.QSizePolicy.Expanding, QtModule.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem5) self.horizontalLayout_12.setStretch(2, 1) self.verticalLayout_3.addLayout(self.horizontalLayout_12) spacerItem6 = QtModule.QSpacerItem(20, 40, QtModule.QSizePolicy.Minimum, QtModule.QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem6) self.tabs.addTab(self.tab3, "") self.gridLayout.addWidget(self.tabs, 1, 0, 1, 1) spacerItem7 = QtModule.QSpacerItem(20, 40, QtModule.QSizePolicy.Minimum, QtModule.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem7, 4, 0, 1, 1) self.retranslateUi(meRendererSetup) self.tabs.setCurrentIndex(0) if usePyQt4 : QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), meRendererSetup.close) QtCore.QObject.connect(self.okButton, QtCore.SIGNAL("clicked()"), meRendererSetup.onSelect) QtCore.QObject.connect(self.listPreset, QtCore.SIGNAL("currentIndexChanged(QString)"), meRendererSetup.onIndexChanged) QtCore.QObject.connect(self.newButton, QtCore.SIGNAL("clicked()"), meRendererSetup.onNewPreset) QtCore.QObject.connect(self.deleteButton, QtCore.SIGNAL("clicked()"), meRendererSetup.onDeletePreset) QtCore.QObject.connect(self.lineName, QtCore.SIGNAL("editingFinished()"), meRendererSetup.onEditLabel) QtCore.QObject.connect(self.saveButton, QtCore.SIGNAL("clicked()"), meRendererSetup.onSave) else : self.cancelButton.clicked.connect( meRendererSetup.close) self.okButton.clicked.connect( meRendererSetup.onSelect) self.listPreset.currentIndexChanged.connect( meRendererSetup.onIndexChanged) self.newButton.clicked.connect( meRendererSetup.onNewPreset) self.deleteButton.clicked.connect( meRendererSetup.onDeletePreset) self.lineName.editingFinished.connect( meRendererSetup.onEditLabel) self.saveButton.clicked.connect( meRendererSetup.onSave) QtCore.QMetaObject.connectSlotsByName(meRendererSetup) meRendererSetup.setTabOrder(self.tabs, self.listPreset) meRendererSetup.setTabOrder(self.listPreset, self.newButton) meRendererSetup.setTabOrder(self.newButton, self.deleteButton) meRendererSetup.setTabOrder(self.deleteButton, self.cancelButton) meRendererSetup.setTabOrder(self.cancelButton, self.lineName) meRendererSetup.setTabOrder(self.lineName, self.lineCmd) meRendererSetup.setTabOrder(self.lineCmd, self.lineFlags) meRendererSetup.setTabOrder(self.lineFlags, self.lineCompiler) meRendererSetup.setTabOrder(self.lineCompiler, self.lineShaderInfo) meRendererSetup.setTabOrder(self.lineShaderInfo, self.lineDefines) meRendererSetup.setTabOrder(self.lineDefines, self.lineShaderExt) meRendererSetup.setTabOrder(self.lineShaderExt, self.lineTexMake) meRendererSetup.setTabOrder(self.lineTexMake, self.lineTexInfo) meRendererSetup.setTabOrder(self.lineTexInfo, self.lineTexViewer) meRendererSetup.setTabOrder(self.lineTexViewer, self.lineTexExt)
def setupUi(self, MatrixWidget): # self.widget = MatrixWidget self.labels = [] self.controls = [] font = QtGui.QFont() labelFontMetric = QtGui.QFontMetricsF(font) label_wi = 0 char_wi = labelFontMetric.width('x') array_size = self.widget.param.arraySize if array_size > 0: label_wi = char_wi * (len(str(array_size - 1)) + 2) # [0] for i in range(self.widget.param.arraySize): self.labels.append(QtModule.QLabel(MatrixWidget)) self.labels[i].setMinimumSize(QtCore.QSize(label_wi, UI.HEIGHT)) self.labels[i].setMaximumSize(QtCore.QSize(label_wi, UI.HEIGHT)) self.labels[i].setAlignment(QtCore.Qt.AlignRight) self.labels[i].setText('[' + str(i) + ']') empty_label = QtModule.QLabel(MatrixWidget) empty_label.setMinimumSize(QtCore.QSize(label_wi, UI.HEIGHT)) empty_label.setMaximumSize(QtCore.QSize(label_wi, UI.HEIGHT)) empty_label.setAlignment(QtCore.Qt.AlignRight) empty_label.setText(' ') elem = [] elem.append(QtModule.QComboBox(MatrixWidget)) elem[0].setEditable(False) elem[0].setMaximumSize(QtCore.QSize(UI.MAX, UI.COMBO_HEIGHT)) for label in VALID_RSL_SPACES: elem[0].addItem(label) space = self.widget.param.spaceArray[i] if space != None: elem[0].setCurrentIndex(elem[0].findText(space)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem.append(QtModule.QLineEdit(MatrixWidget)) elem[1].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[2].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[3].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[4].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[5].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[6].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[7].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[8].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[9].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[10].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[11].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[12].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[13].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[14].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[15].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[16].setMinimumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[1].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[2].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[3].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[4].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[5].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[6].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[7].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[8].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[9].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[10].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[11].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[12].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[13].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[14].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[15].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) elem[16].setMaximumSize(QtCore.QSize(UI.FIELD_WIDTH, UI.HEIGHT)) self.controls.append(elem) spacer0 = QtModule.QSpacerItem(0, 0, UI.SP_EXPAND, UI.SP_MIN) hl = QtModule.QHBoxLayout() hl.addWidget(self.labels[i]) # array index hl.addWidget(elem[0]) # space selector hl.addItem(spacer0) self.widget.param_vl.addLayout(hl) hl1 = QtModule.QHBoxLayout() hl1.setSpacing(UI.SPACING) hl1.setContentsMargins(0, 0, 0, 0) hl1.addWidget(empty_label) hl1.addWidget(elem[1]) hl1.addWidget(elem[2]) hl1.addWidget(elem[3]) hl1.addWidget(elem[4]) spacer1 = QtModule.QSpacerItem(0, 0, UI.SP_EXPAND, UI.SP_MIN) hl1.addItem(spacer1) self.widget.param_vl.addLayout(hl1) hl2 = QtModule.QHBoxLayout() hl2.setSpacing(UI.SPACING) hl2.setContentsMargins(0, 0, 0, 0) hl2.addWidget(empty_label) hl2.addWidget(elem[5]) hl2.addWidget(elem[6]) hl2.addWidget(elem[7]) hl2.addWidget(elem[8]) spacer2 = QtModule.QSpacerItem(0, 0, UI.SP_EXPAND, UI.SP_MIN) hl2.addItem(spacer2) self.widget.param_vl.addLayout(hl2) hl3 = QtModule.QHBoxLayout() hl3.setSpacing(UI.SPACING) hl3.setContentsMargins(0, 0, 0, 0) hl3.addWidget(empty_label) hl3.addWidget(elem[9]) hl3.addWidget(elem[10]) hl3.addWidget(elem[11]) hl3.addWidget(elem[12]) spacer3 = QtModule.QSpacerItem(0, 0, UI.SP_EXPAND, UI.SP_MIN) hl3.addItem(spacer3) self.widget.param_vl.addLayout(hl3) hl4 = QtModule.QHBoxLayout() hl4.setSpacing(UI.SPACING) hl4.setContentsMargins(0, 0, 0, 0) hl4.addWidget(empty_label) hl4.addWidget(elem[13]) hl4.addWidget(elem[14]) hl4.addWidget(elem[15]) hl4.addWidget(elem[16]) spacer4 = QtModule.QSpacerItem(0, 0, UI.SP_EXPAND, UI.SP_MIN) hl4.addItem(spacer4) self.widget.param_vl.addLayout(hl4) self.connectSignals(MatrixWidget) QtCore.QMetaObject.connectSlotsByName(MatrixWidget)
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(963, 894) MainWindow.setDockOptions(QtModule.QMainWindow.AllowTabbedDocks | QtModule.QMainWindow.AnimatedDocks) MainWindow.setUnifiedTitleAndToolBarOnMac(False) self.centralwidget = QtModule.QWidget(MainWindow) self.centralwidget.setAcceptDrops(True) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.gridLayout = QtModule.QGridLayout(self.centralwidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.tabs = QtModule.QTabWidget(self.centralwidget) self.tabs.setAcceptDrops(True) self.tabs.setTabPosition(QtModule.QTabWidget.North) self.tabs.setTabShape(QtModule.QTabWidget.Rounded) self.tabs.setElideMode(QtCore.Qt.ElideNone) self.tabs.setDocumentMode(True) self.tabs.setTabsClosable(True) self.tabs.setMovable(False) self.tabs.setObjectName(_fromUtf8("tabs")) self.workArea = WorkArea() self.workArea.setAcceptDrops(True) self.workArea.setObjectName(_fromUtf8("workArea")) self.tabs.addTab(self.workArea, _fromUtf8("")) self.gridLayout.addWidget(self.tabs, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtModule.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 963, 21)) font = QtGui.QFont() font.setFamily(_fromUtf8("Lucida Sans")) font.setPointSize(9) self.menubar.setFont(font) self.menubar.setObjectName(_fromUtf8("menubar")) self.menuFile = QtModule.QMenu(self.menubar) font = QtGui.QFont() font.setFamily(_fromUtf8("MS Shell Dlg 2")) font.setPointSize(8) self.menuFile.setFont(font) self.menuFile.setObjectName(_fromUtf8("menuFile")) self.menuRecent_Projects = QtModule.QMenu(self.menuFile) self.menuRecent_Projects.setObjectName( _fromUtf8("menuRecent_Projects")) self.menuRecent_Networks = QtModule.QMenu(self.menuFile) self.menuRecent_Networks.setObjectName( _fromUtf8("menuRecent_Networks")) self.menuEdit = QtModule.QMenu(self.menubar) font = QtGui.QFont() font.setFamily(_fromUtf8("MS Shell Dlg 2")) font.setPointSize(8) self.menuEdit.setFont(font) self.menuEdit.setObjectName(_fromUtf8("menuEdit")) self.menuCommand = QtModule.QMenu(self.menubar) self.menuCommand.setEnabled(True) font = QtGui.QFont() font.setFamily(_fromUtf8("MS Shell Dlg 2")) font.setPointSize(8) self.menuCommand.setFont(font) self.menuCommand.setObjectName(_fromUtf8("menuCommand")) self.menuCreateNode = QtModule.QMenu(self.menuCommand) self.menuCreateNode.setEnabled(True) self.menuCreateNode.setObjectName(_fromUtf8("menuCreateNode")) self.menuWindow = QtModule.QMenu(self.menubar) font = QtGui.QFont() font.setFamily(_fromUtf8("MS Shell Dlg 2")) font.setPointSize(8) self.menuWindow.setFont(font) self.menuWindow.setObjectName(_fromUtf8("menuWindow")) self.menuHelp = QtModule.QMenu(self.menubar) font = QtGui.QFont() font.setFamily(_fromUtf8("MS Shell Dlg 2")) font.setPointSize(8) self.menuHelp.setFont(font) self.menuHelp.setLayoutDirection(QtCore.Qt.RightToLeft) self.menuHelp.setObjectName(_fromUtf8("menuHelp")) self.menuView = QtModule.QMenu(self.menubar) self.menuView.setObjectName(_fromUtf8("menuView")) MainWindow.setMenuBar(self.menubar) self.statusbar = QtModule.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.dockNodes = QtModule.QDockWidget(MainWindow) self.dockNodes.setMinimumSize(QtCore.QSize(150, 42)) self.dockNodes.setFloating(False) self.dockNodes.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea | QtCore.Qt.RightDockWidgetArea) self.dockNodes.setObjectName(_fromUtf8("dockNodes")) self.nodeList_ctl = NodeLibraryView() self.nodeList_ctl.setObjectName(_fromUtf8("nodeList_ctl")) self.dockNodes.setWidget(self.nodeList_ctl) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockNodes) self.toolBar = QtModule.QToolBar(MainWindow) self.toolBar.setMinimumSize(QtCore.QSize(0, 0)) self.toolBar.setBaseSize(QtCore.QSize(0, 0)) self.toolBar.setAllowedAreas(QtCore.Qt.LeftToolBarArea | QtCore.Qt.TopToolBarArea) self.toolBar.setIconSize(QtCore.QSize(24, 24)) self.toolBar.setObjectName(_fromUtf8("toolBar")) MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.dockPreview = QtModule.QDockWidget(MainWindow) self.dockPreview.setBaseSize(QtCore.QSize(300, 0)) self.dockPreview.setFloating(False) self.dockPreview.setFeatures( QtModule.QDockWidget.AllDockWidgetFeatures) self.dockPreview.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea | QtCore.Qt.RightDockWidgetArea) self.dockPreview.setObjectName(_fromUtf8("dockPreview")) self.imageView_ctl = ImageViewWidget() self.imageView_ctl.setObjectName(_fromUtf8("imageView_ctl")) self.dockPreview.setWidget(self.imageView_ctl) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockPreview) self.dockParam = QtModule.QDockWidget(MainWindow) self.dockParam.setBaseSize(QtCore.QSize(300, 0)) self.dockParam.setFeatures(QtModule.QDockWidget.AllDockWidgetFeatures) self.dockParam.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea | QtCore.Qt.RightDockWidgetArea) self.dockParam.setObjectName(_fromUtf8("dockParam")) self.nodeParam_ctl = NodeParamView() self.nodeParam_ctl.setObjectName(_fromUtf8("nodeParam_ctl")) self.dockParam.setWidget(self.nodeParam_ctl) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockParam) self.dockProject = QtModule.QDockWidget(MainWindow) self.dockProject.setObjectName(_fromUtf8("dockProject")) self.project_ctl = NodeLibraryView() self.project_ctl.setObjectName(_fromUtf8("project_ctl")) self.dockProject.setWidget(self.project_ctl) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockProject) self.dockSwatch = QtModule.QDockWidget(MainWindow) self.dockSwatch.setObjectName(_fromUtf8("dockSwatch")) self.swatchParam_ctl = NodeSwatchParam() self.swatchParam_ctl.setObjectName(_fromUtf8("swatchParam_ctl")) self.dockSwatch.setWidget(self.swatchParam_ctl) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockSwatch) self.actionRendererOptions = QtModule.QAction(MainWindow) self.actionRendererOptions.setObjectName( _fromUtf8("actionRendererOptions")) self.actionPreviewOptions = QtModule.QAction(MainWindow) self.actionPreviewOptions.setObjectName( _fromUtf8("actionPreviewOptions")) self.actionNew = QtModule.QAction(MainWindow) icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(_fromUtf8(":/file_icons/resources/new.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionNew.setIcon(icon) self.actionNew.setToolTip(_fromUtf8("New Project")) self.actionNew.setStatusTip(_fromUtf8("Create a new project")) self.actionNew.setObjectName(_fromUtf8("actionNew")) self.actionOpen = QtModule.QAction(MainWindow) icon1 = QtGui.QIcon() icon1.addPixmap( QtGui.QPixmap(_fromUtf8(":/file_icons/resources/open.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionOpen.setIcon(icon1) self.actionOpen.setObjectName(_fromUtf8("actionOpen")) self.actionSave = QtModule.QAction(MainWindow) icon2 = QtGui.QIcon() icon2.addPixmap( QtGui.QPixmap(_fromUtf8(":/file_icons/resources/save.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSave.setIcon(icon2) self.actionSave.setObjectName(_fromUtf8("actionSave")) self.actionExit = QtModule.QAction(MainWindow) self.actionExit.setObjectName(_fromUtf8("actionExit")) self.actionSaveAs = QtModule.QAction(MainWindow) self.actionSaveAs.setObjectName(_fromUtf8("actionSaveAs")) self.actionImport = QtModule.QAction(MainWindow) self.actionImport.setObjectName(_fromUtf8("actionImport")) self.actionSaveSelected = QtModule.QAction(MainWindow) self.actionSaveSelected.setEnabled(False) self.actionSaveSelected.setObjectName(_fromUtf8("actionSaveSelected")) self.actionCopy = QtModule.QAction(MainWindow) self.actionCopy.setEnabled(False) icon3 = QtGui.QIcon() icon3.addPixmap( QtGui.QPixmap(_fromUtf8(":/edit_icons/resources/copy.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionCopy.setIcon(icon3) self.actionCopy.setObjectName(_fromUtf8("actionCopy")) self.actionCut = QtModule.QAction(MainWindow) self.actionCut.setEnabled(False) icon4 = QtGui.QIcon() icon4.addPixmap( QtGui.QPixmap(_fromUtf8(":/edit_icons/resources/editcut1.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionCut.setIcon(icon4) self.actionCut.setObjectName(_fromUtf8("actionCut")) self.actionPaste = QtModule.QAction(MainWindow) self.actionPaste.setEnabled(False) icon5 = QtGui.QIcon() icon5.addPixmap( QtGui.QPixmap(_fromUtf8(":/edit_icons/resources/paste.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionPaste.setIcon(icon5) self.actionPaste.setObjectName(_fromUtf8("actionPaste")) self.actionUndo = QtModule.QAction(MainWindow) self.actionUndo.setEnabled(False) icon6 = QtGui.QIcon() icon6.addPixmap( QtGui.QPixmap(_fromUtf8(":/edit_icons/resources/undo.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionUndo.setIcon(icon6) self.actionUndo.setObjectName(_fromUtf8("actionUndo")) self.actionRedo = QtModule.QAction(MainWindow) self.actionRedo.setEnabled(False) icon7 = QtGui.QIcon() icon7.addPixmap( QtGui.QPixmap(_fromUtf8(":/edit_icons/resources/redo.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionRedo.setIcon(icon7) self.actionRedo.setObjectName(_fromUtf8("actionRedo")) self.actionEditNode = QtModule.QAction(MainWindow) self.actionEditNode.setEnabled(True) self.actionEditNode.setObjectName(_fromUtf8("actionEditNode")) self.actionRenderPreview = QtModule.QAction(MainWindow) self.actionRenderPreview.setEnabled(True) self.actionRenderPreview.setObjectName( _fromUtf8("actionRenderPreview")) self.actionShowNodes = QtModule.QAction(MainWindow) self.actionShowNodes.setCheckable(True) self.actionShowNodes.setChecked(True) self.actionShowNodes.setObjectName(_fromUtf8("actionShowNodes")) self.actionShowParameters = QtModule.QAction(MainWindow) self.actionShowParameters.setCheckable(True) self.actionShowParameters.setChecked(True) self.actionShowParameters.setObjectName( _fromUtf8("actionShowParameters")) self.actionShowGrid = QtModule.QAction(MainWindow) self.actionShowGrid.setCheckable(True) icon8 = QtGui.QIcon() icon8.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/grid_off.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon8.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/grid_on.png")), QtGui.QIcon.Normal, QtGui.QIcon.On) self.actionShowGrid.setIcon(icon8) self.actionShowGrid.setObjectName(_fromUtf8("actionShowGrid")) self.actionAbout = QtModule.QAction(MainWindow) self.actionAbout.setObjectName(_fromUtf8("actionAbout")) self.actionHelp = QtModule.QAction(MainWindow) self.actionHelp.setObjectName(_fromUtf8("actionHelp")) self.actionShowToolbar = QtModule.QAction(MainWindow) self.actionShowToolbar.setCheckable(True) self.actionShowToolbar.setChecked(True) self.actionShowToolbar.setObjectName(_fromUtf8("actionShowToolbar")) self.actionShowPreview = QtModule.QAction(MainWindow) self.actionShowPreview.setCheckable(True) self.actionShowPreview.setChecked(True) self.actionShowPreview.setObjectName(_fromUtf8("actionShowPreview")) self.actionDelete = QtModule.QAction(MainWindow) icon9 = QtGui.QIcon() icon9.addPixmap( QtGui.QPixmap(_fromUtf8(":/edit_icons/resources/delete.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionDelete.setIcon(icon9) self.actionDelete.setObjectName(_fromUtf8("actionDelete")) self.actionProjectSetup = QtModule.QAction(MainWindow) self.actionProjectSetup.setObjectName(_fromUtf8("actionProjectSetup")) self.actionSettings = QtModule.QAction(MainWindow) self.actionSettings.setObjectName(_fromUtf8("actionSettings")) self.actionReverseFlow = QtModule.QAction(MainWindow) self.actionReverseFlow.setCheckable(True) self.actionReverseFlow.setEnabled(False) icon10 = QtGui.QIcon() icon10.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/ledoff.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon10.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/ledon.png")), QtGui.QIcon.Normal, QtGui.QIcon.On) self.actionReverseFlow.setIcon(icon10) self.actionReverseFlow.setVisible(False) self.actionReverseFlow.setObjectName(_fromUtf8("actionReverseFlow")) self.actionStraightLinks = QtModule.QAction(MainWindow) self.actionStraightLinks.setCheckable(True) icon11 = QtGui.QIcon() icon11.addPixmap( QtGui.QPixmap( _fromUtf8(":/show_icons/resources/straight_off.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon11.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/straight_on.png")), QtGui.QIcon.Normal, QtGui.QIcon.On) self.actionStraightLinks.setIcon(icon11) self.actionStraightLinks.setObjectName( _fromUtf8("actionStraightLinks")) self.actionSnapGrid = QtModule.QAction(MainWindow) self.actionSnapGrid.setCheckable(True) icon12 = QtGui.QIcon() icon12.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/snap_off.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon12.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/snap_on.png")), QtGui.QIcon.Normal, QtGui.QIcon.On) self.actionSnapGrid.setIcon(icon12) self.actionSnapGrid.setObjectName(_fromUtf8("actionSnapGrid")) self.actionFitAll = QtModule.QAction(MainWindow) icon13 = QtGui.QIcon() icon13.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/fit_all.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionFitAll.setIcon(icon13) self.actionFitAll.setVisible(True) self.actionFitAll.setObjectName(_fromUtf8("actionFitAll")) self.actionFitSelected = QtModule.QAction(MainWindow) icon14 = QtGui.QIcon() icon14.addPixmap( QtGui.QPixmap( _fromUtf8(":/show_icons/resources/fit_selected.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionFitSelected.setIcon(icon14) self.actionFitSelected.setVisible(True) self.actionFitSelected.setObjectName(_fromUtf8("actionFitSelected")) self.actionZoomReset = QtModule.QAction(MainWindow) icon15 = QtGui.QIcon() icon15.addPixmap( QtGui.QPixmap(_fromUtf8(":/show_icons/resources/zoom_reset.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionZoomReset.setIcon(icon15) self.actionZoomReset.setObjectName(_fromUtf8("actionZoomReset")) self.actionNewParamView = QtModule.QAction(MainWindow) self.actionNewParamView.setObjectName(_fromUtf8("actionNewParamView")) self.actionNewImageView = QtModule.QAction(MainWindow) self.actionNewImageView.setObjectName(_fromUtf8("actionNewImageView")) self.actionDuplicate = QtModule.QAction(MainWindow) self.actionDuplicate.setObjectName(_fromUtf8("actionDuplicate")) self.actionDuplicateWithLinks = QtModule.QAction(MainWindow) self.actionDuplicateWithLinks.setObjectName( _fromUtf8("actionDuplicateWithLinks")) self.actionSelectAll = QtModule.QAction(MainWindow) self.actionSelectAll.setObjectName(_fromUtf8("actionSelectAll")) self.actionSelectBelow = QtModule.QAction(MainWindow) self.actionSelectBelow.setObjectName(_fromUtf8("actionSelectBelow")) self.actionSelectAbove = QtModule.QAction(MainWindow) self.actionSelectAbove.setObjectName(_fromUtf8("actionSelectAbove")) self.actionExportShader = QtModule.QAction(MainWindow) self.actionExportShader.setObjectName(_fromUtf8("actionExportShader")) self.actionShowSwatch = QtModule.QAction(MainWindow) self.actionShowSwatch.setObjectName(_fromUtf8("actionShowSwatch")) self.actionHideSwatch = QtModule.QAction(MainWindow) self.actionHideSwatch.setObjectName(_fromUtf8("actionHideSwatch")) self.actionHelpMode = QtModule.QAction(MainWindow) self.actionHelpMode.setCheckable(True) self.actionHelpMode.setObjectName(_fromUtf8("actionHelpMode")) self.actionViewComputedCode = QtModule.QAction(MainWindow) self.actionViewComputedCode.setObjectName( _fromUtf8("actionViewComputedCode")) self.actionCompileShader = QtModule.QAction(MainWindow) self.actionCompileShader.setObjectName( _fromUtf8("actionCompileShader")) self.menuRecent_Projects.addSeparator() self.menuRecent_Networks.addSeparator() self.menuFile.addAction(self.actionNew) self.menuFile.addAction(self.actionOpen) self.menuFile.addAction(self.actionSave) self.menuFile.addAction(self.actionSaveAs) self.menuFile.addAction(self.actionSaveSelected) self.menuFile.addSeparator() self.menuFile.addAction(self.actionProjectSetup) self.menuFile.addSeparator() self.menuFile.addAction(self.actionImport) self.menuFile.addSeparator() self.menuFile.addAction(self.menuRecent_Projects.menuAction()) self.menuFile.addAction(self.menuRecent_Networks.menuAction()) self.menuFile.addSeparator() self.menuFile.addAction(self.actionExit) self.menuEdit.addAction(self.actionUndo) self.menuEdit.addAction(self.actionRedo) self.menuEdit.addSeparator() self.menuEdit.addAction(self.actionSelectAll) self.menuEdit.addAction(self.actionSelectBelow) self.menuEdit.addAction(self.actionSelectAbove) self.menuEdit.addSeparator() self.menuEdit.addAction(self.actionCopy) self.menuEdit.addAction(self.actionCut) self.menuEdit.addAction(self.actionPaste) self.menuEdit.addSeparator() self.menuEdit.addAction(self.actionDuplicate) self.menuEdit.addAction(self.actionDuplicateWithLinks) self.menuEdit.addAction(self.actionDelete) self.menuEdit.addSeparator() self.menuEdit.addAction(self.actionRendererOptions) self.menuEdit.addAction(self.actionSettings) self.menuCreateNode.addSeparator() self.menuCommand.addAction(self.menuCreateNode.menuAction()) self.menuCommand.addAction(self.actionEditNode) self.menuCommand.addAction(self.actionViewComputedCode) self.menuCommand.addAction(self.actionExportShader) self.menuCommand.addSeparator() self.menuCommand.addAction(self.actionCompileShader) self.menuCommand.addAction(self.actionRenderPreview) self.menuCommand.addAction(self.actionShowSwatch) self.menuCommand.addAction(self.actionHideSwatch) self.menuWindow.addAction(self.actionShowToolbar) self.menuWindow.addAction(self.actionShowNodes) self.menuWindow.addAction(self.actionShowParameters) self.menuWindow.addAction(self.actionShowPreview) self.menuWindow.addSeparator() self.menuWindow.addAction(self.actionNewParamView) self.menuWindow.addAction(self.actionNewImageView) self.menuHelp.addAction(self.actionAbout) self.menuHelp.addAction(self.actionHelp) self.menuView.addAction(self.actionShowGrid) self.menuView.addAction(self.actionSnapGrid) self.menuView.addAction(self.actionReverseFlow) self.menuView.addAction(self.actionStraightLinks) self.menuView.addSeparator() self.menuView.addAction(self.actionFitAll) self.menuView.addAction(self.actionFitSelected) self.menuView.addAction(self.actionZoomReset) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuCommand.menuAction()) self.menubar.addAction(self.menuView.menuAction()) self.menubar.addAction(self.menuWindow.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.toolBar.addAction(self.actionNew) self.toolBar.addAction(self.actionOpen) self.toolBar.addAction(self.actionSave) self.toolBar.addSeparator() self.toolBar.addAction(self.actionCopy) self.toolBar.addAction(self.actionCut) self.toolBar.addAction(self.actionPaste) self.toolBar.addAction(self.actionDelete) self.toolBar.addSeparator() self.toolBar.addAction(self.actionFitAll) self.toolBar.addAction(self.actionFitSelected) self.toolBar.addAction(self.actionZoomReset) self.toolBar.addAction(self.actionShowGrid) self.toolBar.addAction(self.actionSnapGrid) self.toolBar.addAction(self.actionStraightLinks) self.toolBar.addAction(self.actionReverseFlow) self.retranslateUi(MainWindow) self.tabs.setCurrentIndex(0) if usePyQt4: QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.close) QtCore.QObject.connect(self.actionProjectSetup, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onProjectSetup) QtCore.QObject.connect(self.actionShowGrid, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), MainWindow.onShowGrid) QtCore.QObject.connect(self.actionRendererOptions, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onRenderSettings) QtCore.QObject.connect(self.actionSnapGrid, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), MainWindow.onSnapGrid) QtCore.QObject.connect(self.actionReverseFlow, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), MainWindow.onReverseFlow) QtCore.QObject.connect(self.actionStraightLinks, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), MainWindow.onStraightLinks) QtCore.QObject.connect(self.actionDelete, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onDelete) QtCore.QObject.connect(self.actionFitAll, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onFitAll) QtCore.QObject.connect(self.actionFitSelected, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onFitSelected) QtCore.QObject.connect(self.actionZoomReset, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onZoomReset) QtCore.QObject.connect(self.actionNewParamView, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onNewParamView) QtCore.QObject.connect(self.actionNew, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onNew) QtCore.QObject.connect(self.actionSave, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onSave) QtCore.QObject.connect(self.actionSaveAs, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onSaveAs) QtCore.QObject.connect(self.actionOpen, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onOpen) QtCore.QObject.connect(self.actionSettings, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onSettingsSetup) QtCore.QObject.connect(self.actionImport, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onImport) QtCore.QObject.connect(self.actionDuplicate, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onDuplicate) QtCore.QObject.connect(self.actionDuplicateWithLinks, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onDuplicateWithLinks) QtCore.QObject.connect(self.actionCopy, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onCopy) QtCore.QObject.connect(self.actionCut, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onCut) QtCore.QObject.connect(self.actionSelectAll, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onSelectAll) QtCore.QObject.connect(self.actionPaste, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onPaste) QtCore.QObject.connect(self.actionSelectAbove, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onSelectAbove) QtCore.QObject.connect(self.actionSelectBelow, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onSelectBelow) QtCore.QObject.connect(self.actionEditNode, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onEditNode) QtCore.QObject.connect(self.actionExportShader, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onExportShader) QtCore.QObject.connect(self.actionRenderPreview, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onRenderPreview) QtCore.QObject.connect(self.actionShowSwatch, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onShowSwatch) QtCore.QObject.connect(self.actionHideSwatch, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onHideSwatch) QtCore.QObject.connect(self.actionSaveSelected, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onSaveSelected) QtCore.QObject.connect(self.actionViewComputedCode, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onViewComputedCode) QtCore.QObject.connect(self.actionCompileShader, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.onCompileShader) else: self.actionExit.triggered.connect(MainWindow.close) self.actionProjectSetup.triggered.connect( MainWindow.onProjectSetup) self.actionShowGrid.toggled.connect(MainWindow.onShowGrid) self.actionRendererOptions.triggered.connect( MainWindow.onRenderSettings) self.actionSnapGrid.toggled.connect(MainWindow.onSnapGrid) self.actionReverseFlow.toggled.connect(MainWindow.onReverseFlow) self.actionStraightLinks.toggled.connect( MainWindow.onStraightLinks) self.actionDelete.triggered.connect(MainWindow.onDelete) self.actionFitAll.triggered.connect(MainWindow.onFitAll) self.actionFitSelected.triggered.connect(MainWindow.onFitSelected) self.actionZoomReset.triggered.connect(MainWindow.onZoomReset) self.actionNewParamView.triggered.connect( MainWindow.onNewParamView) self.actionNew.triggered.connect(MainWindow.onNew) self.actionSave.triggered.connect(MainWindow.onSave) self.actionSaveAs.triggered.connect(MainWindow.onSaveAs) self.actionOpen.triggered.connect(MainWindow.onOpen) self.actionSettings.triggered.connect(MainWindow.onSettingsSetup) self.actionImport.triggered.connect(MainWindow.onImport) self.actionDuplicate.triggered.connect(MainWindow.onDuplicate) self.actionDuplicateWithLinks.triggered.connect( MainWindow.onDuplicateWithLinks) self.actionCopy.triggered.connect(MainWindow.onCopy) self.actionCut.triggered.connect(MainWindow.onCut) self.actionSelectAll.triggered.connect(MainWindow.onSelectAll) self.actionPaste.triggered.connect(MainWindow.onPaste) self.actionSelectAbove.triggered.connect(MainWindow.onSelectAbove) self.actionSelectBelow.triggered.connect(MainWindow.onSelectBelow) self.actionEditNode.triggered.connect(MainWindow.onEditNode) self.actionExportShader.triggered.connect( MainWindow.onExportShader) self.actionRenderPreview.triggered.connect( MainWindow.onRenderPreview) self.actionShowSwatch.triggered.connect(MainWindow.onShowSwatch) self.actionHideSwatch.triggered.connect(MainWindow.onHideSwatch) self.actionSaveSelected.triggered.connect( MainWindow.onSaveSelected) self.actionViewComputedCode.triggered.connect( MainWindow.onViewComputedCode) self.actionCompileShader.triggered.connect( MainWindow.onCompileShader) """ """ QtCore.QMetaObject.connectSlotsByName(MainWindow)
def buildGeneralGui(self): #if DEBUG_MODE : print ">> ParamWidget buildGeneralGui" self.label_vl = QtModule.QVBoxLayout() self.label_vl.setSpacing(UI.SPACING) self.label_vl.setContentsMargins(0, 0, 0, 0) self.label_vl.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) self.hl = QtModule.QHBoxLayout() self.hl.setSpacing(UI.SPACING) self.hl.setContentsMargins(0, 0, 0, 0) self.hl.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) # vertical layout for parametrs values (e.g. output links or matrix rows) self.param_vl = QtModule.QVBoxLayout() self.param_vl.setSpacing(UI.SPACING) self.param_vl.setContentsMargins(0, 0, 0, 0) self.param_vl.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) # # add 'isShaderParam' check box only for RSL nodes # if self.gfxNode is not None: # # add "Use as Shader parameter" checkbox # #if ( self.gfxNode.node.type in VALID_RSL_NODE_TYPES ) and ( self.param.type in VALID_RSL_PARAM_TYPES ) and ( self.param.provider != 'attribute' ) : if ( self.gfxNode.node.format == 'rsl' ) and \ ( self.param.type in VALID_RSL_PARAM_TYPES ) and \ ( self.param.provider != 'attribute' ) : self.check = QtModule.QCheckBox(self) self.check.setMinimumSize( QtCore.QSize(UI.CHECK_WIDTH, UI.HEIGHT)) self.check.setMaximumSize( QtCore.QSize(UI.CHECK_WIDTH, UI.HEIGHT)) self.check.setToolTip('Use as Shader parameter') self.check.setChecked(self.param.shaderParam) if usePyQt4: self.connect(self.check, QtCore.SIGNAL('stateChanged(int)'), self.onShaderParamChanged) else: self.check.stateChanged.connect(self.onShaderParamChanged) self.hl.addWidget(self.check) else: spacer = QtModule.QSpacerItem(UI.LT_SPACE, UI.HEIGHT, QtModule.QSizePolicy.Minimum, QtModule.QSizePolicy.Minimum) self.hl.addItem(spacer) # # add 'remove' button for removable parameters # if self.param.removable: self.removeButton = QtModule.QToolButton(self) sizePolicy = QtModule.QSizePolicy(QtModule.QSizePolicy.Fixed, QtModule.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(20) sizePolicy.setVerticalStretch(20) sizePolicy.setHeightForWidth( self.removeButton.sizePolicy().hasHeightForWidth()) self.removeButton.setSizePolicy(sizePolicy) self.removeButton.setMaximumSize(QtCore.QSize(20, 20)) icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(':/edit_icons/resources/del_list.png'), QtGui.QIcon.Normal, QtGui.QIcon.On) self.removeButton.setIcon(icon) self.removeButton.setAutoRaise(True) self.removeButton.setToolTip('Remove parameter') self.removeButton.setIconSize(QtCore.QSize(16, 16)) self.removeButton.setObjectName('removeButton') self.hl.addWidget(self.removeButton) if usePyQt4: QtCore.QObject.connect(self.removeButton, QtCore.SIGNAL('clicked()'), self.onRemoveItem) else: self.removeButton.clicked.connect(self.onRemoveItem) self.label = ParamLabel(self, self.param) self.helpMark = QtModule.QLabel(self) palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.WindowText, QtGui.QColor(0, 140, 0)) font1 = QtGui.QFont() font1.setBold(True) self.helpMark.setPalette(palette) self.helpMark.setFont(font1) self.helpMark.setText('') self.helpMark.setMinimumSize(QtCore.QSize(6, UI.HEIGHT)) self.helpMark.setMaximumSize(QtCore.QSize(6, UI.HEIGHT)) self.helpMark.setEnabled(False) if self.param.help is not None and self.param.help != '': self.label.setWhatsThis(self.param.help) self.helpMark.setWhatsThis(self.param.help) self.helpMark.setText('?') self.helpMark.setEnabled(True) self.label.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) #self.label.setMinimumSize ( QtCore.QSize ( UI.LABEL_WIDTH, UI.HEIGHT ) ) #self.label.setMaximumSize ( QtCore.QSize ( UI.LABEL_WIDTH, UI.HEIGHT ) ) #self.vl.addWidget ( self.gui ) self.hl.addWidget(self.label) self.hl.addWidget(self.helpMark) #self.hl.addLayout ( self.param_vl ) #sp = QtModule.QSpacerItem ( 20, 20, QtModule.QSizePolicy.Expanding, QtModule.QSizePolicy.Minimum ) self.label_vl.addLayout(self.hl) sp_v = QtModule.QSpacerItem(0, 0, QtModule.QSizePolicy.Minimum, QtModule.QSizePolicy.Expanding) self.label_vl.addItem(sp_v)
def buildGui ( self ) : # build the gui created with QtDesigner self.ui = Ui_NodeEditorDialog () self.ui.setupUi ( self ) if self.editNode is not None : # self.setWindowTitle ( 'NodeEditor: %s (%s)' % ( self.editNode.label, self.editNode.name ) ) linkedFont = QtGui.QFont () linkedFont.setItalic ( True ) linkedBrush = QtGui.QBrush () linkedBrush.setColor ( QtCore.Qt.blue ) # setup loacal variables list for name in self.editNode.internals : item = QtModule.QListWidgetItem ( name ) self.ui.internals_list.ui.listWidget.addItem ( item ) # setup includes list for name in self.editNode.includes : item = QtModule.QListWidgetItem ( name ) self.ui.includes_list.ui.listWidget.addItem ( item ) # setup input params list for param in self.editNode.inputParams : item = QtModule.QListWidgetItem ( param.name ) if self.editNode.isInputParamLinked ( param ) : item.setFont ( linkedFont ) item.setForeground ( linkedBrush ) self.ui.input_list.ui.listWidget.addItem ( item ) # setup output params list for param in self.editNode.outputParams : item = QtModule.QListWidgetItem ( param.name ) if self.editNode.isOutputParamLinked ( param ) : item.setFont ( linkedFont ) item.setForeground ( linkedBrush ) self.ui.output_list.ui.listWidget.addItem ( item ) # setup input links list for link in self.editNode.getInputLinks () : item = QtModule.QListWidgetItem ( 'id=%d' % link.id ) if not usePySide : item.setData ( QtCore.Qt.UserRole, QtCore.QVariant ( int ( link.id ) ) ) else : item.setData ( QtCore.Qt.UserRole, int ( link.id ) ) self.ui.input_links_listWidget.addItem ( item ) # setup output links list for link in self.editNode.getOutputLinks () : item = QtModule.QListWidgetItem ( 'id=%d' % link.id ) if not usePySide : item.setData ( QtCore.Qt.UserRole, QtCore.QVariant ( int ( link.id ) ) ) else : item.setData ( QtCore.Qt.UserRole, int ( link.id ) ) self.ui.output_links_listWidget.addItem ( item ) # setup event handlers list if self.editNode.event_code : for handler in self.editNode.event_code.keys () : item = QtModule.QListWidgetItem ( handler ) self.ui.handlers_list.ui.listWidget.addItem ( item ) self.nodeCodeEditor = self.ui.node_code self.nodeCodeEditor.setNodeCode ( self.editNode.code, 'SL' ) self.controlCodeEditor = self.ui.control_code self.controlCodeEditor.setNodeCode ( self.editNode.control_code, 'python' ) self.eventCodeEditor = self.ui.event_code #self.eventCodeEditor.setNodeCode ( self.editNode.event_code, 'python' ) self.paramCodeEditor = self.ui.param_code #self.paramCodeEditor.setNodeCode ( self.editNode.param_code, 'python' ) self.nodePropertiesEditor = self.ui.node self.nodePropertiesEditor.setNode ( self.editNode ) self.nodeParamEditor = self.ui.param self.nodeLinkEditor = self.ui.link self.ui.tabWidget.setCurrentIndex ( TAB_NODE_CODE ) self.ui.toolBox.setCurrentIndex ( IDX_INTERNALS ) self.ui.tabs_param_list.setCurrentIndex ( 0 ) # input param tab