프로젝트

일반

사용자정보

개정판 1d5401fe

ID1d5401fe0576503ccc60f7f2e969c72a2a22bed3
상위 2a190e68
하위 fe5e4b3c

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

speed test

Change-Id: I45f0c33ce93bb9d7abac7837a4098063480d3c67

차이점 보기:

DTI_PID/DTI_PID/QtImageViewer.py
661 661
                    connectors = [connector for connector in items if type(connector.parentItem()) is QEngineeringLineItem \
662 662
                                        and type(connector) is QEngineeringConnectorItem]
663 663

  
664
            matches = [item for item in scene.items() if
665
                    (type(item) is QEngineeringLineItem) and (item.distanceTo((scenePos.x(), scenePos.y())) < 20)]
664
            #matches = [item for item in scene.items() if
665
            #        (type(item) is QEngineeringLineItem) and (item.distanceTo((scenePos.x(), scenePos.y())) < 20)]
666 666
            allowed_error = 0.0001
667 667
            if False:  # len(matches) == 1:
668 668
                matches[0].insertSymbol(svg, scenePos)
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py
259 259
                for assoc in list(self._associations[key]):
260 260
                    # find owner with uid if self.scene() is valid
261 261
                    if self.scene() and assoc and type(assoc) is uuid.UUID:
262
                        matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(assoc)]
262
                        #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(assoc)]
263
                        matches = []
264
                        for item in self.scene().items():
265
                            if hasattr(item, 'uid') and str(item.uid) == str(assoc):
266
                                matches = [item]
267
                                break
263 268
                        if matches:
264 269
                            res.append(matches[0])
265 270
                            self._associations[key][index] = matches[0]
......
289 294
        import uuid
290 295

  
291 296
        if assoc and type(assoc) is uuid.UUID:
292
            matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(assoc)]
293
            if matches: return matches[0]
297
            #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(assoc)]
298
            matches = []
299
            for item in self.scene().items():
300
                if hasattr(item, 'uid') and str(item.uid) == str(assoc):
301
                    matches = [item]
302
                    break
303
            if matches:
304
                return matches[0]
294 305

  
295 306
        return assoc
296 307

  
......
714 725

  
715 726
            # copy old values
716 727
            for attr in targetAttrs:
717
                matches = [_attr for _attr, _ in self.attrs.items() if _attr.UID == attr.UID]
728
                #matches = [_attr for _attr, _ in self.attrs.items() if _attr.UID == attr.UID]
729
                matches = []
730
                for _attr, _ in self.attrs.items():
731
                    if _attr.UID == attr.UID:
732
                        matches = [_attr]
733
                        break
718 734
                if matches:
719 735
                    if matches[0].AttributeType == 'Spec' and not self.attrs[matches[0]]:
720 736
                        continue
......
776 792
                    _attrs[attr] = self.try_eval(None, attr.Expression) if attr.Expression else _attrs[attr]
777 793

  
778 794
            """calculate attribute value for HMB type"""
779
            matches = [_attr for _attr in _attrs if _attr.Attribute.upper() == 'STREAM NO']
780
            matches_case = [_attr for _attr in _attrs if _attr.Attribute.upper() == 'CASE']
781
            hmb_attrs = [_attr for _attr in targetAttrs if _attr.AttributeType == 'HMB']
782
            hmb_datas = app_doc_data.get_hmb_data(None) if hmb_attrs else None
783
            if hmb_datas and hmb_attrs and matches and _attrs[matches[0]] and _attrs[matches[0]] != 'None':
784
                stream_no = _attrs[matches[0]]
785
                names = []
786
                for data in hmb_datas[0].datas[0]:
787
                    if data.name not in names:
788
                        names.append(data.name)
789

  
790
                matches = [hmb_data for hmb_data in hmb_datas if hmb_data.stream_no == stream_no]
791
                if matches:
792
                    data = {}
793
                    if matches_case:
794
                        data['Case'] = _attrs[matches_case[0]]
795
                    hmb_data = matches[0]
796
                    data = QItemDataExportDialog.make_hmb_data(data, hmb_data, names)
797
                    for _attr in hmb_attrs:
798
                        if _attr.Attribute in data:
799
                            _attrs[_attr] = data[_attr.Attribute]
800
                        else:
801
                            _attrs[_attr] = ''
795
            configs = app_doc_data.getConfigs('Line List', 'Use Stream No')
796
            if configs and int(configs[0].value) == 1:
797
                matches = [_attr for _attr in _attrs if _attr.Attribute.upper() == 'STREAM NO']
798
                matches_case = [_attr for _attr in _attrs if _attr.Attribute.upper() == 'CASE']
799
                hmb_attrs = [_attr for _attr in targetAttrs if _attr.AttributeType == 'HMB']
800
                hmb_datas = app_doc_data.get_hmb_data(None) if hmb_attrs else None
801
                if hmb_datas and hmb_attrs and matches and _attrs[matches[0]] and _attrs[matches[0]] != 'None':
802
                    stream_no = _attrs[matches[0]]
803
                    names = []
804
                    for data in hmb_datas[0].datas[0]:
805
                        if data.name not in names:
806
                            names.append(data.name)
807

  
808
                    matches = [hmb_data for hmb_data in hmb_datas if hmb_data.stream_no == stream_no]
809
                    if matches:
810
                        data = {}
811
                        if matches_case:
812
                            data['Case'] = _attrs[matches_case[0]]
813
                        hmb_data = matches[0]
814
                        data = QItemDataExportDialog.make_hmb_data(data, hmb_data, names)
815
                        for _attr in hmb_attrs:
816
                            if _attr.Attribute in data:
817
                                _attrs[_attr] = data[_attr.Attribute]
818
                            else:
819
                                _attrs[_attr] = ''
802 820
            """up to here"""
803 821

  
804 822
            """calculate attribute value for combined type"""
......
965 983
        if type(self) is QEngineeringLineNoTextItem:
966 984
            for prop, value in self._properties.items():
967 985
                if prop.is_selectable and type(value) is uuid.UUID and self.scene():
968
                    matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)]
969
                    if matches: self._properties[prop] = matches[0]
986
                    #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)]
987
                    matches = []
988
                    for item in self.scene().items():
989
                        if hasattr(item, 'uid') and str(item.uid) == str(value):
990
                            matches = [item]
991
                            break
992
                    if matches:
993
                        self._properties[prop] = matches[0]
970 994

  
971 995
        elif type(self) is QEngineeringLineItem:
972 996
            for prop, value in self._properties.items():
973 997
                if prop.is_selectable and type(value) is uuid.UUID and self.scene():
974
                    matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)]
975
                    if matches: self._properties[prop] = matches[0]
998
                    #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)]
999
                    matches = []
1000
                    for item in self.scene().items():
1001
                        if hasattr(item, 'uid') and str(item.uid) == str(value):
1002
                            matches = [item]
1003
                            break
1004
                    if matches:
1005
                        self._properties[prop] = matches[0]
976 1006

  
977 1007
                if prop.Expression: self._properties[prop] = eval(prop.Expression)
978 1008

  
......
980 1010
            for prop, value in self._properties.items():
981 1011
                try:
982 1012
                    if prop.is_selectable and type(value) is uuid.UUID and self.scene():
983
                        matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)]
984
                        if matches: self._properties[prop] = matches[0]
1013
                        #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)]
1014
                        matches = []
1015
                        for item in self.scene().items():
1016
                            if hasattr(item, 'uid') and str(item.uid) == str(value):
1017
                                matches = [item]
1018
                                break
1019
                        if matches:
1020
                            self._properties[prop] = matches[0]
985 1021

  
986 1022
                    if prop.Expression:
987 1023
                        item = self._properties[prop]  # assign item
......
997 1033
            for prop, value in self._properties.items():
998 1034
                try:
999 1035
                    if prop.is_selectable and type(value) is uuid.UUID and self.scene():
1000
                        matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)]
1001
                        if matches: self._properties[prop] = matches[0]
1036
                        #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(value)]
1037
                        matches = []
1038
                        for item in self.scene().items():
1039
                            if hasattr(item, 'uid') and str(item.uid) == str(value):
1040
                                matches = [item]
1041
                                break
1042
                        if matches:
1043
                            self._properties[prop] = matches[0]
1002 1044

  
1003 1045
                    if prop.Expression:
1004 1046
                        item = self._properties[prop]  # assign item
......
1025 1067
        from EngineeringVendorItem import QEngineeringVendorItem
1026 1068

  
1027 1069
        if type(self) is QEngineeringLineNoTextItem:
1028
            matches = [prop for prop, _ in self.properties.items() if prop.Attribute == name]
1070
            #matches = [prop for prop, _ in self.properties.items() if prop.Attribute == name]
1071
            matches = []
1072
            for prop, _ in self.properties.items():
1073
                if prop.Attribute == name:
1074
                    matches = [prop]
1075
                    break
1029 1076
            return self.properties[matches[0]] if matches else None
1030 1077

  
1031 1078
        elif type(self) is QEngineeringLineItem:
1032
            matches = [(prop, value) for prop, value in self.properties.items() if prop.Attribute == name]
1033
            if matches: return matches[0][1]
1034

  
1035
            return None
1079
            #matches = [(prop, value) for prop, value in self.properties.items() if prop.Attribute == name]
1080
            #if matches: return matches[0][1]
1081
            #return None
1082
            matches = []
1083
            for prop, value in self.properties.items():
1084
                if prop.Attribute == name:
1085
                    matches = [value]
1086
                    break
1087
            
1088
            return matches[0] if matches else None
1036 1089

  
1037 1090
        elif issubclass(type(self), SymbolSvgItem):
1038
            matches = [(prop, value) for prop, value in self.properties.items() if prop.Attribute == name]
1039
            if matches: return matches[0][1]
1040

  
1041
            return None
1091
            #matches = [(prop, value) for prop, value in self.properties.items() if prop.Attribute == name]
1092
            #if matches: return matches[0][1]
1093
            #return None
1094
            matches = []
1095
            for prop, value in self.properties.items():
1096
                if prop.Attribute == name:
1097
                    matches = [value]
1098
                    break
1099
            
1100
            return matches[0] if matches else None
1042 1101

  
1043 1102
        elif type(self) is QEngineeringVendorItem:
1044
            matches = [(prop, value) for prop, value in self.properties.items() if prop.Attribute == name]
1045
            if matches: return matches[0][1]
1103
            #matches = [(prop, value) for prop, value in self.properties.items() if prop.Attribute == name]
1104
            #if matches: return matches[0][1]
1105
            matches = []
1106
            for prop, value in self.properties.items():
1107
                if prop.Attribute == name:
1108
                    matches = [value]
1109
                    break
1110
            
1111
            return matches[0] if matches else None
1046 1112

  
1047 1113
    def set_property(self, property, value):
1048 1114
        """ set property with given value """

내보내기 Unified diff

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