Пример #1
0
 def _setFormValue(self, attrValue):
     while self.listWidget.takeItem(0):
         pass
     if attrValue:
         item = QtWidgets.QListWidgetItem(attrValue.nodeName())
         uuid = meta.getUUID(attrValue)
         item.setData(QtCore.Qt.UserRole, uuid)
         self.listWidget.addItem(item)
Пример #2
0
 def _setFormValue(self, attrValue):
     while self.listWidget.takeItem(0):
         pass
     for node in attrValue:
         item = QtWidgets.QListWidgetItem(node.nodeName())
         uuid = meta.getUUID(node)
         item.setData(QtCore.Qt.UserRole, uuid)
         self.listWidget.addItem(item)
     # 13px line height per item, clamped in range 40..120, added 8px buffer
     newHeight = max(40, min(120, 8 + 13 * self.listWidget.count()))
     self.listWidget.setFixedHeight(newHeight)
Пример #3
0
 def to_yaml(cls, dumper, data):
     if data:
         uuid = str(meta.getUUID(data))
         return dumper.represent_scalar(cls.yaml_tag, uuid)
     else:
         return dumper.represent_scalar(cls.yaml_tag, 'null')