프로젝트

일반

사용자정보

개정판 76eaa3f7

ID76eaa3f744831c9bd9f000cbf4b2694532bcfa8d
상위 bcccebe9
하위 b2c42200

김연진이(가) 5년 이상 전에 추가함

issue #1047 스트림데이타 입력
- PhaseType 선택 대화상자 추가
- Symbol Drop시 Symbol Name이 아닌 UID 값으로 찾아오도록 변경 (동일한 Symbol Name이 있음)

Change-Id: Ibf8ae34bbe0b6a5c28fe24bae65953c6b81b149d

차이점 보기:

HYTOS/HYTOS/PhaseTypeDialog.py
1
# -*- coding: utf-8 -*-
2

  
3
# Form implementation generated from reading ui file 'ProjectDialog.ui'
4
#
5
# Created by: PyQt5 UI code generator 5.6
6
#
7
# WARNING! All changes made in this file will be lost!
8

  
9
from PyQt5 import QtCore, QtGui, QtWidgets
10
from PyQt5.QtWidgets import *
11
import os
12
from Project import Project
13
from AppDocData import AppDocData
14
import PhaseTypeDialog_UI
15
import math
16

  
17
class QPhaseTypeDialog(QDialog):
18
    def __init__(self, parent):
19
        QDialog.__init__(self, parent)
20

  
21
        self.ui = PhaseTypeDialog_UI.Ui_PhaseTypeDialog()
22
        self.ui.setupUi(self)
23
        self.selectedPhaseType = None
24
        self.initPhaseType()
25
        #self.degree = None
26
        #self.angle = angle
27
        #self.isAccepted = False
28
        #self.sx = loc[0]
29
        #self.sy = loc[1]
30
        #self.sz = zValue
31
        #self.ui.doubleSpinBox.setValue(round(180 * self.angle / math.pi))
32
        #self.ui.doubleSpinBoxX.setValue(self.sx)
33
        #self.ui.doubleSpinBoxY.setValue(self.sy)
34
        #self.ui.spinBoxZValue.setValue(self.sz)
35

  
36
    def initPhaseType(self):
37
        self.ui.comboBoxPhaseType.clear()
38

  
39
        self.ui.comboBoxPhaseType.addItem('Vapor (Compressible)', 'Vapor')
40
        self.ui.comboBoxPhaseType.addItem('Liquid (Incompressible)', 'Liquid')
41
        self.ui.comboBoxPhaseType.addItem('Mixed (Vapor + Liquid)', 'Mixed')
42
        
43
        self.ui.comboBoxPhaseType.setCurrentIndex(0)
44
        
45
    def showDialog(self):
46
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
47
        self.exec_()
48

  
49
        return self.selectedPhaseType
50

  
51
    def accept(self):
52
        index = self.ui.comboBoxPhaseType.currentIndex()
53
        phaseType = self.ui.comboBoxPhaseType.itemData(index)
54
        self.selectedPhaseType = phaseType
55
        QDialog.accept(self)
56

  
57
    def reject(self):
58
        QDialog.reject(self)
HYTOS/HYTOS/PhaseTypeDialog_UI.py
1
# -*- coding: utf-8 -*-
2

  
3
# Form implementation generated from reading ui file '.\UI\PhaseTypeDialog.ui'
4
#
5
# Created by: PyQt5 UI code generator 5.11.3
6
#
7
# WARNING! All changes made in this file will be lost!
8

  
9
from PyQt5 import QtCore, QtGui, QtWidgets
10

  
11
class Ui_PhaseTypeDialog(object):
12
    def setupUi(self, PhaseTypeDialog):
13
        PhaseTypeDialog.setObjectName("PhaseTypeDialog")
14
        PhaseTypeDialog.resize(350, 105)
15
        PhaseTypeDialog.setMinimumSize(QtCore.QSize(350, 0))
16
        PhaseTypeDialog.setMaximumSize(QtCore.QSize(350, 350))
17
        font = QtGui.QFont()
18
        font.setFamily("맑은 고딕")
19
        font.setBold(True)
20
        font.setWeight(75)
21
        PhaseTypeDialog.setFont(font)
22
        self.verticalLayout = QtWidgets.QVBoxLayout(PhaseTypeDialog)
23
        self.verticalLayout.setObjectName("verticalLayout")
24
        self.formLayout = QtWidgets.QFormLayout()
25
        self.formLayout.setObjectName("formLayout")
26
        self.StreamNo = QtWidgets.QLabel(PhaseTypeDialog)
27
        font = QtGui.QFont()
28
        font.setFamily("맑은 고딕")
29
        font.setPointSize(9)
30
        font.setBold(False)
31
        font.setWeight(50)
32
        self.StreamNo.setFont(font)
33
        self.StreamNo.setObjectName("StreamNo")
34
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.StreamNo)
35
        self.lineEditSteamNo = QtWidgets.QLineEdit(PhaseTypeDialog)
36
        self.lineEditSteamNo.setObjectName("lineEditSteamNo")
37
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.lineEditSteamNo)
38
        self.comboBoxPhaseType = QtWidgets.QComboBox(PhaseTypeDialog)
39
        font = QtGui.QFont()
40
        font.setBold(False)
41
        font.setWeight(50)
42
        self.comboBoxPhaseType.setFont(font)
43
        self.comboBoxPhaseType.setObjectName("comboBoxPhaseType")
44
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.comboBoxPhaseType)
45
        self.PhaseType = QtWidgets.QLabel(PhaseTypeDialog)
46
        font = QtGui.QFont()
47
        font.setFamily("맑은 고딕")
48
        font.setPointSize(9)
49
        font.setBold(False)
50
        font.setWeight(50)
51
        self.PhaseType.setFont(font)
52
        self.PhaseType.setObjectName("PhaseType")
53
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.PhaseType)
54
        self.verticalLayout.addLayout(self.formLayout)
55
        self.errorLabel = QtWidgets.QLabel(PhaseTypeDialog)
56
        self.errorLabel.setMaximumSize(QtCore.QSize(16777215, 0))
57
        self.errorLabel.setStyleSheet("")
58
        self.errorLabel.setText("")
59
        self.errorLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
60
        self.errorLabel.setObjectName("errorLabel")
61
        self.verticalLayout.addWidget(self.errorLabel)
62
        self.buttonBox = QtWidgets.QDialogButtonBox(PhaseTypeDialog)
63
        font = QtGui.QFont()
64
        font.setFamily("맑은 고딕")
65
        font.setBold(True)
66
        font.setWeight(75)
67
        self.buttonBox.setFont(font)
68
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
69
        self.buttonBox.setObjectName("buttonBox")
70
        self.verticalLayout.addWidget(self.buttonBox)
71

  
72
        self.retranslateUi(PhaseTypeDialog)
73
        self.buttonBox.rejected.connect(PhaseTypeDialog.reject)
74
        self.buttonBox.accepted.connect(PhaseTypeDialog.accept)
75
        QtCore.QMetaObject.connectSlotsByName(PhaseTypeDialog)
76

  
77
    def retranslateUi(self, PhaseTypeDialog):
78
        _translate = QtCore.QCoreApplication.translate
79
        PhaseTypeDialog.setWindowTitle(_translate("PhaseTypeDialog", "Select Phase Type"))
80
        self.StreamNo.setText(_translate("PhaseTypeDialog", "Stream No."))
81
        self.PhaseType.setText(_translate("PhaseTypeDialog", "Phase Type"))
82

  
HYTOS/HYTOS/QtImageViewer.py
542 542
            self._underItem = None
543 543

  
544 544
        scenePos = self.mapToScene(event.pos())
545
        svgFileName = event.mimeData().text()
546
        svg = self.createSymbolObject(svgFileName)
545
        uid = event.mimeData().text()
546
        svg = self.createSymbolObject(uid)
547 547
        self.matchSymbolToLine(svg, scenePos)
548 548

  
549 549
        #if type(svg) is QEngineeringSpecBreakItem:
......
561 561
        @author kyouho
562 562
        @date   2018.07.27
563 563
    '''
564
    def createSymbolObject(self, svgFileName):
564
    def createSymbolObject(self, uid):
565 565
        from AppDocData import AppDocData
566 566
        import symbol
567 567
        
568
        symbol = AppDocData.instance().getSymbolByQuery('name', svgFileName)
568
        symbol = AppDocData.instance().getSymbolByQuery('uid', uid)
569
        svgFileName = symbol.getName()
569 570
        svgFilePath = os.path.join(AppDocData.instance().getCurrentProject().getSvgFilePath(), symbol.getCategory(), symbol.getType(), svgFileName+'.svg')
570 571
        svg = SymbolSvgItem.createItem(symbol.getType(), svgFilePath)
571 572
        connPts = None
......
574 575
            connPts = [(float(x.split(',')[0]), float(x.split(',')[1])) if len(x.split(',')) == 2 else (x.split(',')[0], float(x.split(',')[1]), float(x.split(',')[2])) \
575 576
            for x in strConnPts.split('/')]
576 577

  
577
        svg.buildItem(svgFileName, symbol.getType(), 0, None, None, connPts)
578
        svg.buildItem(svgFileName, symbol.getType(), 0, None, None, connPts, uid)
578 579
        
579 580
        return svg
580 581
        
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py
341 341
        self.update_arrow()
342 342
        self.update()
343 343

  
344
    def mouseDoubleClickEvent(self, event):
345
        from PhaseTypeDialog import QPhaseTypeDialog
346
        dialog = QPhaseTypeDialog(None)
347
        selectedPhaseType = dialog.showDialog()
344 348

  
349
        #if selectedPhaseType:
350
            
351
            
352
            
345 353
    def toSql(self):
346 354
        """ convert valve data to sql query """
347 355
        import uuid
......
386 394
        try:
387 395
            uid = componentInfos[0][0] #Components_UID
388 396

  
389
            #pt = []  # [757.3, 464.3]
390
            #pt.append(float(componentInfos[0][7]))
391
            #pt.append(float(componentInfos[0][8]))
392

  
393
            #size = [float(x) for x in node.find('SIZE').text.split(',')]
394

  
395
            #dbUid = componentInfos[0][2]    #Symbols_UID
396
            #name = componentInfos[0][5]     #Symbols_Name
397

  
398
            #angle = float(componentInfos[0][9])
399
            #_type = componentInfos[0][4] 
400
            #origin = [float(x) for x in str(componentInfos[0][6]).split(',')]
401

  
402
            #connPts = []
403
            #for componentInfo in componentInfos:
404
            #    connPts.append(('AUTO', float(componentInfo[12]), float(componentInfo[13]), '0'))
405

  
406 397
            item = QEngineeringStreamlineItem(uid)
407 398
            for componentInfo in componentInfos:
408 399
                item._vertices.append((componentInfo[12], componentInfo[13]))
......
413 404
            item.__buildItem()
414 405
            item.build_connectors(connectorItems)
415 406
            item.update_arrow()
416
            #item.update()
417
            #appDocData = AppDocData.instance()
418
            #project = appDocData.getCurrentProject()
419
            #svgFilePath = os.path.join(project.getSvgFilePath(), _type, name + '.svg')
420
            #if os.path.isfile(svgFilePath):
421
            #    item = SymbolSvgItem.createItem(_type, svgFilePath, uid)
422
            #    item.setVisible(False)
423
            #    #item.buildItem(name, _type, angle, pt, size, origin, connPts, baseSymbol, childSymbol, hasInstrumentLabel, dbUid=dbUid)
424
            #    item.buildItem(name, _type, angle, pt, origin, connPts, dbUid=dbUid)
425

  
426
            #    #for prop_node in node.iter('PROPERTY'):
427
            #    #    matches = [prop for prop in item._properties.keys() if prop.Attribute == prop_node.attrib['Attribute']]
428
            #    #    if matches:
429
            #    #        #matches[0].parse_xml(prop_node)
430
            #    #        item._properties[matches[0]] = matches[0].parse_value(prop_node.text) if prop_node.text else ''
431

  
432
            #    ## assign area
433
            #    #areaNode = node.find('AREA')
434
            #    #if areaNode is None:
435
            #    for area in appDocData.getAreaList():
436
            #        if area.contains(pt):
437
            #            item.area = area.name
438
            #            break
439
                
407
            
440 408
        except Exception as ex:
441 409
            from App import App 
442 410
            from AppDocData import MessageType
HYTOS/HYTOS/SymbolTreeWidget.py
146 146
                pixmap = QPixmap(items[0].svgFilePath)
147 147

  
148 148
                mime = QMimeData()
149
                mime.setText(symData.getName())
149
                #mime.setText(symData.getName())
150
                mime.setText(symData.getUid())
150 151

  
151 152
                drag = QDrag(self)
152 153
                drag.setMimeData(mime) 
HYTOS/HYTOS/UI/PhaseTypeDialog.ui
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ui version="4.0">
3
 <class>PhaseTypeDialog</class>
4
 <widget class="QDialog" name="PhaseTypeDialog">
5
  <property name="geometry">
6
   <rect>
7
    <x>0</x>
8
    <y>0</y>
9
    <width>350</width>
10
    <height>105</height>
11
   </rect>
12
  </property>
13
  <property name="minimumSize">
14
   <size>
15
    <width>350</width>
16
    <height>0</height>
17
   </size>
18
  </property>
19
  <property name="maximumSize">
20
   <size>
21
    <width>350</width>
22
    <height>350</height>
23
   </size>
24
  </property>
25
  <property name="font">
26
   <font>
27
    <family>맑은 고딕</family>
28
    <weight>75</weight>
29
    <bold>true</bold>
30
   </font>
31
  </property>
32
  <property name="windowTitle">
33
   <string>Select Phase Type</string>
34
  </property>
35
  <layout class="QVBoxLayout" name="verticalLayout">
36
   <item>
37
    <layout class="QFormLayout" name="formLayout">
38
     <item row="0" column="0">
39
      <widget class="QLabel" name="StreamNo">
40
       <property name="font">
41
        <font>
42
         <family>맑은 고딕</family>
43
         <pointsize>9</pointsize>
44
         <weight>50</weight>
45
         <bold>false</bold>
46
        </font>
47
       </property>
48
       <property name="text">
49
        <string>Stream No.</string>
50
       </property>
51
      </widget>
52
     </item>
53
     <item row="0" column="1">
54
      <widget class="QLineEdit" name="lineEditSteamNo"/>
55
     </item>
56
     <item row="1" column="1">
57
      <widget class="QComboBox" name="comboBoxPhaseType">
58
       <property name="font">
59
        <font>
60
         <weight>50</weight>
61
         <bold>false</bold>
62
        </font>
63
       </property>
64
      </widget>
65
     </item>
66
     <item row="1" column="0">
67
      <widget class="QLabel" name="PhaseType">
68
       <property name="font">
69
        <font>
70
         <family>맑은 고딕</family>
71
         <pointsize>9</pointsize>
72
         <weight>50</weight>
73
         <bold>false</bold>
74
        </font>
75
       </property>
76
       <property name="text">
77
        <string>Phase Type</string>
78
       </property>
79
      </widget>
80
     </item>
81
    </layout>
82
   </item>
83
   <item>
84
    <widget class="QLabel" name="errorLabel">
85
     <property name="maximumSize">
86
      <size>
87
       <width>16777215</width>
88
       <height>0</height>
89
      </size>
90
     </property>
91
     <property name="styleSheet">
92
      <string notr="true"/>
93
     </property>
94
     <property name="text">
95
      <string/>
96
     </property>
97
     <property name="alignment">
98
      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
99
     </property>
100
    </widget>
101
   </item>
102
   <item>
103
    <widget class="QDialogButtonBox" name="buttonBox">
104
     <property name="font">
105
      <font>
106
       <family>맑은 고딕</family>
107
       <weight>75</weight>
108
       <bold>true</bold>
109
      </font>
110
     </property>
111
     <property name="standardButtons">
112
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
113
     </property>
114
    </widget>
115
   </item>
116
  </layout>
117
 </widget>
118
 <resources/>
119
 <connections>
120
  <connection>
121
   <sender>buttonBox</sender>
122
   <signal>rejected()</signal>
123
   <receiver>PhaseTypeDialog</receiver>
124
   <slot>reject()</slot>
125
   <hints>
126
    <hint type="sourcelabel">
127
     <x>299</x>
128
     <y>79</y>
129
    </hint>
130
    <hint type="destinationlabel">
131
     <x>299</x>
132
     <y>49</y>
133
    </hint>
134
   </hints>
135
  </connection>
136
  <connection>
137
   <sender>buttonBox</sender>
138
   <signal>accepted()</signal>
139
   <receiver>PhaseTypeDialog</receiver>
140
   <slot>accept()</slot>
141
   <hints>
142
    <hint type="sourcelabel">
143
     <x>299</x>
144
     <y>79</y>
145
    </hint>
146
    <hint type="destinationlabel">
147
     <x>299</x>
148
     <y>49</y>
149
    </hint>
150
   </hints>
151
  </connection>
152
 </connections>
153
</ui>

내보내기 Unified diff

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