개정판 88d7099c
issue 000: remove old hmb
Change-Id: I45f2e1c981088539897e82d4da96ad43805a10be
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
44 | 44 |
''' |
45 | 45 |
@brief Pipe color class |
46 | 46 |
''' |
47 |
|
|
48 |
|
|
49 | 47 |
class Color: |
50 | 48 |
def __init__(self, index, red, green, blue): |
51 | 49 |
self.index = index |
... | ... | |
59 | 57 |
@author humkyung |
60 | 58 |
@date 2018.07.31 |
61 | 59 |
''' |
62 |
|
|
63 |
|
|
64 | 60 |
class MessageType(Enum): |
65 | 61 |
Normal = 1 |
66 | 62 |
Error = 2 |
... | ... | |
84 | 80 |
self._lineTypes = None |
85 | 81 |
self._lineTypeConfigs = None |
86 | 82 |
self._activeDrawing = None |
87 |
self._hmbTable = None |
|
83 |
#self._hmbTable = None
|
|
88 | 84 |
self._hmbColors = {} |
89 | 85 |
self._streamLineListModelDatas = [] |
90 | 86 |
self._titleBlockProperties = None |
... | ... | |
169 | 165 |
self._lineNoProperties = None |
170 | 166 |
self._lineTypeConfigs = None |
171 | 167 |
self._activeDrawing = None |
172 |
self._hmbTable = None |
|
168 |
#self._hmbTable = None
|
|
173 | 169 |
self._hmbColors = {} |
174 | 170 |
self._streamLineListModelDatas = [] |
175 | 171 |
self._titleBlockProperties = None |
... | ... | |
471 | 467 |
@author humkyung |
472 | 468 |
@date 2018.07.16 |
473 | 469 |
''' |
474 |
|
|
470 |
''' |
|
475 | 471 |
@property |
476 | 472 |
def hmbTable(self): |
477 | 473 |
from HMBTable import HMBTable |
... | ... | |
481 | 477 |
self._hmbTable.load_data() |
482 | 478 |
|
483 | 479 |
return self._hmbTable |
480 |
''' |
|
484 | 481 |
|
485 | 482 |
''' |
486 | 483 |
@brief setter of hmb table |
487 | 484 |
@author humkyung |
488 | 485 |
@date 2018.07.16 |
489 | 486 |
''' |
490 |
|
|
487 |
''' |
|
491 | 488 |
@hmbTable.setter |
492 | 489 |
def hmbTable(self, value): |
493 | 490 |
self._hmbTable = value |
491 |
''' |
|
494 | 492 |
|
495 | 493 |
''' |
496 | 494 |
@brief get line type config of given line type |
497 | 495 |
@author humkyung |
498 | 496 |
@date 2018.06.28 |
499 | 497 |
''' |
500 |
|
|
501 | 498 |
def getLineTypeConfig(self, lineType): |
502 | 499 |
from PyQt5.QtCore import Qt |
503 | 500 |
|
... | ... | |
512 | 509 |
@author Jeongwoo |
513 | 510 |
@date 2018.05.03 |
514 | 511 |
''' |
515 |
|
|
516 | 512 |
def isExistFileName(self, name): |
517 | 513 |
rows = None |
518 | 514 |
with self.project.database.connect() as conn: |
... | ... | |
538 | 534 |
@author Jeongwoo |
539 | 535 |
@date 2018.05.03 |
540 | 536 |
''' |
541 |
|
|
542 | 537 |
def insertSymbol(self, symbol): |
543 | 538 |
isAdded = False |
544 | 539 |
with self.project.database.connect() as conn: |
... | ... | |
576 | 571 |
@author Jeongwoo |
577 | 572 |
@date 2018.05.03 |
578 | 573 |
''' |
579 |
|
|
580 | 574 |
def updateSymbol(self, symbol): |
581 | 575 |
isUpdated = False |
582 | 576 |
|
DTI_PID/DTI_PID/HMBDialog.py | ||
---|---|---|
169 | 169 |
|
170 | 170 |
def on_open_hmb_file(self): |
171 | 171 |
"""open hmb file""" |
172 |
from HMBTable import HMBData, StreamData |
|
172 |
#from HMBTable import HMBData, StreamData
|
|
173 | 173 |
|
174 | 174 |
options = QFileDialog.Options() |
175 | 175 |
options |= QFileDialog.DontUseNativeDialog |
... | ... | |
180 | 180 |
|
181 | 181 |
def accept(self): |
182 | 182 |
"""accept dialog""" |
183 |
from HMBTable import HMBTable, HMBData |
|
184 |
from SymbolAttr import SymbolAttr |
|
183 |
#from HMBTable import HMBTable, HMBData
|
|
184 |
#from SymbolAttr import SymbolAttr
|
|
185 | 185 |
|
186 | 186 |
def on_finished(): |
187 | 187 |
self.fill_hmb_data(None) |
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
501 | 501 |
|
502 | 502 |
return '' |
503 | 503 |
|
504 |
|
|
505 | 504 |
def getAttributes(self, findOwner=False): |
506 | 505 |
"""calculate all attributes of item""" |
507 | 506 |
import re |
... | ... | |
518 | 517 |
_attrs = {} |
519 | 518 |
try: |
520 | 519 |
from AppDocData import AppDocData |
521 |
from SymbolSvgItem import SymbolSvgItem |
|
522 |
from EngineeringTextItem import QEngineeringTextItem |
|
523 |
from EngineeringValveOperCodeTextItem import QEngineeringValveOperCodeTextItem |
|
520 |
#from SymbolSvgItem import SymbolSvgItem |
|
521 |
#from EngineeringTextItem import QEngineeringTextItem |
|
524 | 522 |
from EngineeringLineItem import QEngineeringLineItem |
525 | 523 |
from EngineeringVendorItem import QEngineeringVendorItem |
526 | 524 |
from EngineeringLineNoTextItem import QEngineeringLineNoTextItem |
527 | 525 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
528 | 526 |
from QEngineeringTagNoTextItem import QEngineeringTagNoTextItem |
527 |
from ItemDataExportDialog import QItemDataExportDialog |
|
529 | 528 |
|
530 | 529 |
""" get attributes of item from database """ |
531 | 530 |
app_doc_data = AppDocData.instance() |
... | ... | |
577 | 576 |
self.attrs = _attrs |
578 | 577 |
|
579 | 578 |
for attr in [_attr for _attr in sorted(self.attrs.keys(), key=lambda param:int(param.Index)) \ |
580 |
if _attr.AttributeType != 'Combined' and _attr.AttributeType != 'Reference']: |
|
579 |
if _attr.AttributeType != 'Combined' and _attr.AttributeType != 'Reference' and _attr.AttributeType != 'HMB']:
|
|
581 | 580 |
# if attr.Freeze: continue # do not evaluate value if attribute is frozen |
582 | 581 |
if attr.AttributeType == 'Text Item' or attr.AttributeType == 'Valve Oper Code': |
583 | 582 |
at = int(attr.AttrAt) |
... | ... | |
625 | 624 |
#_attrs[attr] = attr.Expression if attr.Expression and not _attrs[attr] else _attrs[attr] |
626 | 625 |
_attrs[attr] = self.try_eval(None, attr.Expression) if attr.Expression else _attrs[attr] |
627 | 626 |
|
627 |
"""calculate attribute value for HMB type""" |
|
628 |
for attr in [_attr for _attr in targetAttrs if _attr.AttributeType == 'HMB']: |
|
629 |
value, pos = '', 0 |
|
630 |
|
|
631 |
matches = p.finditer(attr.Expression) |
|
632 |
for match in matches: |
|
633 |
attr_name = attr.Expression[(match.start() + 1):(match.end() - 1)] |
|
634 |
values = [value for key, value in _attrs.items() if key.Attribute == attr_name] |
|
635 |
if not values: |
|
636 |
values = [] |
|
637 |
value += attr.Expression[pos:match.start()] + '\'' + values[0] + '\'' |
|
638 |
pos = match.end() |
|
639 |
|
|
640 |
value += attr.Expression[pos:len(attr.Expression)] |
|
641 |
_attrs[attr] = self.try_eval(None, value) if attr.Expression else '' |
|
642 |
"""up to here""" |
|
643 |
|
|
628 | 644 |
"""calculate attribute value for combined type""" |
629 | 645 |
p = re.compile('{[A-Za-z0-9_ ]+}') |
630 | 646 |
for attr in [_attr for _attr in targetAttrs if _attr.AttributeType == 'Combined']: |
... | ... | |
660 | 676 |
_attrs[attr] = self.try_eval(None, value) if attr.Expression else '' |
661 | 677 |
"""up to here""" |
662 | 678 |
|
663 |
"""HMB data""" |
|
664 |
|
|
665 |
"""up to here""" |
|
666 |
|
|
667 | 679 |
for _attr, _value in _attrs.items(): |
668 | 680 |
if _value is None or _value == '': |
669 | 681 |
_attr.AssocItem = None |
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py | ||
---|---|---|
113 | 113 |
|
114 | 114 |
if text == 'HMB': |
115 | 115 |
hmb = QComboBox() |
116 |
names = [] |
|
116 |
names = ['']
|
|
117 | 117 |
QItemDataExportDialog.add_hmb_header(names) |
118 | 118 |
hmb.addItems(names) |
119 | 119 |
self.ui.tableWidgetAttr.takeItem(row, 1) |
... | ... | |
203 | 203 |
|
204 | 204 |
def load_data(self, symbolType): |
205 | 205 |
"""load data from database""" |
206 |
from ItemDataExportDialog import QItemDataExportDialog |
|
206 | 207 |
|
207 | 208 |
try: |
208 | 209 |
app_doc_data = AppDocData.instance() |
... | ... | |
216 | 217 |
for attr in attrs: |
217 | 218 |
item = QTableWidgetItem(str(attr.UID)) # UID |
218 | 219 |
item.setData(Qt.UserRole, attr) |
219 |
#item.tag = attr |
|
220 | 220 |
self.ui.tableWidgetAttr.setItem(row, 0, item) |
221 |
item = QTableWidgetItem(attr.Attribute) # Name |
|
222 |
if attr.IsProp and attr.IsProp >= 2: |
|
223 |
item.setFlags(Qt.ItemIsEnabled) |
|
224 |
item.setBackground(Qt.lightGray) |
|
225 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
|
221 |
|
|
226 | 222 |
item = QTableWidgetItem(attr.DisplayAttribute) # Display Name |
227 | 223 |
self.ui.tableWidgetAttr.setItem(row, 2, item) |
228 | 224 |
|
... | ... | |
230 | 226 |
for key, value in QSymbolAttrEditorDialog.SYMBOL_ATTR_DATA_TYPES.items(): |
231 | 227 |
attrTypeComboBox.addItem(key) |
232 | 228 |
|
233 |
if attr.IsProp and attr.IsProp >= 3: |
|
229 |
if attr.IsProp and attr.IsProp >= 3: # Type
|
|
234 | 230 |
attrTypeComboBox.setEnabled(False) |
235 | 231 |
if attr.AttributeType in [type for type, _ in QSymbolAttrEditorDialog.SYMBOL_ATTR_DATA_TYPES.items()]: |
236 | 232 |
self.ui.tableWidgetAttr.setCellWidget(row, 3, attrTypeComboBox) |
237 |
result = attrTypeComboBox.findText(attr.AttributeType) # Type
|
|
233 |
result = attrTypeComboBox.findText(attr.AttributeType) |
|
238 | 234 |
attrTypeComboBox.setCurrentIndex(result) |
239 | 235 |
else: |
240 | 236 |
if attr.IsProp >= 3: |
... | ... | |
243 | 239 |
self.ui.tableWidgetAttr.setItem(row, 3, item) |
244 | 240 |
attrTypeComboBox.currentTextChanged.connect(self.changeType) |
245 | 241 |
|
242 |
if attr.AttributeType != 'HMB': |
|
243 |
item = QTableWidgetItem(attr.Attribute) # Name |
|
244 |
if attr.IsProp and attr.IsProp >= 2: |
|
245 |
item.setFlags(Qt.ItemIsEnabled) |
|
246 |
item.setBackground(Qt.lightGray) |
|
247 |
self.ui.tableWidgetAttr.setItem(row, 1, item) |
|
248 |
else: |
|
249 |
hmb = QComboBox() |
|
250 |
names = [''] |
|
251 |
QItemDataExportDialog.add_hmb_header(names) |
|
252 |
hmb.addItems(names) |
|
253 |
self.ui.tableWidgetAttr.setCellWidget(row, 1, hmb) |
|
254 |
result = attrTypeComboBox.findText(attr.AttributeType) |
|
255 |
if result: |
|
256 |
hmb.setCurrentIndex(result) |
|
257 |
|
|
246 | 258 |
item = QTableWidgetItem(str(attr.AttrAt)) # Attribute At |
247 | 259 |
if attr.IsProp and attr.IsProp >= 2: |
248 | 260 |
item.setFlags(Qt.ItemIsEnabled) |
내보내기 Unified diff