프로젝트

일반

사용자정보

개정판 8aee19c9

ID8aee19c9c8dbfec0047cb38bff28f57819947641
상위 b35e1b15
하위 f13ee502, 4341529e

함의성이(가) 약 4년 전에 추가함

issue #1462: checking db saving

Change-Id: I1ba45abb1301882d277e583eefc29086f14e31e3

차이점 보기:

DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py
1369 1369
        self.setZValue(QEngineeringAbstractItem.HOVER_ZVALUE) if flag else self.setZValue(QEngineeringLineItem.ZVALUE)
1370 1370
        self.update()
1371 1371

  
1372
        for assoc in self.associations():
1373
            assoc.highlight(flag)
1374

  
1372 1375
        for connector in self.connectors:
1373 1376
            connector.highlight(flag)
1374 1377

  
......
1506 1509
            attrs = app_doc_data.get_component_attributes(uid)
1507 1510
            matches = [attr for attr in attrs if attr['Attribute'] == 'LineType']
1508 1511
            item.lineType = matches[0]['Value'] if matches else 'Secondary'
1512
            if matches:
1513
                attrs.remove(matches[0])
1514

  
1509 1515
            ## assign area
1510 1516
            if component['Area']:
1511 1517
                for area in app_doc_data.getAreaList():
......
1518 1524

  
1519 1525
            matches = [attr for attr in attrs if attr['Attribute'] == 'Thickness']
1520 1526
            item.thickness = int(matches[0]['Value']) if matches and matches[0]['Value'] != 'None' else None
1527
            if matches:
1528
                attrs.remove(matches[0])
1521 1529

  
1522 1530
            matches = [attr for attr in attrs if attr['Attribute'] == 'FlowMark']
1523 1531
            item.flowMark = int(matches[0]['Value']) if matches and matches[0]['Value'] != 'None' else None
1532
            if matches:
1533
                attrs.remove(matches[0])
1524 1534

  
1525 1535
            if connectors:
1526 1536
                iterIndex = 0
......
1537 1547
                        item._associations[_type] = []
1538 1548
                    item._associations[_type].append(uuid.UUID(assoc['Association']))
1539 1549
            # up to here
1550

  
1551
            if attrs:
1552
                for attr in attrs:
1553
                    _attr = SymbolAttr.from_record(attr)
1554
                    item.attrs[_attr] = attr['Value']
1555

  
1540 1556
        except Exception as ex:
1541 1557
            from App import App
1542 1558
            from AppDocData import MessageType
......
1782 1798
        sql = 'insert into Components({}) values({})'.format(','.join(cols), ','.join(values))
1783 1799
        res.append((sql, tuple(param)))
1784 1800

  
1801
        _attrs = self.getAttributes()
1802
        if _attrs:
1803
            cols = ['UID', 'Components_UID', 'SymbolAttribute_UID', 'Value', 'Association_UID', 'Freeze']
1804
            values = ['?', '?', '?', '?', '?', '?']
1805
            params = []
1806
            for key in _attrs.keys():
1807
                if key.AttributeType != 'Spec':
1808
                    params.append((str(uuid.uuid4()), str(self.uid), str(key.UID), str(_attrs[key]), str(key.AssocItem),
1809
                                   str(key.Freeze)))
1810
                elif key.AttributeType == 'Spec':
1811
                    if type(_attrs[key]) is not list: continue
1812
                    params.append((str(uuid.uuid4()), str(self.uid), str(key.UID), (str(_attrs[key][0]) + ',' + str(_attrs[key][1])), str(key.AssocItem),
1813
                                   str(key.Freeze)))
1814
            sql = 'insert into Attributes({}) values({})'.format(','.join(cols), ','.join(values))
1815
            res.append((sql, tuple(params)))
1816

  
1817
        if self.associations():
1818
            cols = ['UID', '[Type]', 'Components_UID', 'Association']
1819
            values = ['?', '?', '?', '?']
1820
            params = []
1821
            for assoc in self.associations():
1822
                params.append(
1823
                    (str(uuid.uuid4()), QEngineeringAbstractItem.assoc_type(assoc), str(self.uid), str(assoc.uid)))
1824
            sql = 'insert into Associations({}) values({})'.format(','.join(cols), ','.join(values))
1825
            resLater.append((sql, tuple(params)))
1826

  
1785 1827
        # save connectors to database
1786 1828
        cols = ['Components_UID', '[Index]', 'X', 'Y', 'Connected', 'Connected_At']
1787 1829
        values = ['?', '?', '?', '?', '?', '?']

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)