프로젝트

일반

사용자정보

개정판 81129f87

ID81129f878a5e5a49e6a8a6c295323398d69f754d
상위 5bc2b28e
하위 e0b1e0f0, d0542cb9

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

issue #000: 0618

Change-Id: I5f2c48e1d177620e959f849c621e741072ef4e2d

차이점 보기:

DTI_PID/DTI_PID/Commands/SelectAttributeCommand.py
103 103
                        while len(self._item._associations[self._attr.AttributeType]) <= self._attr.AttrAt:
104 104
                            self._item._associations[self._attr.AttributeType].append(None)
105 105
                        self._item.add_assoc_item(item, self._attr.AttrAt)
106
                        for key in self._item.attrs.keys():
107
                            if key.Attribute == self._attr.Attribute:
108
                                key.AssocItem = item
109
                                break
106 110
                        if issubclass(type(item), QEngineeringTextItem): item.owner = self._item
107 111
                        self.onSuccess.emit()
108 112
                elif self._attr is not None and type(self._attr) is SymbolProp:
DTI_PID/DTI_PID/Shapes/EngineeringInstrumentItem.py
44 44
        """
45 45
        from EngineeringTextItem import QEngineeringTextItem
46 46

  
47
        return sorted([x for x in self.associations() if issubclass(type(x), QEngineeringTextItem)], key=lambda attr: attr.loc[1])
47
        res = []
48
        for text in sorted([x for x in self.associations() if issubclass(type(x), QEngineeringTextItem)], key=lambda attr: attr.loc[1]):
49
            consumed = False
50
            for key in list(self.attrs.keys()):
51
                if key.AssocItem and key.AssocItem is text:
52
                    consumed = True
53
            if not consumed:
54
                res.append(text)
55

  
56
        return res
48 57

  
49 58
    '''
50 59
        @brief  getter of measured variable code
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
321 321
        """ return text type of associations """
322 322
        from EngineeringTextItem import QEngineeringTextItem
323 323

  
324
        return [x for x in self.associations() if issubclass(type(x), QEngineeringTextItem)]
324
        res = []
325
        for text in [x for x in self.associations() if issubclass(type(x), QEngineeringTextItem)]:
326
            consumed = False
327
            for key in list(self.attrs.keys()):
328
                if key.AssocItem and key.AssocItem is text:
329
                    consumed = True
330
            if not consumed:
331
                res.append(text)
332

  
333
        return res
325 334

  
326 335
    def symbols(self):
327 336
        """ return symbol type of associations """
328
        return [x for x in self.associations() if issubclass(type(x), SymbolSvgItem)]
337
        res = []
338
        for symbol in [x for x in self.associations() if issubclass(type(x), SymbolSvgItem)]:
339
            consumed = False
340
            for key in list(self.attrs.keys()):
341
                if key.AssocItem and key.AssocItem is symbol:
342
                    consumed = True
343
            if not consumed:
344
                res.append(symbol)
345

  
346
        return res
329 347

  
330 348
    def toSql(self):
331 349
        """ convert valve data to sql query """
......
815 833
                matches = [_attr for _attr,_ in self.attrs.items() if _attr.UID == attr.UID]
816 834
                if matches:
817 835
                    attr.Freeze = matches[0].Freeze         ### update freeze value
836
                    attr.AssocItem = matches[0].AssocItem
818 837
                    _attrs[attr] = self.attrs[matches[0]]   ### copy attribute value
819 838
                else:
820 839
                    _attrs[attr] = ''
......
823 842
                if attr.AttributeType == 'Size Text Item' or attr.AttributeType == 'Text Item' or attr.AttributeType == 'Valve Oper Code':
824 843
                    at = int(attr.AttrAt)
825 844
                    items = [text for text in _texts if QEngineeringAbstractItem.assoc_type(text) == attr.AttributeType]
826
                    if len(items) > at:
827
                        item = items[at]
845
                    if not attr.AssocItem and len(items) > at:
846
                        attr.AssocItem = items[at]
847
                        item = attr.AssocItem
848
                        _attrs[attr] = eval(attr.Expression) if attr.Expression else ''
849
                    elif attr.AssocItem:
850
                        item = attr.AssocItem
828 851
                        _attrs[attr] = eval(attr.Expression) if attr.Expression else ''
829 852
                    else:
830 853
                        _attrs[attr] = ''
831 854
                elif attr.AttributeType == 'Symbol Item':
832 855
                    at = int(attr.AttrAt)
833
                    if len(_symbols) > at:
834
                        item = _symbols[at]
856
                    if not attr.AssocItem and len(_symbols) > at:
857
                        attr.AssocItem = _symbols[at]
858
                        item = attr.AssocItem
859
                        _attrs[attr] = eval(attr.Expression) if attr.Expression else ''
860
                    elif attr.AssocItem:
861
                        item = attr.AssocItem
835 862
                        _attrs[attr] = eval(attr.Expression) if attr.Expression else ''
836 863
                    else:
837 864
                        _attrs[attr] = ''
DTI_PID/DTI_PID/SymbolAttr.py
117 117
        self.AttrAt = None
118 118
        self.Expression = None
119 119
        self.Length = None
120
        self.AssocItem = None
120 121

  
121 122
    @staticmethod
122 123
    def fromXml(node):
......
132 133
        attr.AttrAt = node.attrib['AttrAt']
133 134
        attr.Expression = node.attrib['Expression']
134 135
        attr.Length = node.attrib['Length']
136
        attr.AssocItem = uuid.UUID(node.attrib['AssocItem'], version=4) if 'AssocItem' in node.attrib and node.attrib['AssocItem'] != '' else None
135 137

  
136 138
        return attr
137 139

  
......
148 150
        node.attrib['AttrAt'] = str(self.AttrAt) if self.AttrAt is not None else ''
149 151
        node.attrib['Expression'] = self.Expression if self.Expression is not None else ''
150 152
        node.attrib['Length'] = str(self.Length) if self.Length is not None else ''
153
        node.attrib['AssocItem'] = str(self.AssocItem) if self.AssocItem is not None else ''
151 154

  
152 155
        return node

내보내기 Unified diff

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