Example #1
0
 def combobox(self, value=None):
     """
     Функция добавления выпадающего списка,
     Возвращает объект списка
     """
     cb = QComboTable(self.root, self)
     if not value is None:
         cb.standart(value)
     return cb
Example #2
0
    def valueHuman(self, item, label, value, pos):
        """
        Заполняем ячейку таблицы,
        Выбираем подходящий виджет на основании типа ячейки,
        Выбираем установленные значения
        """
        structure = self.wrapper.table.__field__(
            self.root._getaddr(item._addr, label._fieldName)
        )
        choices = structure.values
        if choices:
            val = QComboTable(self.root, self)
            if structure.blank:
                choices.insert(0, '')
            val.addItems([str(i) for i in choices])
            val.setCurrentIndex(choices.index(value))
            self.setCellWidget(pos, 1, val)

        else:
            val = QDocumentTableItem(self.root, self, '%s' % value)
            val._before = value
            self.setItem(pos, 1, val)

        val._val = value
        val._row = item
        val._field = label
        item._activated = True
        val._activated = True
Example #3
0
    def valueHuman(self, item, label, value, pos):
        """
        Заполняем ячейку таблицы,
        Выбираем подходящий виджет на основании типа ячейки,
        Выбираем установленные значения
        """
#        target = self.root._getaddr(item._addr, label._fieldName)
        structure = self.wrapper.table.__field__(label._target)
        choices = copy.copy(structure.values)
        if choices:
            val = QComboTable(self.root, self)
            if structure.blank:
                choices.insert(0, '')
            val.addItems([str(i) for i in choices])
            val.setCurrentIndex(choices.index(value))
            self.setCellWidget(pos, 1, val)

        else:
            if structure.is_file:
                val = QRemoteImage(self.root, self, '%s' % value)
                self.setCellWidget(pos, 1, val)
            else:
                val = QDocumentTableItem(self.root, self, '%s' % value)
                val._before = value
                self.setItem(pos, 1, val)

        if structure.foreign:
            val.setToolTip(self.wrapper.doc.get_related(label._target).helptext)

        val._val = value
        val._row = item
        val._field = label
        item._activated = True
        val._activated = True