프로젝트

일반

사용자정보

개정판 735aac62

ID735aac6240cec559e42ea40bdea94329d1d7c247
상위 7e63f990
하위 b46d1c3b

gaqhf 이(가) 약 6년 전에 추가함

build issue #000: edit size text item save

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
1731 1731
            maxValue = maxValue + len(list(root.iter('LINE_NO')))
1732 1732
            maxValue = maxValue + len(list(root.iter('LINE')))
1733 1733
            maxValue = maxValue + len(list(root.iter('UNKNOWN')))
1734
            maxValue = maxValue + len(list(root.iter('SIZETEXT')))
1734 1735
            self.progress.setMaximum(maxValue)
1735 1736

  
1736 1737
            for symbol in root.find('SYMBOLS').iter('SYMBOL'):
......
1799 1800
                self.progress.setValue(self.progress.value() + 1)
1800 1801
                
1801 1802
            QApplication.processEvents()
1803
            
1804
            # SIZE TEXT
1805
            for text in root.find('SIZETEXT').iter('ATTRIBUTE'):
1806
                item = QEngineeringTextItem.fromXml(text)
1807
                if item is not None:
1808
                    uid = text.find('UID')
1809
                    attributeValue = text.find('ATTRIBUTEVALUE')
1810
                    name = text.find('NAME').text
1811
                    item.transfer.onRemoved.connect(self.itemRemoved)
1812
                    self.addTextItemToScene(item)
1813

  
1814
                self.progress.setValue(self.progress.value() + 1)
1815
                
1816
            QApplication.processEvents()
1802 1817

  
1803 1818
            for line in root.find('LINEINFOS').iter('LINE'):
1804 1819
                item = QEngineeringLineItem.fromXml(line)
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py
421 421
        from TextItemFactory import TextItemFactory
422 422
        from AppDocData import AppDocData
423 423
        from EngineeringNoteItem import QEngineeringNoteItem
424
        from QEngineeringSizeTextItem import QEngineeringSizeTextItem
424 425

  
425 426
        item = None
426 427

  
......
449 450
                    item.angle = angle
450 451
                    item.setPlainText(value)
451 452
                    item.setToolTip(value)
453
            elif name == 'SIZE':
454
                item = QEngineeringSizeTextItem()
455
                if item is not None:
456
                    item.loc = (x, y)
457
                    item.size = (width, height)
458
                    item.angle = angle
459
                    item.setPlainText(value)
460
                    item.setToolTip(value)
452 461

  
453 462
            ## assign area
454 463
            if item is not None:
DTI_PID/DTI_PID/Shapes/QEngineeringSizeTextItem.py
32 32
        @author humkyung
33 33
        @date   2018.05.02
34 34
    '''
35
    def toXml(self, owner, name='SIZE'):
36
        from xml.etree.ElementTree import Element, SubElement, dump, ElementTree
37
        from EngineeringLineItem import QEngineeringLineItem
38
        from SymbolSvgItem import SymbolSvgItem
35
    #def toXml(self):
36
    #    from xml.etree.ElementTree import Element, SubElement, dump, ElementTree
37
    #    from EngineeringLineItem import QEngineeringLineItem
38
    #    from SymbolSvgItem import SymbolSvgItem
39 39

  
40
        try:
41
            node = Element('ATTRIBUTE')
42
            uidNode = Element('UID')
43
            uidNode.text = str(owner.uid)
44
            node.append(uidNode)
40
    #    try:
41
    #        node = Element('ATTRIBUTE')
42
    #        uidNode = Element('UID')
43
    #        uidNode.text = str(self.uid)
44
    #        node.append(uidNode)
45 45

  
46
            textNode = Element('NAME')
47
            textNode.text = 'SIZE'
48
            node.append(textNode)
46
    #        textNode = Element('NAME')
47
    #        textNode.text = 'SIZE'
48
    #        node.append(textNode)
49 49

  
50
            valueNode = Element('VALUE')
51
            valueNode.text = self.text()
52
            node.append(valueNode)
50
    #        locNode = Element('LOCATION')
51
    #        locNode.text = '{},{}'.format(self.loc[0], self.loc[1])
52
    #        node.append(locNode)
53 53

  
54
            angleNode = Element('ANGLE')
55
            angleNode.text = str(self.angle)
56
            node.append(angleNode)
54
    #        valueNode = Element('VALUE')
55
    #        valueNode.text = self.text()
56
    #        node.append(valueNode)
57 57

  
58
            rect = self.sceneBoundingRect()
59
            widthNode = Element('WIDTH')
60
            widthNode.text = str(rect.width())
61
            node.append(widthNode)
58
    #        angleNode = Element('ANGLE')
59
    #        angleNode.text = str(self.angle)
60
    #        node.append(angleNode)
62 61

  
63
            heightNode = Element('HEIGHT')
64
            heightNode.text = str(rect.height())
65
            node.append(heightNode)
62
    #        rect = self.sceneBoundingRect()
63
    #        widthNode = Element('WIDTH')
64
    #        widthNode.text = str(rect.width())
65
    #        node.append(widthNode)
66 66

  
67
            areaNode = Element('AREA')
68
            areaNode.text = self.area
69
            node.append(areaNode)
70
        except Exception as ex:
71
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
67
    #        heightNode = Element('HEIGHT')
68
    #        heightNode.text = str(rect.height())
69
    #        node.append(heightNode)
72 70

  
73
        return node 
71
    #        areaNode = Element('AREA')
72
    #        areaNode.text = self.area
73
    #        node.append(areaNode)
74
    #    except Exception as ex:
75
    #        print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
76

  
77
    #    return node 
DTI_PID/DTI_PID/XmlGenerator.py
69 69

  
70 70
UNKNOWNS_NODE_NAME = "UNKNOWNS"
71 71

  
72
SIZEITEM_NODE_NAME = "SIZETEXT"
73

  
72 74

  
73 75
'''
74 76
    @brief  
......
366 368
    from EngineeringLineNoTextItem import QEngineeringLineNoTextItem
367 369
    from EngineeringUnknownItem import QEngineeringUnknownItem
368 370
    from QEngineeringTrimLineNoTextItem import QEngineeringTrimLineNoTextItem
371
    from QEngineeringSizeTextItem import QEngineeringSizeTextItem
369 372
    from SymbolSvgItem import SymbolSvgItem
370 373

  
371 374
    appDocData = AppDocData.instance()
......
382 385
    lineListNode = Element(LINE_INFOS_NODE_NAME)
383 386
    lineNoListNode = Element(LINE_NOS_NODE_NAME)
384 387
    unknownListNode = Element(UNKNOWNS_NODE_NAME)
388
    sizeItemListNode = Element(SIZEITEM_NODE_NAME)
385 389

  
386 390
    # trim line 추가
387 391
    trimLineNoListNode = Element(TRIM_LINE_NOS_NODE_NAME)
......
395 399
        resultDic["Note Item"] = [0, []]
396 400
        resultDic["Unknown Item"] = [0, []]
397 401
        resultDic["Trim Line Item"] = [0, []]
402
        resultDic["Size Item"] = [0, []]
403
        
398 404

  
399 405
        for item in items:
400 406
            if issubclass(type(item), SymbolSvgItem):
......
440 446
                    resultDic["Unknown Item"][0] += 1
441 447
                    unknownListNode.append(unknownNode)
442 448

  
449
            elif type(item) is QEngineeringSizeTextItem:
450
                sizeNode = item.toXml(name='SIZE')
451
                if type(sizeNode) is str:
452
                    resultDic["Size Item"][1].append(sizeNode)
453
                else:
454
                    resultDic["Size Item"][0] += 1
455
                    sizeItemListNode.append(sizeNode)
456

  
457

  
443 458
        docData = AppDocData.instance()
444 459
        for line in docData.lineNos:
445 460
            if type(line) is QEngineeringTrimLineNoTextItem:
......
459 474
        xml.append(lineListNode)
460 475
        xml.append(lineNoListNode)
461 476
        xml.append(unknownListNode)
462

  
477
        xml.append(sizeItemListNode)
463 478
        xml.append(trimLineNoListNode)
464 479
        ElementTree(xml).write(path)
465 480

  

내보내기 Unified diff

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