Exemplo n.º 1
0
 def initializeParametersTable(self):
     self.optionModel = QStandardItemModel(0, 1)
     self.optionModel.setHorizontalHeaderLabels(["Parameter", "Value" ])
     options = self.lsystem.context().options
     self.optionDelegate = oed.OptionEditorDelegate()
     category = None
     categoryItem = None
     indexitem = 0
     for i in range(len(options)):
         option = options[i]
         if option.category != category:
             category = option.category
             sc = QStandardItem(category)                
             sc.setEditable(False)
             sc.setBackground(QBrush(QColor(172,168,153)))
             sc.setForeground(QBrush(QColor(255,255,255)))
             qf = QFont()
             qf.setBold(True)
             sc.setFont(qf)
             self.optionModel.setItem(indexitem, 0, sc)
             sc = QStandardItem()                
             sc.setEditable(False)
             sc.setBackground(QBrush(QColor(172,168,153)))
             sc.setForeground(QBrush(QColor(255,255,255)))
             self.optionModel.setItem(indexitem, 1, sc)
             indexitem += 1             
         si = QStandardItem(option.name)
         si.setToolTip(option.comment)
         si.setEditable(False)
         self.optionModel.setItem(indexitem, 0, si)
         si = QStandardItem(option.currentValue())
         si.option = option
         self.optionModel.setItem(indexitem, 1, si)
         indexitem += 1
     self.optionModel.itemChanged.connect(self.textEdited) # QObject.connect(self.optionModel,SIGNAL('itemChanged(QStandardItem*)'),self.textEdited)
Exemplo n.º 2
0
 def updateTable(self, table, args):
     model = QStandardItemModel(len(args), 2)
     model.setHorizontalHeaderLabels(["Name", "Value", "Type"])
     indexitem = 0
     for name, val in args.items():
         si = QStandardItem(name)
         si.setEditable(False)
         model.setItem(indexitem, 0, si)
         si = QStandardItem(repr(val))
         si.setEditable(False)
         model.setItem(indexitem, 1, si)
         try:
             si = QStandardItem(str(val.__class__.__name__))
         except:
             si = QStandardItem(str(type(val).__name__))
         si.setEditable(False)
         model.setItem(indexitem, 2, si)
         indexitem += 1
     table.setModel(model)
     table.model = model
Exemplo n.º 3
0
 def clearTable(self, table):
     model = QStandardItemModel(0, 2)
     model.setHorizontalHeaderLabels(["Name", "Value", "Type"])
     table.setModel(model)
     table.model = model