프로젝트

일반

사용자정보

개정판 d3162ecb

IDd3162ecb0d1dba7300015adcbf3d28051bf4e1a5
상위 4d0869ef
하위 30b8dfd2

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

issue #49: fix table

Change-Id: I1190994f5527d982f2886231b4fb349ad666a7e8

차이점 보기:

DTI_PID/DTI_PID/CodeTables.py
24 24
                    self.values.append((x[0], x[1], x[2], allowable))
25 25
                else:
26 26
                    self.values.append((x[0], x[1], x[2], [allowable[0]] + sorted(allowable[1:], key=lambda param:len(param), reverse=True)))
27

  
28
            self.values = sorted(self.values, key=lambda param:len(param[1]), reverse=True)
27 29
        else:
28 30
            self.values = values
29 31

  
DTI_PID/DTI_PID/Commands/ReplaceInsertCommand.py
28 28
    def __init__(self):
29 29
        super(ReplaceInsertCommand, self).__init__(None)
30 30

  
31
    def item_remove(self, items):
32
        for item in items:
33
            item.transfer.onRemoved.emit(item)
34

  
31 35
    def execute(self, scene, find_symbol, replace_symbol, replace_action, condition, custom=None, strict=False, auto=True):
32 36
        """replace or insert symbol"""
33 37

  
DTI_PID/DTI_PID/MainWindow.py
2490 2490
                item._cond.wakeAll()
2491 2491
        '''
2492 2492

  
2493

  
2493 2494
    def connect_attributes(self, MainWindow):
2494 2495
        """connect attributes to symbol"""
2495 2496
        from LineNoTracer import LineNoTracer
DTI_PID/DTI_PID/RecognitionDialog.py
92 92
    add_predata_to_scene = pyqtSignal(Drawing, QGraphicsScene, bool, bool, bool, bool, bool)
93 93
    clear_scene = pyqtSignal(QGraphicsScene, QGraphicsScene, QGraphicsScene)
94 94
    preset_execute = pyqtSignal(QGraphicsScene, str, str, str, str)
95
    onRemoved = pyqtSignal(list)
95
    item_remove = pyqtSignal(list)
96 96

  
97 97
    def __init__(self, mutex, cond):
98 98
        super(Worker, self).__init__()
......
1277 1277
                        worker.displayLog.emit(MessageType.Error, message)
1278 1278
                    # up to here
1279 1279

  
1280
                    configs = app_doc_data.getConfigs('Project', 'Operation')
1281
                    instrument = int(configs[0].value) if configs else 1
1282

  
1280 1283
                    # detect flange
1281 1284
                    try:
1282
                        for sym in symbols:
1283
                            if sym.conn_type:
1284
                                for index in range(len(sym.conn_type)):
1285
                                    item = sym.connectors[index].connectedItem
1286
                                    if item and type(item) is QEngineeringLineItem:
1287
                                        #worker.detectFlangeOnPid(sym, app_doc_data.activeDrawing.image_origin, worker, app_doc_data._imgFilePath, app_doc_data)
1288
                                        point = worker.detectFlangeOnPid(sym, sym.connectors[index], item, app_doc_data.activeDrawing.image_origin)
1289
                                        if point is not None:
1290
                                            flange_list.append(point)
1291
                                            pass
1285
                        if instrument == 1:
1286
                            for sym in symbols:
1287
                                if sym.conn_type:
1288
                                    for index in range(len(sym.conn_type)):
1289
                                        item = sym.connectors[index].connectedItem
1290
                                        if item and type(item) is QEngineeringLineItem:
1291
                                            #worker.detectFlangeOnPid(sym, app_doc_data.activeDrawing.image_origin, worker, app_doc_data._imgFilePath, app_doc_data)
1292
                                            point = worker.detectFlangeOnPid(sym, sym.connectors[index], item, app_doc_data.activeDrawing.image_origin)
1293
                                            if point is not None:
1294
                                                flange_list.append(point)
1295
                                                pass
1292 1296
                    except Exception as ex:
1293 1297
                        message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
1294 1298
                                  f"{sys.exc_info()[-1].tb_lineno}"
......
1351 1355

  
1352 1356
                # remove piping line and text for instrument mode
1353 1357
                try:
1354
                    configs = app_doc_data.getConfigs('Project', 'Operation')
1355
                    instrument = int(configs[0].value) if configs else 1
1356
                    remove_items = []
1357 1358
                    if instrument == -1:
1358 1359
                        # remove piping line
1360
                        remove_items = []
1361

  
1359 1362
                        for line in reversed(app_doc_data.lines):
1360 1363
                            if line.is_piping(True):
1361 1364
                                app_doc_data.lines.remove(line)
......
1369 1372
                                '''
1370 1373

  
1371 1374
                        # remove text
1372
                        for text in reversed([text for text in app_doc_data.texts if type(text) is QEngineeringTextItem]):
1375
                        for text in reversed([text for text in app_doc_data.texts if type(text) is QEngineeringTextItem and text.area == 'Drawing']):
1373 1376
                            contained = False
1374 1377
                            for symbol in app_doc_data.symbols:
1375 1378
                                if symbol.includes([text.sceneBoundingRect().center().x(), text.sceneBoundingRect().center().y()]):
......
1378 1381
                            if not contained:
1379 1382
                                remove_items.append(text)
1380 1383

  
1381
                        worker.onRemoved.emit(remove_items)
1384
                        worker.item_remove.emit(remove_items)
1382 1385
                        worker.cond.wait(worker.mutex)
1383 1386

  
1384 1387
                except Exception as ex:
1385
                    message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1386
                                                            sys.exc_info()[-1].tb_lineno)
1387
                    App.mainWnd().addMessage.emit(MessageType.Error, message)
1388
                    message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
1389
                                  f"{sys.exc_info()[-1].tb_lineno}"
1390
                    worker.displayLog.emit(MessageType.Error, message)
1388 1391
                # up to here
1389 1392

  
1390 1393
                worker.save_scene.emit(worker.scene)
......
3467 3470
        self.obj.add_detected_items_to_scene.connect(self.add_detected_items_to_scene)
3468 3471
        self.obj.save_scene.connect(self.save_scene)
3469 3472
        self.obj.preset_execute.connect(self.preset_execute)
3470
        self.obj.onRemoved.connect(self.onRemoved)
3473
        self.obj.item_remove.connect(self.item_remove)
3471 3474
        self.obj.add_predata_to_scene.connect(self.add_predata_to_scene)
3472 3475
        self.obj.clear_scene.connect(self.clear_scene)
3473 3476

  
......
3586 3589
        finally:
3587 3590
            self.cond.wakeAll()
3588 3591

  
3589
    def onRemoved(self, items):
3590
        """ run preset """
3592
    def item_remove(self, items):
3593
        """ remove useless items """
3591 3594
        from App import App
3592 3595

  
3593 3596
        try:
3594 3597
            for item in items:
3595
                item.transfer.onRemoved.emit(item)
3598
                #item.transfer.onRemoved.emit(item)
3599
                App.mainWnd().itemRemoved(item)
3600
            '''
3601
            from ReplaceInsertCommand import ReplaceInsertCommand
3602

  
3603
            cmd = ReplaceInsertCommand()
3604
            cmd.display_message.connect(App.mainWnd().onAddMessage)
3605
            cmd.item_remove(items)
3606
            '''
3596 3607

  
3597 3608
        except Exception as ex:
3598 3609
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
3599 3610
                                                           sys.exc_info()[-1].tb_lineno)
3600 3611
            App.mainWnd().addMessage.emit(MessageType.Error, message)
3601 3612
        finally:
3602
            pass
3603
            #self.cond.wakeAll()
3613
            self.cond.wakeAll()
3604 3614
    
3605 3615
    def preset_execute(self, scene, find_symbol, replace_symbol, replace_action, condition):
3606 3616
        """ run preset """

내보내기 Unified diff

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