Exemplo n.º 1
0
    def _setupProperty(self, i, name):
        typ = PathPropertyBag.getPropertyTypeName(self.obj.getTypeIdOfProperty(name))
        val  = PathUtil.getPropertyValueString(self.obj, name)
        info = self.obj.getDocumentationOfProperty(name)

        self.model.setData(self.model.index(i, self.ColumnName), name,      QtCore.Qt.EditRole)
        #self.model.setData(self.model.index(i, self.ColumnType), typ,       QtCore.Qt.EditRole)
        self.model.setData(self.model.index(i, self.ColumnVal),  self.obj,  Delegate.RoleObject)
        self.model.setData(self.model.index(i, self.ColumnVal),  name,      Delegate.RoleProperty)
        self.model.setData(self.model.index(i, self.ColumnVal),  val,       QtCore.Qt.DisplayRole)

        self.model.setData(self.model.index(i, self.ColumnName), typ,       QtCore.Qt.ToolTipRole)
        #self.model.setData(self.model.index(i, self.ColumnType), info,      QtCore.Qt.ToolTipRole)
        self.model.setData(self.model.index(i, self.ColumnVal),  info,      QtCore.Qt.ToolTipRole)

        self.model.item(i, self.ColumnName).setEditable(False)
Exemplo n.º 2
0
    set_val = s[1]

for i, fname in enumerate(args.path):
    #print(fname)
    doc = FreeCAD.openDocument(fname, False)
    print("{}:".format(doc.Name))
    for o in doc.Objects:
        if PathPropertyBag.IsPropertyBag(o):
            if args.print_groups:
                print("  {}:  {}".format(o.Label, sorted(o.CustomPropertyGroups)))
            else:
                print("  {}:".format(o.Label))
            for p in o.Proxy.getCustomProperties():
                grp = o.getGroupOfProperty(p)
                typ = o.getTypeIdOfProperty(p)
                ttp = PathPropertyBag.getPropertyTypeName(typ)
                val = PathUtil.getProperty(o, p)
                dsc = o.getDocumentationOfProperty(p)
                enm = ''
                enum = []
                if ttp == 'Enumeration':
                    enum = o.getEnumerationsOfProperty(p)
                    enm = "{}".format(','.join(enum))
                if GroupMap.get(grp):
                    group = GroupMap.get(grp)
                    print("move: {}.{} -> {}".format(grp, p, group))
                    o.removeProperty(p)
                    o.Proxy.addCustomProperty(typ, p, group, dsc)
                    if enum:
                        print("enum {}.{}: {}".format(group, p, enum))
                        setattr(o, p, enum)