프로젝트

일반

사용자정보

개정판 e215fb87

IDe215fb87632c27a25bee4eec8d714204e5faa160
상위 7cdf0e9a
하위 3f1aaa2d, 423d6366

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

issue #000: add default line type to template db and end break on going and fix connecter graphic

Change-Id: I9126002c0c3dfe6f23ee60a3ec5ca54d2803d0b6

차이점 보기:

DTI_PID/DTI_PID/LineNoTracer.py
476 476
            #for line in lines: line.lineType = 'Primary'
477 477
            for line in lines: line.update_line_type()
478 478

  
479
        """make line end break"""
479
        """make end break"""
480 480
        end_breaks = []
481 481
        for lineNo in lineNos:
482 482
            for end_break in lineNo.end_break():
......
485 485
            for end_break in end_breaks:
486 486
                end_break.addSvgItemToScene(worker.graphicsView.scene)
487 487

  
488
        if end_breaks:
489
            # check dulplication
490
            dupl = set()
491
            for i in range(len(end_breaks)):
492
                for j in range(len(end_breaks)):
493
                    if i == j:
494
                        continue
495
                    else:
496
                        setI = set([end_breaks[i].owner, end_breaks[i].prop('Connected Item')])
497
                        setJ = set([end_breaks[j].owner, end_breaks[j].prop('Connected Item')])
498
                        if not (setI - setJ):
499
                            index = [i, j]
500
                            index.sort()
501
                            index = tuple(index)
502
                            dupl.add(index)
503

  
504
            dupl = [indexSet[1] for indexSet in list(dupl)]
505
            dupl.sort(reverse=True)
506
            for index in dupl:
507
                end_breaks.pop(index)
508

  
488 509
    except Exception as ex:
489 510
        from App import App 
490 511
        message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py
232 232
            self.setPen(Qt.black)
233 233
            self.setBrush(Qt.yellow) if self.connectedItem else self.setBrush(Qt.blue)
234 234

  
235
        self.setZValue(self.parentItem().zValue() + 1)
235
        if self.parentItem(): self.setZValue(self.parentItem().zValue() + 1)
236 236
        if self.scene().sceneRect().contains(self.sceneBoundingRect()):
237 237
            self.update()
238 238
        else:
......
420 420
    def paint(self, painter, options=None, widget=None):
421 421
        QGraphicsEllipseItem.paint(self, painter, options, widget)
422 422

  
423
        self._label.setDefaultTextColor(Qt.red) if self.parentItem().hover else self._label.setDefaultTextColor(Qt.black)
423
        if self.parentItem() is not None:
424
            self._label.setDefaultTextColor(Qt.red) if self.parentItem().hover else self._label.setDefaultTextColor(Qt.black)
424 425

  
425 426
    '''
426 427
        @brief      check Overlap
DTI_PID/DTI_PID/Shapes/EngineeringEndBreakItem.py
34 34
        #attr.AttributeType = 'Comp Item'
35 35
        #self.attrs[attr] = None
36 36

  
37
        self._properties[SymbolProp(None, 'Connected Line', 'Comp Item')] = None
37
        self._properties[SymbolProp(None, 'Connected Item', 'Comp Item')] = None
38 38

  
39 39
    '''
40 40
    def setPosition(self, loc, origin):
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py
391 391
            symbol = AppDocData.instance().getSymbolByQuery('name', svgFileName)
392 392
            svgFilePath = os.path.join(AppDocData.instance().getCurrentProject().getSvgFilePath(), symbol.getType(), svgFileName+'.svg')
393 393

  
394
            if type(line_from) is QEngineeringLineItem and line_from.connectors[0].connectedItem is not None and type(line_from.connectors[0].connectedItem) is QEngineeringLineItem:
394
            if (type(line_from) is QEngineeringLineItem or issubclass(type(line_from), SymbolSvgItem)) and line_from.connectors[0].connectedItem is not None and (type(line_from.connectors[0].connectedItem) is QEngineeringLineItem or issubclass(type(line_from.connectors[0].connectedItem), SymbolSvgItem)):
395 395
                end_break = SymbolSvgItem.createItem(symbol.getType(), svgFilePath)
396 396
                pt = [line_from.connectors[0].center()[0] - float(symbol.getOriginalPoint().split(',')[0]), line_from.connectors[0].center()[1] - float(symbol.getOriginalPoint().split(',')[1])]
397 397
                origin = [0,0]
......
405 405
                #    if attr.Attribute == 'Connected Line':
406 406
                #        attrs[attr] = str(line_from.connectors[0].connectedItem.uid)
407 407
                for prop, value in end_break.properties.items():
408
                    if prop.Attribute == 'Connected Line':
408
                    if prop.Attribute == 'Connected Item':
409 409
                        end_break.properties[prop] = line_to.connectors[0].connectedItem
410 410
                end_break.setToolTip('owner : ' + str(line_to))
411 411
                end_break.area = 'Drawing'
412 412
                end_break.owner = line_from
413 413
                end_breaks.append(end_break)
414 414

  
415
            if type(line_to) is QEngineeringLineItem and line_to.connectors[1].connectedItem is not None and type(line_to.connectors[1].connectedItem) is QEngineeringLineItem:
415
            if (type(line_to) is QEngineeringLineItem or issubclass(type(line_to), SymbolSvgItem)) and line_to.connectors[1].connectedItem is not None and (type(line_from.connectors[1].connectedItem) is QEngineeringLineItem or issubclass(type(line_from.connectors[1].connectedItem), SymbolSvgItem)):
416 416
                end_break = SymbolSvgItem.createItem(symbol.getType(), svgFilePath)
417 417
                pt = [line_to.connectors[1].center()[0] - float(symbol.getOriginalPoint().split(',')[0]), line_to.connectors[1].center()[1] - float(symbol.getOriginalPoint().split(',')[1])]
418 418
                origin = [0,0]
......
426 426
                #    if attr.Attribute == 'Connected Line':
427 427
                #        attrs[attr] = str(line_to.connectors[1].connectedItem.uid)
428 428
                for prop, value in end_break.properties.items():
429
                    if prop.Attribute == 'Connected Line':
429
                    if prop.Attribute == 'Connected Item':
430 430
                        end_break.properties[prop] = line_to.connectors[1].connectedItem
431 431
                end_break.setToolTip('owner : ' + str(line_to))
432 432
                end_break.area = 'Drawing'

내보내기 Unified diff

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