프로젝트

일반

사용자정보

개정판 ca43fed5

IDca43fed532b03fbcbf65590951bbf4dcae5350d7
상위 bd51b53d
하위 f1187004, 62fd5ea0

백흠경이(가) 5년 이상 전에 추가함

issue #1053: 생성한 장치의 데이터 입력 - 기기에 맞는 다이얼로그를 띄우는 로직 개선

Change-Id: I0d5cb23c21c38a9a04530fe6cb22d3a5702142f4

차이점 보기:

HYTOS/HYTOS/AirFinCooler.py
20 20

  
21 21
        self.ui = AirFinCooler_UI.Ui_AirFinCoolerDialog()
22 22
        self.ui.setupUi(self)
23
        self.ui.lineEdit_Pressure.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_Pressure))
24
        self.ui.lineEdit_Elevation.setValidator(QtGui.QDoubleValidator(self.ui.lineEdit_Elevation))
23 25
        self.initialize()
24 26

  
25 27
    def showDialog(self, item):
26 28
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
29
        self._item = item
27 30

  
28 31
        self.ui.lineEdit_TagNo.setFocus()
29 32
        self.set_controls(item)
30
        self.load_units()
33
        self.load_data()
31 34
        
32 35
        self.exec_()
33 36

  
......
37 40
    def set_controls(self, item):    
38 41
        self.ui.label_Img.setVisible(True)
39 42

  
40
    def load_units(self):
43
    def load_data(self):
44
        """ display tag no and nozzle data """
41 45
        from Drawing import Drawing
42
        
43
        appDocData = AppDocData.instance()
44
        drawing = appDocData.activeDrawing    
46

  
47
        app_doc_data = AppDocData.instance()
48
        drawing = app_doc_data.activeDrawing    
45 49
        if drawing:
46 50
            for attr in drawing.attrs:
47 51
                if attr[0] == 'Units':
48 52
                    self.ui.label_PressureUnit.setText(attr[1]['Pressure'])
49 53
                    self.ui.label_ElevationUnit.setText(attr[1]['Length'])
50
                    
51
    def accept(self):       
54

  
55
        matches = [connector.nozzle_data for connector in self._item.connectors if connector.nozzle_data]
56
        if matches:
57
            self.ui.lineEdit_Pressure.setText(matches[0].pressure)
58
            self.ui.lineEdit_Elevation.setText(matches[0].elevation)
59

  
60
    def accept(self):
61
        """ set tag no and nozzle data """
62
        from EngineeringConnectorItem import NozzleData
63

  
64
        for connector in self._item.connectors:
65
            if not connector.nozzle_data: connector.nozzle_data = NozzleData()
66
            connector.nozzle_data.pressure = self.ui.lineEdit_Pressure.text()
67
            connector.nozzle_data.elevation = self.ui.lineEdit_Elevation.text()
68

  
52 69
        QDialog.accept(self)
53 70

  
54 71
    def reject(self):
HYTOS/HYTOS/Shapes/EngineeringConnectorItem.py
16 16

  
17 17
from EngineeringAbstractItem import QEngineeringAbstractItem
18 18

  
19
class NozzleData:
20
    """ this is nozzle data class """
21

  
22
    def __init__(self):
23
        """ constructor """
24
        self.pressure = None
25
        self.elevation = None
26

  
19 27
"""
20 28
    A {ConnectorItem} is the graphical representation of a {Symbol.Connectors}.
21 29
"""
22 30
class QEngineeringConnectorItem(QGraphicsEllipseItem):
23
    """
24
    This is engineering connector item class
25
    """
31
    """ This is engineering connector item class """
26 32
    SMALL_SIZE = 10
27 33
    BIG_SIZE = 16
28 34
    HIGHLIGHT = '#BC4438'
......
54 60
        self.sceneConnectPoint = None
55 61
        self.connectPoint = None
56 62
        self._hoverItem = None
63
        self._nozzle_data = None
57 64

  
58 65
        self.setAcceptHoverEvents(True)
59 66
        self.transfer = Transfer()
......
81 88
        return res
82 89

  
83 90
    @property
91
    def nozzle_data(self):
92
        """ getter of nozzle data """
93
        return self._nozzle_data
94

  
95
    @nozzle_data.setter
96
    def nozzle_data(self, value):
97
        """ setter of nozzle data """
98
        self._nozzle_data = value
99

  
100
    @property
84 101
    def connectedItem(self):
85 102
        """ getter of connectedItem """
86 103
        import uuid
HYTOS/HYTOS/Shapes/SymbolSvgItem.py
631 631
        @date       2019.04.16
632 632
    '''
633 633
    def mouseDoubleClickEvent(self, event):
634
        func_map = [
635
            (('Equipment - [ Pressure Drop ]', 'Air Fin Cooler', 'Air Fin Cooler'), self.show_AirFinCooler),
636
            (('Equipment - [ Pressure Drop ]', 'Filter', ('Horizontal','Vertical')), self.show_Filter),
637
            (('Equipment - [ Pressure Drop ]', 'Heat Exchanger', ('Double Pipe','Horizontal','Vertical','Kettle')), self.show_ShlTubHeatExchanger),
638
            (('Equipment - [ Pressure Drop ]', 'Heat Exchanger', ('Plate')), self.show_PlateHeatExchanger),
639
            (('Equipment - [ Pressure Drop ]', 'Miscellaneous', ('Coil')), self.show_Coil),
640
            (('Equipment - [ Pressure Drop ]', 'Miscellaneous', ('Equipment')), self.show_DP_Equipment),
641
            (('Equipment - [ Pressure Drop ]', 'Miscellaneous', ('Reactor')), self.show_Reactor),
642
            (('Equipment - [ Pressure Drop ]', 'Strainer', ('Horizontal T','Vertical T')), self.show_Strainer_T),
643
            (('Equipment - [ Pressure Drop ]', 'Strainer', ('Horizontal Y','Vertical Y')), self.show_Strainer_Y),
644
            (('Equipment - [ Pressurized ]', 'Battery Limit', None), self.show_BatteryLimit),
645
            (('Equipment - [ Pressurized ]', 'Column', ('Tray')), self.show_Tray),
646
            (('Equipment - [ Pressurized ]', 'Column', ('Single Packed')), self.show_SinglePacked),
647
            (('Equipment - [ Pressurized ]', 'Column', ('Dual Packed')), self.show_DualPacked),
648
            (('Equipment - [ Pressurized ]', 'Drum', ('Horizontal')), self.show_Drum_Horizontal),
649
            (('Equipment - [ Pressurized ]', 'Drum', ('Vertical')), self.show_Drum_Vertical),
650
            (('Equipment - [ Pressurized ]', 'Miscellaneous', ('Equipment')), self.show_Equipment),
651
            (('Equipment - [ Pressurized ]', 'Tank', ('Ball')), self.show_Ball),
652
            (('Equipment - [ Pressurized ]', 'Tank', ('Cone Roof')), self.show_ConeRoof),
653
            (('Equipment - [ Rotating ]', 'Compressor', ('Left','Right')), self.show_Compressor),
654
            (('Equipment - [ Rotating ]', 'Pump', ('Horizontal Left','Horizontal Right','Vertical')), self.show_Pump),
655
            (('Instrument', 'Valve', ('Horizontal Control','Vertical Control')), self.show_ValveControl),
656
            (('Instrument', 'Valve', ('Horizontal Manual','Vertical Manual')), self.show_ValveManual),
657
            (('Instrument', 'Line Splitter', ('Line Splitter')), self.show_LineSplitter),
658
            (('Instrument', 'Flowmeter', ('Horizontal Orifice','Horizontal Others','Horizontal Venturi','Vertical Orifice','Vertical Others','Vertical Venturi')), self.show_Flowmeter),
659
            (('Instrument', 'Reducer', ('Down','Left','Right','Up')), self.show_Reducer)
660
            ]
634 661

  
635 662
        connectedItems = [connector for connector in self.connectors if connector.connectedItem is not None]
636 663
        if len(connectedItems) < 1:     
637 664

  
638 665
            msg = QMessageBox()
639 666
            msg.setIcon(QMessageBox.Information)
640
            msg.setText('Connect Line before Data input')
667
            msg.setText(self.tr('Connect Line before Data input'))
641 668
            msg.setWindowTitle(self.tr("Notice"))
642 669
            msg.setStandardButtons(QMessageBox.Ok)
643 670
            msg.exec_()       
644 671
            return
645 672

  
646
        category = self.category
647
        type = self.type
648
        name = self.name
649

  
650
        if category == 'Equipment - [ Pressure Drop ]':           
651
            if type == 'Air Fin Cooler':
652
                if name == 'Air Fin Cooler':
653
                    self.show_AirFinCooler()
654
            elif type == 'Filter':
655
                if name == 'Horizontal' or name == 'Vertical':
656
                    self.show_Filter()
657
            elif type == 'Heat Exchanger':
658
                if name == 'Double Pipe' or name == 'Horizontal' or name == 'Vertical' or name == 'Kettle':
659
                    self.show_ShlTubHeatExchanger()
660
                elif name == 'Plate':
661
                    self.show_PlateHeatExchanger()
662
            elif type == 'Miscellaneous':
663
                if name == 'Coil':
664
                    self.show_Coil()
665
                elif name == 'Equipment':
666
                    self.show_DP_Equipment()
667
                elif name == 'Reactor':
668
                    self.show_Reactor()                    
669
            elif type == 'Strainer':
670
                if name == 'Horizontal T' or name == 'Vertical T':
671
                    self.show_Strainer_T()
672
                elif name == 'Horizontal Y' or name == 'Vertical Y':
673
                    self.show_Strainer_Y()      
674
        elif category == 'Equipment - [ Pressurized ]':
675
            if type == 'Battery Limit':
676
                self.show_BatteryLimit()
677
            elif type == 'Column':
678
                if name == 'Tray':
679
                    self.show_Tray()
680
                elif name == 'Single Packed':
681
                    self.show_SinglePacked()
682
                elif name == 'Dual Packed':
683
                    self.show_DualPacked()
684
            elif type == 'Drum':
685
                if name == 'Horizontal':
686
                    self.show_Drum_Horizontal()
687
                elif name == 'Vertical':
688
                    self.show_Drum_Vertical()
689
            elif type == 'Miscellaneous':
690
                if name == 'Equipment':
691
                    self.show_Equipment()    
692
            elif type == 'Tank':                
693
                if name == 'Ball':
694
                    self.show_Ball()    
695
                elif name == 'Cone Roof':
696
                    self.show_ConeRoof()    
697
                elif name == 'Dome Roof':
698
                    self.show_DomeRoof()   
699
        elif category == 'Equipment - [ Rotating ]':
700
            if type == 'Compressor':
701
                if name == 'Left' or name == 'Right':
702
                    self.show_Compressor()
703
            elif type == 'Pump':
704
                if name == 'Horizontal Left' or name == 'Horizontal Right' or name == 'Vertical':
705
                    self.show_Pump()
706
        elif category == 'Instrument':
707
            if type == 'Valve':
708
                if name == 'Horizontal Control' or name == 'Vertical Control':
709
                    self.show_ValveControl()
710
                elif name == 'Horizontal Manual' or name == 'Vertical Manual':
711
                    self.show_ValveManual()
712
            elif type == 'Line Splitter':
713
                if name == 'Line Splitter':
714
                    self.show_LineSplitter()
715
            elif type == 'Flowmeter':
716
                if name == 'Horizontal Orifice' or name == 'Horizontal Others' or name == 'Horizontal Venturi' or name == 'Vertical Orifice' or name == 'Vertical Others' or name == 'Vertical Venturi':
717
                    self.show_Flowmeter()
718
            elif type == 'Reducer':
719
                if name == 'Down' or name == 'Left' or name == 'Right' or name == 'Up':
720
                    self.show_Reducer()
721

  
673
        matches = [func for func in func_map if func[0][0] == self.category and func[0][1] == self.type and (func[0][2] is None or self.name in func[0][2])]
674
        if matches: matches[0][1]()
722 675

  
723 676
    def show_AirFinCooler(self):
724 677
        from AirFinCooler import QAirFinCooler

내보내기 Unified diff

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