프로젝트

일반

사용자정보

개정판 0e14457d

ID0e14457d390c9e4788a9a63280212269e2d05980
상위 420c6d72
하위 8b800913

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

symbol context

Change-Id: I091eeb83a1e428acfbfc3bd6d23b95122fe1c1cc

차이점 보기:

DTI_PID/DTI_PID/MainWindow.py
3376 3376

  
3377 3377
                symbolItems = [symbol for symbol in self.graphicsView.scene().selectedItems() if
3378 3378
                               issubclass(type(symbol), SymbolSvgItem)]
3379
                if len(symbolItems) is not 1:
3380
                    return
3381
                    
3382
                target_symbol = symbolItems[0]
3383
                index =  [index for index in range(len(target_symbol.conn_type)) \
3384
                            if QEngineeringLineItem.check_piping(target_symbol.conn_type[index], True)]
3385
                for connector in target_symbol.connectors:
3386
                    svg = QtImageViewer.createSymbolObject(symName)
3387
                    if len(svg.connectors) > 1: 
3388
                        if ((target_symbol.conn_type and target_symbol.connectors.index(connector) in index) or not target_symbol.conn_type) and \
3389
                                    (not connector.connectedItem or (connector.connectedItem and type(connector.connectedItem) is QEngineeringLineItem)):
3390
                            QtImageViewer.matchSymbolToLine(self.graphicsView.scene(), svg, connector.sceneBoundingRect().center())
3391
                    elif len(svg.connectors) == 1:
3392
                        if ((target_symbol.conn_type and target_symbol.connectors.index(connector) in index) or not target_symbol.conn_type) and \
3393
                                    not connector.connectedItem:
3394
                            QtImageViewer.matchSymbolToLine(self.graphicsView.scene(), svg, connector.sceneBoundingRect().center())
3395

  
3396
                if target_symbol:
3379
                
3380
                for symbolItem in symbolItems:
3381
                    target_symbol = symbolItem
3382
                    index =  [index for index in range(len(target_symbol.conn_type)) \
3383
                                if QEngineeringLineItem.check_piping(target_symbol.conn_type[index], True)]
3384
                    for connector in target_symbol.connectors:
3385
                        svg = QtImageViewer.createSymbolObject(symName)
3386
                        if len(svg.connectors) > 1: 
3387
                            if ((target_symbol.conn_type and target_symbol.connectors.index(connector) in index) or not target_symbol.conn_type) and \
3388
                                        (not connector.connectedItem or (connector.connectedItem and type(connector.connectedItem) is QEngineeringLineItem)):
3389
                                QtImageViewer.matchSymbolToLine(self.graphicsView.scene(), svg, connector.sceneBoundingRect().center())
3390
                        elif len(svg.connectors) == 1:
3391
                            if ((target_symbol.conn_type and target_symbol.connectors.index(connector) in index) or not target_symbol.conn_type) and \
3392
                                        not connector.connectedItem:
3393
                                QtImageViewer.matchSymbolToLine(self.graphicsView.scene(), svg, connector.sceneBoundingRect().center())
3394

  
3395
                if symbolItems:
3397 3396
                    return
3398 3397
            elif event.key() == Qt.Key_X:
3399 3398
                pass
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1274 1274
            moveAction.triggered.connect(self.contextMove)
1275 1275
            menu.addAction(moveAction)
1276 1276

  
1277
            replaceAction = QAction('Replace This to Selected Symbol(I, Q)', None)
1278
            replaceAction.triggered.connect(self.contextReplace)
1279
            menu.addAction(replaceAction)
1280

  
1281
            insertAction = QAction('Insert Selected Symbol to This(J)', None)
1282
            insertAction.triggered.connect(self.contextInsert)
1283
            menu.addAction(insertAction)
1284

  
1277 1285
            menu.exec_(event.screenPos())
1278 1286

  
1279 1287

  
......
1330 1338
        self.scene().keyPressEvent(event)
1331 1339

  
1332 1340
    def contextReplace(self):
1341
        from App import App
1342

  
1333 1343
        event = QKeyEvent(QEvent.KeyPress, Qt.Key_I, Qt.NoModifier)
1334
        self.scene().keyPressEvent(event)
1344
        App.mainWnd().keyPressEvent(event)
1335 1345

  
1336 1346
    def contextInsert(self):
1347
        from App import App
1348

  
1337 1349
        event = QKeyEvent(QEvent.KeyPress, Qt.Key_J, Qt.NoModifier)
1338
        self.scene().keyPressEvent(event)
1350
        App.mainWnd().keyPressEvent(event)
1339 1351

  
1340 1352
    def contextShowOnARS(self):
1341 1353
        from TcpServer import TcpSocket

내보내기 Unified diff

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