프로젝트

일반

사용자정보

개정판 6a9a247d

ID6a9a247df46dd7b8cd42af3b6b0cf484808a2f18
상위 a0ee9dd8
하위 16dfc99b

함의성이(가) 8달 전에 추가함

add setscale context, fix run sort, fix item tree

Change-Id: I9921faf84f7509546bc3c659846a122c5cd34517

차이점 보기:

DTI_PID/DTI_PID/ItemTreeWidget.py
636 636
                                parent.addChild(item)
637 637
                            break
638 638
            elif type(child) is QEngineeringLineNoTextItem:
639
                foundItems = self.findItems(child.text(), Qt.MatchExactly | Qt.MatchRecursive, 0)
639
                foundItems = self.findItems(child.text().replace('\n', ''), Qt.MatchExactly | Qt.MatchRecursive, 0)
640 640
                if foundItems is not None:
641 641
                    for item in foundItems:
642 642
                        data = item.data(0, self.TREE_DATA_ROLE)
DTI_PID/DTI_PID/LineNoTracer.py
370 370
                            _lineNo.runs[index].explode()
371 371
                # up to here
372 372

  
373
                # make fixed run
374
                for _lineNo in self._lineNos:
375
                    for _run in _lineNo.runs:
376
                        matches = [item for item in _run.items if type(item) is QEngineeringLineItem and item.prop('Freeze')]
377
                        if matches:
378
                            _run._fixed = True
379
                        else:
380
                            _run._fixed = False
381
                # up to here
382

  
373 383
                # sort line no with from,to value
374 384
                self._lineNos.sort(
375 385
                    key=lambda line_no: (1 if line_no.prop('From') else 0) + (1 if line_no.prop('To') else 0),
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1389 1389
            if type(self) is QEngineeringEquipmentItem:
1390 1390
                transform = QTransform().translate(self.symbolOrigin[0], self.symbolOrigin[1])
1391 1391
                if self.flip == 1:
1392
                    transform.scale(self.transform().m11() - 0.1, self.transform().m22() + 0.1)
1392
                    transform.scale(self.transform().m11() - 0.01, self.transform().m22() + 0.01)
1393 1393
                else:
1394
                    transform.scale(self.transform().m11() + 0.1, self.transform().m22() + 0.1)
1394
                    transform.scale(self.transform().m11() + 0.01, self.transform().m22() + 0.01)
1395 1395
                transform.translate(-self.symbolOrigin[0], -self.symbolOrigin[1])
1396 1396
                self.setTransform(transform)
1397 1397
            else:
......
1400 1400
            if type(self) is QEngineeringEquipmentItem:
1401 1401
                transform = QTransform().translate(self.symbolOrigin[0], self.symbolOrigin[1])
1402 1402
                if self.flip == 1:
1403
                    transform.scale(self.transform().m11() + 0.1 if self.transform().m11() + 0.1 < -0.3 else -0.3, self.transform().m22() - 0.1 if self.transform().m22() - 0.1 > 0.3 else 0.3)
1403
                    transform.scale(self.transform().m11() + 0.01 if self.transform().m11() + 0.01 < -0.3 else -0.3, self.transform().m22() - 0.01 if self.transform().m22() - 0.01 > 0.3 else 0.3)
1404 1404
                else:
1405
                    transform.scale(self.transform().m11() - 0.1 if self.transform().m11() - 0.1 > 0.3 else 0.3, self.transform().m22() - 0.1 if self.transform().m22() - 0.1 > 0.3 else 0.3)
1405
                    transform.scale(self.transform().m11() - 0.01 if self.transform().m11() - 0.01 > 0.3 else 0.3, self.transform().m22() - 0.01 if self.transform().m22() - 0.01 > 0.3 else 0.3)
1406 1406
                transform.translate(-self.symbolOrigin[0], -self.symbolOrigin[1])
1407 1407
                self.setTransform(transform)
1408 1408
            else:
......
1436 1436
            allAction.triggered.connect(self.contextSelectAll)
1437 1437
            menu.addAction(allAction)
1438 1438

  
1439
            scaleAction = QAction('Set Scale', None)
1440
            scaleAction.triggered.connect(self.contextScale)
1441
            menu.addAction(scaleAction)
1442

  
1439 1443
            moveAction = QAction('Move to Nearest(N)', None)
1440 1444
            moveAction.triggered.connect(self.contextMove)
1441 1445
            menu.addAction(moveAction)
......
1485 1489
            allAction.triggered.connect(self.contextSelectAll)
1486 1490
            menu.addAction(allAction)
1487 1491

  
1492
            scaleAction = QAction('Set Scale', None)
1493
            scaleAction.triggered.connect(self.contextScale)
1494
            menu.addAction(scaleAction)
1495

  
1488 1496
            batchAction = QAction('Set Batch(Insert)', None)
1489 1497
            batchAction.triggered.connect(self.contextBatch)
1490 1498
            menu.addAction(batchAction)
......
1522 1530
        if type(self.owner) is QEngineeringLineNoTextItem:
1523 1531
            self.owner.contextHighlight(self.owner)
1524 1532

  
1533
    def contextScale(self):
1534
        from EngineeringEquipmentItem import QEngineeringEquipmentItem
1535

  
1536
        text, result = QInputDialog.getDouble(None, self.tr('Symbol Scale'), self.tr('Input : '), self.scale(), 0.30, 100, 2, Qt.WindowFlags(), 0.01)
1537
		
1538
        try:
1539
            if result:
1540
                scale = round(float(text), 3)
1541
                if 0.30 <= scale < 100:
1542
                    symbols = [item for item in self.scene().items() if issubclass(type(item), SymbolSvgItem) and type(item) is not QEngineeringEquipmentItem]
1543
                    for symbol in symbols:
1544
                        symbol.setScale(scale)
1545
        except:
1546
            return
1547

  
1525 1548
    def contextSelectAll(self):
1526 1549
        from App import App
1527 1550
        

내보내기 Unified diff

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