개정판 14ea3f13
issue #429: tag no applied, linetracer on going
Change-Id: I99eec9108ecffa1c693c37c8602cec00d4182cbf
DTI_PID/DTI_PID/Configs.py | ||
---|---|---|
102 | 102 |
return (False,) |
103 | 103 | |
104 | 104 |
@staticmethod |
105 |
def instance(): |
|
105 |
def instance(tag=False):
|
|
106 | 106 |
res = [] |
107 | 107 | |
108 | 108 |
delimiter = '!-!' |
109 | 109 | |
110 | 110 |
appDocData = AppDocData.instance() |
111 |
configs = appDocData.getConfigs('Line No', 'Size Unit') |
|
111 |
configs = appDocData.getConfigs('Line No', 'Size Unit') if not tag else \ |
|
112 |
appDocData.getConfigs('Tag No', 'Size Unit') |
|
112 | 113 |
if 1 == len(configs): |
113 | 114 |
sizeUnits = configs[0].value.split(delimiter) |
114 | 115 |
else: return None |
115 |
configs = appDocData.getConfigs('Line No', 'Delimiter') |
|
116 |
configs = appDocData.getConfigs('Line No', 'Delimiter') if not tag else \ |
|
117 |
appDocData.getConfigs('Tag No', 'Delimiter') |
|
116 | 118 |
if 1 == len(configs): |
117 | 119 |
lineInsideDelimiters = configs[0].value.split(delimiter) |
118 | 120 |
else: return None |
119 |
configs = appDocData.getConfigs('Line No', 'Configuration') |
|
121 |
configs = appDocData.getConfigs('Line No', 'Configuration') if not tag else \ |
|
122 |
appDocData.getConfigs('Tag No', 'Configuration') |
|
120 | 123 |
if len(configs) == 1 and configs[0].value is not None: |
121 | 124 |
lineConfigs = configs[0].value.split(delimiter) |
122 | 125 |
else: return None |
123 | 126 | |
124 | 127 |
if len(sizeUnits) == len(lineInsideDelimiters) and len(sizeUnits) == len(lineConfigs): |
125 | 128 |
for i in range(len(sizeUnits)): |
126 |
res.append(LineNoConfig(sizeUnits[i], lineInsideDelimiters[i], lineConfigs[i])) |
|
129 |
res.append(LineNoConfig(sizeUnits[i], lineInsideDelimiters[i], lineConfigs[i])) if not tag else \ |
|
130 |
res.append(TagNoConfig(sizeUnits[i], lineInsideDelimiters[i], lineConfigs[i])) |
|
127 | 131 | |
128 |
return res |
|
132 |
return res |
|
133 | ||
134 |
class TagNoConfig(LineNoConfig): |
|
135 |
def __init__(self, unit, delimiter, value): |
|
136 |
LineNoConfig.__init__(self, unit, delimiter, value) |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
45 | 45 |
''' |
46 | 46 | |
47 | 47 |
def createTextItem(self, textInfo): |
48 |
from Configs import LineNoConfig |
|
48 |
from Configs import LineNoConfig, TagNoConfig
|
|
49 | 49 | |
50 | 50 |
item = None |
51 | 51 | |
... | ... | |
56 | 56 |
configs = docData.getConfigs('Size', 'Delimiter') |
57 | 57 |
sizeDelimiter = configs[0].value.upper() if 1 == len(configs) else None |
58 | 58 | |
59 |
# check is line no |
|
59 | 60 |
line_no_configs = LineNoConfig.instance() |
60 | 61 |
if line_no_configs: |
61 | 62 |
for line_no_config in line_no_configs: |
... | ... | |
66 | 67 |
else: |
67 | 68 |
result = (False,) |
68 | 69 | |
70 |
# check is tag no |
|
71 |
tag_no_configs = TagNoConfig.instance(tag=True) |
|
72 |
if tag_no_configs: |
|
73 |
for tag_no_config in tag_no_configs: |
|
74 |
tagResult = tag_no_config.parse(text) |
|
75 |
if tagResult[0]: |
|
76 |
sizeUnit = tag_no_config.unit |
|
77 |
break |
|
78 |
else: |
|
79 |
tagResult = (False,) |
|
80 | ||
69 | 81 |
if result[0]: |
70 | 82 |
item = QEngineeringLineNoTextItem() |
71 | 83 |
text = ''.join(result[1]) |
... | ... | |
109 | 121 |
item.change_color(QColor(int(rgb[0]), int(rgb[1]), int(rgb[2])).name()) |
110 | 122 |
# up to here |
111 | 123 |
docData.tracerLineNos.append(item) |
124 |
elif tagResult[0]: |
|
125 |
item = QEngineeringTagNoTextItem() |
|
126 |
item.setToolTip('TAG NO = {}'.format(text)) |
|
127 |
item.setPlainText(text) |
|
112 | 128 |
else: |
113 | 129 |
item = self.create_note_no_text(textInfo) |
114 | 130 |
sizeText = self.isSizeText(text, sizeDelimiter) |
... | ... | |
122 | 138 |
item = QEngineeringSizeTextItem() |
123 | 139 |
item.setToolTip('SIZE = {}'.format(sizeText)) |
124 | 140 |
item.setPlainText(sizeText) |
125 |
elif self.isTagNoText(text): |
|
126 |
item = QEngineeringTagNoTextItem() |
|
127 |
item.setToolTip('TAG NO = {}'.format(text)) |
|
128 |
item.setPlainText(text) |
|
141 |
#elif self.isTagNoText(text):
|
|
142 |
# item = QEngineeringTagNoTextItem()
|
|
143 |
# item.setToolTip('TAG NO = {}'.format(text))
|
|
144 |
# item.setPlainText(text)
|
|
129 | 145 |
elif self.is_valve_operation_code(text): |
130 | 146 |
item = QEngineeringValveOperCodeTextItem() |
131 | 147 |
item.setToolTip('Valve Operation Code = {}'.format(text)) |
내보내기 Unified diff