def __init__(self, label, widget, parent=None):
     super(AttributeItemWidget, self).__init__(parent=parent)
     layout = QtWidgets.QFormLayout()
     layout.setSpacing(0)
     layout.setContentsMargins(0, 0, 0, 0)
     label = QtWidgets.QLabel(label, parent=self)
     widget.setParent(self)
     layout.addWidget(label)
     layout.addWidget(widget)
     self.setLayout(layout)
Exemple #2
0
 def attributeWidget(self, parent):
     # todo: mostly temp so we'll need a more ideal solution maybe json?
     parentWidget = QtWidgets.QWidget(parent)
     layout = QtWidgets.QFormLayout(parent=parentWidget)
     parentWidget.setLayout(layout)
     for i in self.attributes(
             True, False, attributeVisLevel=self.ATTRIBUTE_VIS_LEVEL_TWO):
         if not i.isInput():
             continue
         Type = i.internalAttr.type().Type
         typeInfo = ATTRIBUTETYPEMAP.get(Type)
         if typeInfo:
             widget = typeInfo.get("widget")
             if widget is not None:
                 widget = widget(i, parent=parentWidget)
                 layout.addRow(i.text(), widget)
     return parentWidget