def updateMaterialTab(self, ent): #ent = self.controller.active if ent is not None: self.clearDialogForm() qprim = ent.prim mats = qprim.Materials for i in range(len(mats)): index = str(i) tuple = mats[index] line = lines.UUIDEditLine(self.controller) line.update_text(tuple[1]) line.name = index asset_type = tuple[0] combobox = QComboBox() for text in PRIMTYPES.itervalues(): combobox.addItem(text) if PRIMTYPES.has_key(asset_type): realIndex = combobox.findText(PRIMTYPES[asset_type]) combobox.setCurrentIndex(realIndex) applyButton = self.getButton("materialApplyButton", self.ICON_OK, line, line.applyAction) cancelButton = self.getButton("materialCancelButton", self.ICON_CANCEL, line, line.cancelAction) line.index = index line.combobox = combobox line.connect('textEdited(QString)', applyButton.lineValueChanged) line.connect('textEdited(QString)', cancelButton.lineValueChanged) box = QHBoxLayout() box.addWidget(line) box.addWidget(applyButton) box.addWidget(cancelButton) self.materialTabFormWidget.materialFormLayout.addRow( combobox, box)
def updateMaterialTab(self, ent): #ent = self.controller.active if ent is not None: self.clearDialogForm() qprim = ent.prim mats = qprim.Materials #print mats#, r.formwidget.formLayout.children() #for tuple in sorted(mats.itervalues()): for i in range(len(mats)): index = str(i) tuple = mats[index] line = lines.UUIDEditLine(self.controller)#QLineEdit() line.update_text(tuple[1]) line.name = index asset_type = tuple[0] combobox = QComboBox() for text in PRIMTYPES.itervalues(): combobox.addItem(text) if PRIMTYPES.has_key(asset_type): realIndex = combobox.findText(PRIMTYPES[asset_type]) #print realIndex, asset_type, PRIMTYPES[asset_type] combobox.setCurrentIndex(realIndex) applyButton = self.getButton("materialApplyButton", self.ICON_OK, line, line.applyAction) cancelButton = self.getButton("materialCancelButton", self.ICON_CANCEL, line, line.cancelAction) line.index = index line.combobox = combobox line.connect('textEdited(QString)', applyButton.lineValueChanged) line.connect('textEdited(QString)', cancelButton.lineValueChanged) box = QHBoxLayout() box.addWidget(line) box.addWidget(applyButton) box.addWidget(cancelButton) self.materialTabFormWidget.materialFormLayout.addRow(combobox, box) self.tabwidget.setTabEnabled(1, True)
from PythonQt.QtGui import QLineEdit, QHBoxLayout box = r.c.materialDialogFormWidget.formLayout hor = QHBoxLayout() line = QLineEdit() hor.addWidget(line) print hor if 0: from PythonQt.QtGui import QLineEdit, QHBoxLayout, QComboBox, QLabel combo = QComboBox() combo.addItem("aaaa") combo.addItem("bbbb") combo.addItem("cccc") combo.addItem("dddd") print combo.currentIndex, combo.findText("ccCc") if 0: print r.c.propedit #~ r.c.propedit.setObject(r.c.propedit) #~ r.c.propedit.show() #~ props = r.createUiWidgetProperty() #~ props.show_at_toolbar_ = False #~ props.widget_name_ = "property editor" #~ r.test = r.createUiProxyWidget(r.c.propedit, props) #~ r.test.show() uism = r.getUiSceneManager() uism.AddProxyWidget(r.test) print r.test r.test.show()
from PythonQt.QtGui import QLineEdit, QHBoxLayout box = r.c.materialDialogFormWidget.formLayout hor = QHBoxLayout() line = QLineEdit() hor.addWidget(line) print hor if 0: from PythonQt.QtGui import QLineEdit, QHBoxLayout, QComboBox, QLabel combo = QComboBox() combo.addItem("aaaa") combo.addItem("bbbb") combo.addItem("cccc") combo.addItem("dddd") print combo.currentIndex, combo.findText("ccCc") if 0: print r.c.propedit #~ r.c.propedit.setObject(r.c.propedit) #~ r.c.propedit.show() #~ props = r.createUiWidgetProperty() #~ props.show_at_toolbar_ = False #~ props.widget_name_ = "property editor" #~ r.test = r.createUiProxyWidget(r.c.propedit, props) #~ r.test.show() uism = r.getUiSceneManager() uism.AddProxyWidget(r.test) print r.test r.test.show()