프로젝트

일반

사용자정보

개정판 5748e764

ID5748e764b2a7723f22cd9c48a80074b974a761a3
상위 bb75cba5
하위 75f97173

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

issue #622: save package image as property Image

Change-Id: I54ef22cbd8cda37f6808eebdccf168e8da617a78

차이점 보기:

DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py
670 670
                        self._properties[prop] = eval(prop.Expression)
671 671
                except Exception as ex:
672 672
                    from App import App
673
                    from AppDocData import MessageType
673 674
                    message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
674 675
                                                                   sys.exc_info()[-1].tb_lineno)
675 676
                    App.mainWnd().addMessage.emit(MessageType.Error, message)
......
686 687
                        self._properties[prop] = eval(prop.Expression)
687 688
                except Exception as ex:
688 689
                    from App import App
690
                    from AppDocData import MessageType
689 691
                    message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
690 692
                                                                   sys.exc_info()[-1].tb_lineno)
691 693
                    App.mainWnd().addMessage.emit(MessageType.Error, message)
DTI_PID/DTI_PID/Shapes/EngineeringVendorItem.py
41 41
        self.setColor(self._color if pack_type == 'Vendor Package' else QEngineeringVendorItem.EQUIPMENT_PACKAGE_COLOR)
42 42
        self._savedColor = None
43 43

  
44
        #self._properties = {SymbolProp(None, 'Name Tag', 'Tag No', Expression='self.EvaluatedName'): None}
45
        self._properties = {}
44
        self._properties = { SymbolProp(None, 'Image', 'String', Expression='self.EvaluatedImage'): None }
46 45
        self._pack_type = pack_type
47 46

  
48 47
        self.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsFocusable)
......
64 63
            index += 1
65 64

  
66 65
    @property
66
    def EvaluatedImage(self):
67
        if self.scene() and self.scene().parent() and self.scene().parent().graphicsView.hasImage():
68
            rect = self.sceneBoundingRect()
69
            _image = AppDocData.instance().activeDrawing.image_origin
70

  
71
            points = []
72
            for conn in self.connectors:
73
                points.append([round(conn.center()[0] - rect.x()), round(conn.center()[1] - rect.y())])
74
            poly = np.array(points, np.int32)
75

  
76
            mask = np.ones((int(rect.height()), int(rect.width())), dtype=np.uint8) * 255
77
            cv2.fillPoly(mask, [poly], (0))
78
            sym_img = cv2.bitwise_or(mask, _image[int(rect.y()):int(rect.y()) + int(rect.height()), int(rect.x()):int(rect.x()) + int(rect.width())])
79
            #sym_img = cv2.merge((sym_img, sym_img, sym_img))
80
            sym_str = str(sym_img.tostring())
81

  
82
            return sym_str
83

  
84
    @property
67 85
    def pack_type(self):
68 86
        """return type"""
69 87
        return self._pack_type
minorTools/xmlTextSearcher.py
3 3
def finder():
4 4
    print("finder start")
5 5
    
6
    targetText = ['Instrumen Box<']
7
    path = 'W:\ID2_Project\ISU\Temp'
6
    targetText = ['gate_pressure<']
7
    path = 'W:\ID2_Project\VnV\Temp'
8 8

  
9 9
    print("target : " + str(len(targetText)))
10 10
    print("path : " + path)

내보내기 Unified diff