프로젝트

일반

사용자정보

개정판 56bd2c0f

ID56bd2c0f1ab89eda7a85526625243f9230596b9c
상위 833bd7ff
하위 31aaca31

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

optimize drawing open

Change-Id: Icf84d32730e832f373b8404b358971d0b50390cb

차이점 보기:

DTI_PID/DTI_PID/Commands/LoadCommand.py
56 56
            for i in range(0, len(l), n):
57 57
                yield l[i:i + n]
58 58

  
59
        def update_items(items):
59
        def update_items(param):
60
            items, dic_items = param[0], param[1]
60 61
            for item in items:
61 62
                # binding items
62
                item.owner
63
                #item.owner
64
                #for connector in item.connectors:
65
                #    connector.connectedItem
66

  
67
                if item._owner and (type(item._owner) is uuid.UUID or type(item._owner) is not str):
68
                    if str(item._owner) in dic_items:
69
                        item._owner = dic_items[str(item._owner)]
70
                    else:
71
                        item._owner = None
72
                else:
73
                    item._owner = None
74

  
63 75
                for connector in item.connectors:
64
                    connector.connectedItem
76
                    if connector._connectedItem and (type(connector._connectedItem) is uuid.UUID or type(connector._connectedItem) is not str):
77
                        if str(connector._connectedItem) in dic_items:
78
                            connector._connectedItem = dic_items[str(connector._connectedItem)]
79
                        else:
80
                            connector._connectedItem = None
81
                    else:
82
                        connector._connectedItem = None
65 83

  
66 84
            return items
67 85

  
......
79 97
            """update items"""
80 98
            if update:
81 99
                _items = [_item for _item in scene.items() if hasattr(_item, 'owner') or hasattr(_item, 'connectors')]
100
                dic_items = {}
101
                for _item in _items:
102
                    dic_items[str(_item.uid)] = _item
103

  
82 104
                if _items:
83 105
                    items = divide_chunks(_items, App.THREAD_MAX_WORKER if len(_items) > App.THREAD_MAX_WORKER else
84 106
                    len(_items))
85 107
                    with futures.ThreadPoolExecutor(max_workers=App.THREAD_MAX_WORKER) as pool:
86
                        future_items = {pool.submit(update_items, _items): _items for _items in items}
108
                        future_items = {pool.submit(update_items, (_items, dic_items)): _items for _items in items}
87 109
                        for future in futures.as_completed(future_items):
88 110
                            _items = future.result()
89 111
                            value = value + len(_items)
......
147 169
            if unknown:
148 170
                maxValue = maxValue + len(list(root.iter('UNKNOWN')))
149 171

  
150
            maxValue *= 2
172
            maxValue *= 5
151 173
            self.set_maximum.emit(maxValue) if maxValue > 0 else None
152 174

  
153 175
            if symbol:
......
167 189
                        item.setPen(QPen(Qt.red, 5, Qt.SolidLine))
168 190
                        scene.addItem(item)
169 191

  
170
                    value = value + 1
192
                    value = value + 4
171 193
                    self.show_progress.emit(value)
172 194

  
173 195
                QApplication.processEvents()
......
188 210
                                item.uid = uid.text
189 211
                                item.attribute = attributeValue.text
190 212

  
191
                    value = value + 1
213
                    value = value + 4
192 214
                    self.show_progress.emit(value)
193 215

  
194 216
                QApplication.processEvents()
......
206 228
                            if uid is not None:
207 229
                                item.uid = uid.text
208 230

  
209
                    value = value + 1
231
                    value = value + 4
210 232
                    self.show_progress.emit(value)
211 233

  
212 234
                QApplication.processEvents()
......
218 240
                        scene.addItem(item)
219 241
                        lines.append(item)
220 242

  
221
                    value = value + 1
243
                    value = value + 4
222 244
                    self.show_progress.emit(value)
223 245

  
224 246
                for line in root.find('LINEINFOS').iter('GRAPHICS_LINE'):
......
226 248
                    if item:
227 249
                        scene.addItem(item)
228 250

  
229
                    value = value + 1
251
                    value = value + 4
230 252
                    self.show_progress.emit(value)
231 253

  
232 254
                QApplication.processEvents()
......
237 259
                    if item is not None:
238 260
                        scene.addItem(item)
239 261

  
240
                    value = value + 1
262
                    value = value + 4
241 263
                    self.show_progress.emit(value)
242 264

  
243 265
                QApplication.processEvents()
......
276 298
                            line_run.owner = line_no
277 299
                            line_no.runs.append(line_run)
278 300

  
279
                    value = value + 1
301
                    value = value + 4
280 302
                    self.show_progress.emit(value)
281 303

  
282 304
                QApplication.processEvents()
......
313 335

  
314 336
                        app_doc_data.tracerLineNos.append(line_no)
315 337

  
316
                    value = value + 1
338
                    value = value + 4
317 339
                    self.show_progress.emit(value)
318 340

  
319 341
                # for inst attribute
......
343 365

  
344 366
                        app_doc_data._connected_items_lists = line_no
345 367

  
346
                    value = value + 1
368
                    value = value + 4
347 369
                    self.show_progress.emit(value)
348 370

  
349 371
                QApplication.processEvents()
......
417 439
            lines = []
418 440

  
419 441
            components = app_doc_data.get_components(drawing.UID)
420
            maxValue = len(components) * 2
442
            maxValue = len(components) * 5
421 443
            self.set_maximum.emit(maxValue) if maxValue > 0 else None
422 444

  
423 445
            if symbol:
......
438 460
                        item.setPen(QPen(Qt.red, 5, Qt.SolidLine))
439 461
                        scene.addItem(item)
440 462

  
441
                    value = value + 1
463
                    value = value + 4
442 464
                    self.show_progress.emit(value + 1)
443 465

  
444 466
                QApplication.processEvents()
......
454 476
                        name = text['Name']
455 477
                        item.addTextItemToScene(scene)
456 478

  
457
                    value = value + 1
479
                    value = value + 4
458 480
                    self.show_progress.emit(value)
459 481

  
460 482
                QApplication.processEvents()
......
469 491
                        name = note['Name']
470 492
                        item.addTextItemToScene(scene)
471 493

  
472
                    value = value + 1
494
                    value = value + 4
473 495
                    self.show_progress.emit(value)
474 496

  
475 497
                QApplication.processEvents()
......
482 504
                        scene.addItem(item)
483 505
                        lines.append(item)
484 506

  
485
                    value = value + 1
507
                    value = value + 4
486 508
                    self.show_progress.emit(value)
487 509

  
488 510
                QApplication.processEvents()
......
494 516
                    if item is not None:
495 517
                        scene.addItem(item)
496 518

  
497
                    value = value + 1
519
                    value = value + 4
498 520
                    self.show_progress.emit(value)
499 521

  
500 522
                QApplication.processEvents()
......
530 552
                                line_run.owner = line_no
531 553
                                line_no.runs.append(line_run)
532 554

  
533
                    value = value + 1
555
                    value = value + 4
534 556
                    self.show_progress.emit(value)
535 557

  
536 558
                QApplication.processEvents()
......
567 589

  
568 590
                        app_doc_data.tracerLineNos.append(line_no)
569 591

  
570
                    value = value + 1
592
                    value = value + 4
571 593
                    self.show_progress.emit(value)
572 594

  
573 595
                # for inst attribute
......
597 619

  
598 620
                        app_doc_data._connected_items_lists = line_no
599 621

  
600
                    value = value + 1
622
                    value = value + 4
601 623
                    self.show_progress.emit(value)
602 624

  
603 625
                QApplication.processEvents()
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py
138 138
        import uuid
139 139

  
140 140
        try:
141
            if self._owner and type(self._owner) is uuid.UUID:
141
            if self.scene() and self._owner and type(self._owner) is uuid.UUID:
142 142
                #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(self._owner)]
143 143
                matches = []
144 144
                for x in self.scene().items():
......
148 148
                if matches:
149 149
                    self._owner = matches[0]
150 150

  
151
                return matches[0] if matches else None
152

  
151 153
            if type(self._owner) is not uuid.UUID and type(self._owner) is not str:
152 154
                return self._owner
153 155
            else:
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py
95 95
        import uuid
96 96

  
97 97
        # find owner with uid
98
        if self.scene() and self._owner is not None and type(self._owner) is uuid.UUID:
98
        if self.scene() and self._owner and type(self._owner) is uuid.UUID:
99 99
            #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(self._owner)]
100 100
            matches = []
101 101
            for x in self.scene().items():
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
154 154
        """get owner"""
155 155
        import uuid
156 156

  
157
        if self._owner and type(self._owner) is uuid.UUID:
157
        if self.scene() and self._owner and type(self._owner) is uuid.UUID:
158 158
            #matches = [x for x in self.scene().items() if hasattr(x, 'uid') and str(x.uid) == str(self._owner)]
159 159
            matches = []
160 160
            for x in self.scene().items():
......
164 164
            if matches:
165 165
                self._owner = matches[0]
166 166

  
167
            return matches[0] if matches else None
168

  
167 169
        if type(self._owner) is not uuid.UUID and type(self._owner) is not str:
168 170
            return self._owner
169 171
        else:

내보내기 Unified diff

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