프로젝트

일반

사용자정보

개정판 47a53a74

ID47a53a748cb5e4eb7e0f7aff9f6060cb7022b2cf
상위 e1556005
하위 bba382b1, 907dbd42

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

issue #1047: display equipment description label

Change-Id: I5af154c613aac0823ab6c03fe25ee15b4770586c

차이점 보기:

HYTOS/HYTOS/Filter.py
54 54
        matches = [connector.data for connector in self._item.connectors if connector.data]
55 55
        if matches:
56 56
            pressure_drop = matches[0].pressure_drop
57
            if pressure_drop:                
57
            if pressure_drop:
58 58
                self.ui.lineEdit_Pressure_Drop.setText(str(pressure_drop))
59 59

  
60 60
            elevation = matches[0].elevation
HYTOS/HYTOS/HMBTable.py
12 12

  
13 13
class HMBData:
14 14
    def __init__(self, uid=None):
15
        self._uid                       = None
16
        self._components_uid            = None        
17
        self._stream_no                 = None
18
        self._phase_type                = None
19
        self._flowrate_mass             = None
20
        self._flowrate_volume           = None
21
        self._density                   = None
22
        self._viscosity                 = None
23
        self._temperature               = None
24
        self._molecular_weight          = None
25
        self._specific_heat_ratio       = None
26
        self._compress_factor           = None
27
        self._nominal_pipe_size         = None
28
        self._inside_pipe_size          = None
29
        self._schedule_no               = None
30
        self._straight_length           = None
31
        self._equivalent_length_input   = None
32
        self._fitting_length            = None
33
        self._fitting_K                 = None
34
        self._equivalent_length_cal     = None
35
        self._roughness                 = None
36
        self._limitation_velocity       = None
37
        self._limitation_pressure_drop  = None
38
        self._velocity                  = None
39
        self._reynolds                  = None
40
        self._friction_factor           = None
41
        self._pressure_drop             = None
42
        self._pressure_drop_friction    = None
43
        self._pressure_drop_static      = None
44
        self._pressure_pipe_end_point   = None
45
        self._power                     = None
46
        self.isDeleted                  = False
15
        self._uid = None
16
        self._components_uid = None
17
        self._stream_no = None
18
        self._phase_type = None
19
        self._flowrate_mass = None
20
        self._flowrate_volume = None
21
        self._density = None
22
        self._viscosity = None
23
        self._temperature = None
24
        self._molecular_weight = None
25
        self._specific_heat_ratio = None
26
        self._compress_factor = None
27
        self._nominal_pipe_size = None
28
        self._inside_pipe_size = None
29
        self._schedule_no = None
30
        self._straight_length = None
31
        self._equivalent_length_input = None
32
        self._fitting_length = None
33
        self._fitting_K = None
34
        self._equivalent_length_cal = None
35
        self._roughness = None
36
        self._limitation_velocity = None
37
        self._limitation_pressure_drop = None
38
        self._velocity = None
39
        self._reynolds = None
40
        self._friction_factor = None
41
        self._pressure_drop = None
42
        self._pressure_drop_friction = None
43
        self._pressure_drop_static = None
44
        self._pressure_pipe_end_point = None
45
        self._power = None
46
        self.isDeleted = False
47 47

  
48 48
    '''
49 49
        @author humkyung
......
108 108
    def phase_type(self, value):
109 109
        if value:
110 110
            self._phase_type = value
111
    
111

  
112 112
    @property
113 113
    def flowrate_mass(self):
114 114
        return self._flowrate_mass
......
377 377
    def new_data():
378 378
        # 새로운 HMB 데이타를 생성한다.
379 379
        hmb = HMBData()
380
        
380

  
381 381
        hmb.isDeleted = False
382 382
        return hmb
383 383

  
......
389 389

  
390 390
    def deleteByUID(self, uid):
391 391
        hmbs = self._hmbs
392
        if hmbs is not None:     
392
        if hmbs is not None:
393 393
            for hmb in hmbs:
394 394
                if str(hmb.components_uid) == str(uid):
395 395
                    hmb.isDeleted = True
......
399 399
        import uuid
400 400

  
401 401
        hmb = HMBData()
402
        hmb.uid = str(uuid.uuid4())        
402
        hmb.uid = str(uuid.uuid4())
403 403
        hmb.components_uid = components_uid
404 404
        hmb.stream_no = stream_no
405 405
        hmb.isDeleted = False
......
407 407
        self.append(hmb)
408 408

  
409 409
    def updateByUID(self, components_uid, values):
410
        try:            
410
        try:
411 411
            for hmb in self._hmbs:
412 412
                if hmb.components_uid == components_uid:
413 413
                    if 'Phase_Type' in values:
......
417 417
                    if 'Flowrate_Volume' in values:
418 418
                        hmb.flowrate_volume = values['Flowrate_Volume']
419 419
                    if 'Viscosity' in values:
420
                        hmb.viscosity = values['Viscosity']                
421
                    if 'Density' in values:                    
422
                        hmb.density = values['Density']                
423
                    if 'Temperature' in values:                    
420
                        hmb.viscosity = values['Viscosity']
421
                    if 'Density' in values:
422
                        hmb.density = values['Density']
423
                    if 'Temperature' in values:
424 424
                        hmb.temperature = values['Temperature']
425
                    if 'Molecular_Weight' in values:                    
425
                    if 'Molecular_Weight' in values:
426 426
                        hmb.molecular_weight = values['Molecular_Weight']
427 427
                    if 'Specific_Heat_Ratio' in values:
428 428
                        hmb.specific_heat_ratio = values['Specific_Heat_Ratio']
......
462 462
                        hmb.pressure_drop_friction = values['Pressure_Drop_Friction']
463 463
                    if 'Pressure_Drop_Static' in values:
464 464
                        hmb.pressure_drop_static = values['Pressure_Drop_Static']
465
                    if 'Pressure_Pipe_End_Point' in values:                    
465
                    if 'Pressure_Pipe_End_Point' in values:
466 466
                        hmb.pressure_pipe_end_point = values['Pressure_Pipe_End_Point']
467 467
                    if 'Power' in values:
468 468
                        hmb.power = values['Power']
......
471 471
        except Exception as ex:
472 472
            from App import App
473 473
            from AppDocData import MessageType
474
            
474

  
475 475
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
476 476
                                                           sys.exc_info()[-1].tb_lineno)
477 477
            App.mainWnd().addMessage.emit(MessageType.Error, message)
......
542 542

  
543 543
                    # Roll back any change if something goes wrong
544 544
                    conn.rollback()
545
                    
545

  
546 546
                    message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
547 547
                                                                  sys.exc_info()[-1].tb_lineno)
548 548
                    App.mainWnd().addMessage.emit(MessageType.Error, message)
549 549

  
550 550
        return self._hmbs
551
        
551

  
552 552
    '''
553 553
        @brief      save hmb data 
554 554
        @author     humkyung
......
585 585
                        values = ['?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?',
586 586
                                  '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?']
587 587
                        param = (
588
                        str(data.uid), str(data.components_uid), data.stream_no, data.phase_type, data.flowrate_mass,
589
                        data.flowrate_volume, data.density,
590
                        data.viscosity, data.temperature, data.molecular_weight, data.specific_heat_ratio,
591
                        data.compress_factor, data.nominal_pipe_size,
592
                        data.inside_pipe_size, data.schedule_no, data.straight_length, data.equivalent_length_input,
593
                        data.fitting_length, data.fitting_K, data.equivalent_length_cal, data.roughness,
594
                        data.limitation_velocity,
595
                        data.limitation_pressure_drop, data.velocity, data.reynolds, data.friction_factor,
596
                        data.pressure_drop, data.pressure_drop_friction,
597
                                    data.pressure_drop_static, data.pressure_pipe_end_point, data.power)
598

  
599
                        sql = 'insert or replace into HMB({}) values({})'.format(','.join(cols), ','.join(values))                  
588
                            str(data.uid), str(data.components_uid), data.stream_no, data.phase_type,
589
                            data.flowrate_mass,
590
                            data.flowrate_volume, data.density,
591
                            data.viscosity, data.temperature, data.molecular_weight, data.specific_heat_ratio,
592
                            data.compress_factor, data.nominal_pipe_size,
593
                            data.inside_pipe_size, data.schedule_no, data.straight_length, data.equivalent_length_input,
594
                            data.fitting_length, data.fitting_K, data.equivalent_length_cal, data.roughness,
595
                            data.limitation_velocity,
596
                            data.limitation_pressure_drop, data.velocity, data.reynolds, data.friction_factor,
597
                            data.pressure_drop, data.pressure_drop_friction,
598
                            data.pressure_drop_static, data.pressure_pipe_end_point, data.power)
599

  
600
                        sql = 'insert or replace into HMB({}) values({})'.format(','.join(cols), ','.join(values))
600 601
                        cursor.execute(sql, param)
601 602
                    else:
602 603
                        sql = "delete from HMB where uid=?"
......
611 612

  
612 613
                # Roll back any change if something goes wrong
613 614
                conn.rollback()
614
                
615

  
615 616
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
616 617
                                                              sys.exc_info()[-1].tb_lineno)
617 618
                App.mainWnd().addMessage.emit(MessageType.Error, message)
HYTOS/HYTOS/Shapes/EngineeringEqpDescTextItem.py
1
# coding: utf-8
2
""" This is engineering equipment description text item module """
3

  
4
import os.path
5
import sys
6
import copy
7
try:
8
    from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR, QRect
9
    from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen, QTransform, QFont
10
    from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem, QGraphicsTextItem
11
except ImportError:
12
    try:
13
        from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR, QRect
14
        from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QFont
15
    except ImportError:
16
        raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.")
17

  
18
class QEngineeringEqpDescTextItem(QGraphicsTextItem):
19
    """ This is engineering equipment description text item class """
20

  
21
    def __init__(self, text, parent=None):
22
        import uuid
23

  
24
        QGraphicsTextItem.__init__(self, text, parent)
25
        self.type = 'EQP DESC'
26
        self.setHtml(text)
27

  
28
        font = QFont('Arial', 15)
29
        font.setPointSizeF(3)
30
        self.setFont(font)
31

  
32
        self.setDefaultTextColor(Qt.lightGray)
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py
24 24

  
25 25
    ARROW_SIZE = 5
26 26
    ZVALUE = 50
27
    MIN_LENGTH = 10
27
    OFFSET = 10
28 28
    onRemoved = pyqtSignal(QGraphicsItem)
29 29

  
30 30
    '''
......
248 248
                        self._vertices.append((self._vertices[0][0], self._vertices[0][1] + dy))
249 249
                    elif dx < 0 <= dy:
250 250
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
251
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
251
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
252 252
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
253 253
                    elif dx < 0 and dy < 0:
254 254
                        self._vertices.append(
255
                            (self._vertices[0][0], self._vertices[-1][1] + QEngineeringStreamlineItem.MIN_LENGTH))
256
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
257
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
255
                            (self._vertices[0][0], self._vertices[-1][1] + QEngineeringStreamlineItem.OFFSET))
256
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
257
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
258 258
                    elif dx > 0 > dy:
259 259
                        self._vertices.append(
260
                            (self._vertices[0][0], self._vertices[0][1] + QEngineeringStreamlineItem.MIN_LENGTH))
260
                            (self._vertices[0][0], self._vertices[0][1] + QEngineeringStreamlineItem.OFFSET))
261 261
                        self._vertices.append((self._vertices[-1][0] + dx * 0.5, self._vertices[-1][1]))
262 262
                        self._vertices.append((self._vertices[-1][0], self.connectors[-1].center()[1]))
263 263
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'DOWN') and \
264 264
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'RIGHT'):
265 265
                    if dx >= 0 and dy < 0:
266
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.MIN_LENGTH))
267
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
266
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.OFFSET))
267
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
268 268
                        self._vertices.append((self._vertices[-1][0],
269
                                               self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
269
                                               self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
270 270
                    elif dx < 0 and dy < 0:
271
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.MIN_LENGTH))
271
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.OFFSET))
272 272
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
273
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
273
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
274 274
                    elif dx < 0 and dy >= 0:
275 275
                        self._vertices.append((self._vertices[0][0], self._vertices[-1][1] + dy))
276 276
                    elif dx >= 0 and dy >= 0:
277 277
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
278
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
278
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
279 279
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
280 280
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'DOWN') and \
281 281
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'UP'):
282 282
                    if dx >= 0 and dy < 0:
283
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.MIN_LENGTH))
283
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.OFFSET))
284 284
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
285 285
                        self._vertices.append((self._vertices[-1][0],
286
                                               self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH*2))
286
                                               self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET*2))
287 287
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
288 288
                    elif dx < 0 and dy < 0:
289
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.MIN_LENGTH))
289
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.OFFSET))
290 290
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
291 291
                        self._vertices.append((self._vertices[-1][0],
292
                                               self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH * 2))
292
                                               self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET * 2))
293 293
                        self._vertices.append((self._vertices[-1][0] + dx * 0.5, self._vertices[-1][1]))
294 294
                    elif dx < 0 and dy >= 0:
295 295
                        self._vertices.append((self._vertices[0][0], self._vertices[-1][1] + dy*0.5))
......
300 300
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'DOWN') and \
301 301
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'DOWN'):
302 302
                    if dx >= 0 and dy < 0:
303
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.MIN_LENGTH))
303
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.OFFSET))
304 304
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
305 305
                    elif dx < 0 and dy < 0:
306
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.MIN_LENGTH))
306
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + QEngineeringStreamlineItem.OFFSET))
307 307
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
308 308
                    elif dx < 0 and dy >= 0:
309
                        self._vertices.append((self._vertices[0][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
309
                        self._vertices.append((self._vertices[0][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
310 310
                        self._vertices.append((self._vertices[0][0] + dx, self._vertices[-1][1]))
311 311
                    elif dx >= 0 and dy >= 0:
312
                        self._vertices.append((self._vertices[0][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
312
                        self._vertices.append((self._vertices[0][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
313 313
                        self._vertices.append((self._vertices[0][0] + dx, self._vertices[-1][1]))
314 314
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'UP') and \
315 315
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'LEFT'):
316 316
                    if dx >= 0 and dy < 0:
317 317
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
318 318
                    elif dx >= 0 and dy >= 0:
319
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.MIN_LENGTH))
319
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.OFFSET))
320 320
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
321
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
321
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
322 322
                    elif dx < 0 and dy >= 0:
323 323
                        self._vertices.append(
324
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.MIN_LENGTH))
325
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH , self._vertices[-1][1]))
324
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.OFFSET))
325
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET , self._vertices[-1][1]))
326 326
                        self._vertices.append(
327
                            (self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
327
                            (self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
328 328
                    else:
329 329
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
330
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
330
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
331 331
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
332 332
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'UP') and \
333 333
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'RIGHT'):
334 334
                    if dx >= 0 and dy < 0:
335 335
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
336
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
336
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
337 337
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy * 0.5))
338 338
                    elif dx < 0 and dy < 0:
339 339
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
340 340
                    elif dx < 0 and dy >= 0:
341 341
                        self._vertices.append(
342
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.MIN_LENGTH))
342
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.OFFSET))
343 343
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
344 344
                        self._vertices.append(
345
                            (self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
345
                            (self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
346 346
                    else:
347
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.MIN_LENGTH))
348
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
349
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
347
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.OFFSET))
348
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
349
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
350 350
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'UP') and \
351 351
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'DOWN'):
352 352
                    if dy < 0:
......
354 354
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
355 355
                    else:
356 356
                        self._vertices.append(
357
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.MIN_LENGTH))
357
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.OFFSET))
358 358
                        self._vertices.append((self._vertices[-1][0] + dx * 0.5, self._vertices[-1][1]))
359 359
                        self._vertices.append((self._vertices[-1][0],
360
                                               self.connectors[-1].center()[1] + QEngineeringStreamlineItem.MIN_LENGTH))
360
                                               self.connectors[-1].center()[1] + QEngineeringStreamlineItem.OFFSET))
361 361
                        self._vertices.append((self._vertices[-1][0] + dx * 0.5, self._vertices[-1][1]))
362 362
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'UP') and \
363 363
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'UP'):
364 364
                    if dx >= 0 and dy < 0:
365
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
365
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
366 366
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
367 367
                    elif dx < 0 and dy < 0:
368 368
                        self._vertices.append(
369
                            (self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
369
                            (self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
370 370
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
371 371
                    elif dx < 0 and dy >= 0:
372 372
                        self._vertices.append(
373
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.MIN_LENGTH))
373
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.OFFSET))
374 374
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
375 375
                    else:
376 376
                        self._vertices.append(
377
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.MIN_LENGTH))
377
                            (self._vertices[-1][0], self._vertices[-1][1] - QEngineeringStreamlineItem.OFFSET))
378 378
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
379 379
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'RIGHT') and \
380 380
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'LEFT'):
......
383 383
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
384 384
                    else:
385 385
                        self._vertices.append(
386
                            (self._vertices[-1][0] + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
386
                            (self._vertices[-1][0] + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
387 387
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
388
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH*2,
388
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET*2,
389 389
                                               self._vertices[-1][1]))
390 390
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
391 391
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'RIGHT') and \
......
393 393
                    if dx >= 0 and dy < 0:
394 394
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
395 395
                    elif dx < 0 and dy < 0:
396
                        self._vertices.append((self._vertices[-1][0] + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
396
                        self._vertices.append((self._vertices[-1][0] + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
397 397
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
398
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
398
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
399 399
                    elif dx < 0 and dy >= 0:
400 400
                        self._vertices.append(
401
                            (self._vertices[-1][0] + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
402
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
401
                            (self._vertices[-1][0] + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
402
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
403 403
                        self._vertices.append(
404
                            (self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
404
                            (self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
405 405
                    else:
406 406
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
407
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
407
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
408 408
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
409 409
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'RIGHT') and \
410 410
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'UP'):
411 411
                    if dx >= 0 and dy < 0:
412 412
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
413
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
413
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
414 414
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
415 415
                    elif dx < 0 and dy < 0:
416
                        self._vertices.append((self._vertices[-1][0] + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
417
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
418
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
416
                        self._vertices.append((self._vertices[-1][0] + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
417
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
418
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
419 419
                    elif dx < 0 and dy >= 0:
420 420
                        self._vertices.append(
421
                            (self._vertices[-1][0] + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
421
                            (self._vertices[-1][0] + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
422 422
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
423 423
                        self._vertices.append(
424
                            (self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
424
                            (self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
425 425
                    else:
426 426
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
427 427
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'RIGHT') and \
428 428
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'RIGHT'):
429 429
                    if dx >= 0 and dy < 0:
430
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
430
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
431 431
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
432 432
                    elif dx < 0 and dy < 0:
433
                        self._vertices.append((self._vertices[-1][0] + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
433
                        self._vertices.append((self._vertices[-1][0] + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
434 434
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
435 435
                    elif dx < 0 and dy >= 0:
436 436
                        self._vertices.append(
437
                            (self._vertices[-1][0] + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
437
                            (self._vertices[-1][0] + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
438 438
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
439 439
                    else:
440
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
440
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
441 441
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
442 442
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'LEFT') and \
443 443
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'LEFT'):
444 444
                    if dx >= 0 and dy < 0:
445
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
445
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
446 446
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
447 447
                    elif dx < 0 and dy < 0:
448
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
448
                        self._vertices.append((self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
449 449
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
450 450
                    elif dx < 0 and dy >= 0:
451 451
                        self._vertices.append(
452
                            (self._vertices[-1][0] + dx - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
452
                            (self._vertices[-1][0] + dx - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
453 453
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
454 454
                    else:
455
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
455
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
456 456
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
457 457
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'LEFT') and \
458 458
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'RIGHT'):
459 459
                    if dx >= 0 and dy < 0:
460
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
461
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
460
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
461
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
462
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET*2, self._vertices[-1][1]))
463
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
462 464
                    elif dx < 0 and dy < 0:
463 465
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
464 466
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
......
466 468
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
467 469
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
468 470
                    else:
469
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
471
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
470 472
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
471
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH*2, self._vertices[-1][1]))
473
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET*2, self._vertices[-1][1]))
472 474
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
473 475
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'LEFT') and \
474 476
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'UP'):
475 477
                    if dx >= 0 and dy < 0:
476
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
477
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
478
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
478
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
479
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
480
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
479 481
                    elif dx < 0 and dy < 0:
480 482
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
481
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.MIN_LENGTH))
483
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy - QEngineeringStreamlineItem.OFFSET))
482 484
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
483 485
                    elif dx < 0 and dy >= 0:
484 486
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
485 487
                    else:
486
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
488
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
487 489
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
488
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
490
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
489 491
                elif (self.connectors[0].connectedItem and self.connectors[0].connectedItem.direction == 'LEFT') and \
490 492
                        (self.connectors[-1].connectedItem and self.connectors[-1].connectedItem.direction == 'DOWN'):
491 493
                    if dx >= 0 and dy < 0:
492
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
494
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
493 495
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy*0.5))
494
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
496
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
495 497
                    elif dx < 0 and dy < 0:
496 498
                        self._vertices.append((self._vertices[-1][0] + dx, self._vertices[-1][1]))
497 499
                    elif dx < 0 and dy >= 0:
498 500
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
499
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
501
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
500 502
                        self._vertices.append((self._vertices[-1][0] + dx*0.5, self._vertices[-1][1]))
501 503
                    else:
502
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
503
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.MIN_LENGTH))
504
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.MIN_LENGTH, self._vertices[-1][1]))
504
                        self._vertices.append((self._vertices[-1][0] - QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
505
                        self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy + QEngineeringStreamlineItem.OFFSET))
506
                        self._vertices.append((self._vertices[-1][0] + dx + QEngineeringStreamlineItem.OFFSET, self._vertices[-1][1]))
505 507
                else:
506 508
                    self._vertices.append((self._vertices[0][0] + dx * 0.5, self._vertices[0][1]))
507 509
                    self._vertices.append((self._vertices[-1][0], self._vertices[-1][1] + dy))
HYTOS/HYTOS/Shapes/SymbolSvgItem.py
12 12
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QMessageBox
13 13

  
14 14
from AppDocData import *
15
from EngineeringConnectorItem import QEngineeringConnectorItem
16 15
from EngineeringAbstractItem import QEngineeringAbstractItem
17 16
from EngineeringConnectorItem import QEngineeringConnectorItem
18
from UserInputAttribute import UserInputAttribute
19
from Resizer import Resizer
17
from EngineeringEqpDescTextItem import QEngineeringEqpDescTextItem
20 18

  
21 19

  
22 20
class SymbolSvgItem(QGraphicsSvgItem, QEngineeringAbstractItem):
......
84 82
            from App import App
85 83
            from AppDocData import MessageType
86 84

  
87
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
85
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
88 86
                                                          sys.exc_info()[-1].tb_lineno)
89 87
            App.mainWnd().addMessage.emit(MessageType.Error, message)
90 88
        finally:
91 89
            f.close()
92 90

  
93 91
        self.setZValue(SymbolSvgItem.ZVALUE)
92
        self._desc_label = QEngineeringEqpDescTextItem('eqp name<br>pressure drop<br>elevation', self)
94 93

  
95 94
    def __str__(self):
96 95
        """ return string represent uuid """
......
148 147
            except Exception as ex:
149 148
                from App import App
150 149

  
151
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
150
                message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
152 151
                                                              sys.exc_info()[-1].tb_lineno)
153 152
                App.mainWnd().addMessage.emit(MessageType.Error, message)
154 153

  
......
173 172
        return None
174 173

  
175 174
    @property
175
    def desc_label(self):
176
        """ return equipment description label """
177

  
178
        return self._desc_label
179

  
180
    @property
176 181
    def Size(self):
177 182
        """ return valve's size """
178 183
        from QEngineeringSizeTextItem import QEngineeringSizeTextItem
......
287 292
                    symbol_idx = tokens[3]
288 293

  
289 294
                if pointsUids:
290
                    self.setConnector(pointsUids[index], index + 1)
295
                    self.set_connector(pointsUids[index], index + 1)
291 296
                else:
292
                    self.setConnector(None, index + 1)
297
                    self.set_connector(None, index + 1)
293 298

  
294 299
                self.connectors[index].direction = direction
295 300
                self.connectors[index].symbol_idx = symbol_idx
......
298 303

  
299 304
            tooltip = '<b>{}</b><br>{}={}'.format(str(self.uid), self.type, self.name)
300 305
            self.setToolTip(tooltip)
306

  
307
            self.build_label()
301 308
        except Exception as ex:
302 309
            from App import App
303 310

  
......
305 312
                                                          sys.exc_info()[-1].tb_lineno)
306 313
            App.mainWnd().addMessage.emit(MessageType.Error, message)
307 314

  
315
    def build_label(self):
316
        """ build equipment label """
317

  
318
        rect = self.boundingRect()
319
        if self.name in ('CV_H', 'CV_V') or self.name == 'Line_Splitter' or self.name in ('Filter_H', 'Filter_V'):
320
            data = self.connectors[0].data
321
            self.desc_label.setHtml(f"{self.name}<br>{data.pressure_drop} kg/cm2<br>{data.elevation} m")
322
        elif self.name in ('Y_Strainer_H', 'Y_Strainer_V'):
323
            data = self.connectors[0].data
324
            self.desc_label.setHtml(f"{self.name}<br>{data.pressure_drop} kg/cm2<br>{data.elevation} m")
325
        elif self.name in ('L_Pump', 'R_Pump', 'V_Pump'):
326
            data = self.connectors[0].data
327
            self.desc_label.setHtml(f"{self.name}<br>{data.pressure_drop} kg/cm2<br>{data.elevation} m")
328
        elif self.name in ('Ori_Flowmeter_H', 'Oth_Flowmeter_H', 'Ven_Flowmeter_H', 'Ori_Flowmeter_V', 'Oth_Flowmeter_V',
329
                           'Ven_Flowmeter_V'):
330
            data = self.connectors[0].data
331
            self.desc_label.setHtml(f"{self.name}<br>{data.pressure_drop} kg/cm2<br>{data.elevation} m")
332
        elif self.name in ('HEX_V', 'HEX_DP', 'HEX_H', 'HEX_K', 'HEX_V'):
333
            data = [conn.data for conn in self.connectors
334
                    if conn.data and (conn.data.pressure_drop is not None or conn.data.elevation is not None)]
335
            if data:
336
                self.desc_label.setHtml(f"{self.name}<br>{data[0].pressure_drop} kg/cm2<br>{data[0].elevation} m")
337
        elif self.name == 'M_DP_E':
338
            data = [conn.data for conn in self.connectors
339
                    if conn.data and (conn.data.pressure_drop is not None or conn.data.elevation is not None)]
340
            if data:
341
                self.desc_label.setHtml(f"{self.name}<br>{data[0].pressure_drop} kg/cm2<br>{data[0].elevation} m")
342
        elif self.type == 'Battery Limit':
343
            data = [conn.data for conn in self.connectors
344
                    if conn.data and (conn.data.pressure_drop is not None or conn.data.elevation is not None)]
345
            if data:
346
                self.desc_label.setHtml(f"{self.name}<br>{data[0].pressure} kg/cm2(g)<br>{data[0].elevation} m")
347
        else:
348
            self.desc_label.setHtml(f"{self.name}")
349

  
350
        self.desc_label.setPos(QPointF(rect.width(), 0))
351

  
308 352
    '''
309 353
        @brief  return bounding box of symbol
310 354
        @author humkyung
......
416 460
                            res.append(obj)
417 461
        except Exception as ex:
418 462
            from App import App
419
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
463
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
420 464
                                                          sys.exc_info()[-1].tb_lineno)
421 465
            App.mainWnd().addMessage.emit(MessageType.Error, message)
422 466

  
......
620 664

  
621 665
    def connectAttribute(self, attributes, clear=True):
622 666
        import math
623
        from EngineeringTextItem import QEngineeringTextItem
624
        from QEngineeringSizeTextItem import QEngineeringSizeTextItem
625 667

  
626 668
        try:
627 669
            if clear:
......
927 969

  
928 970
    @staticmethod
929 971
    def createItem(type, path, uid=None, owner=None, flip=0):
930
        from EngineeringNozzleItem import QEngineeringNozzleItem
931
        from EngineeringErrorItem import QEngineeringErrorItem
932
        from EngineeringStreamlineItem import QEngineeringStreamlineItem
933
        from AppDocData import AppDocData
934 972
        import uuid
935 973

  
936 974
        item = SymbolSvgItem(path, uid, flip=flip)
......
1047 1085
        @date   2018.07.07
1048 1086
    '''
1049 1087

  
1050
    def drawFocusRect(self, painter):
1088
    def draw_focus_rect(self, painter):
1051 1089
        self.focuspen = QPen(Qt.DotLine)
1052 1090
        self.focuspen.setColor(Qt.black)
1053 1091
        self.focuspen.setWidthF(1.5)
......
1080 1118
                attr.update()
1081 1119

  
1082 1120
        if self.isSelected():
1083
            self.drawFocusRect(painter)
1121
            self.draw_focus_rect(painter)
1084 1122

  
1085 1123
    '''
1086 1124
        @brief      Add Svg Item into ImageViewer's Scene
......
1116 1154
        @date       2018.07.26
1117 1155
    '''
1118 1156

  
1119
    def setConnector(self, uid, index=None):
1157
    def set_connector(self, uid, index=None):
1120 1158
        from AppDocData import AppDocData
1121 1159

  
1122 1160
        app_doc_data = AppDocData.instance()
......
1142 1180
            from App import App
1143 1181
            from AppDocData import MessageType
1144 1182

  
1145
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1183
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1146 1184
                                                          sys.exc_info()[-1].tb_lineno)
1147 1185
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1148 1186

  

내보내기 Unified diff

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