개정판 859d4c52
issue #478: size text apply nominal table
Change-Id: I3e195457f4e3eb12ca01711b109a65c8c8d0622d
DTI_PID/DTI_PID/NominalPipeSize.py | ||
---|---|---|
66 | 66 |
|
67 | 67 |
def find(self, value, size_unit='Inch'): |
68 | 68 |
if size_unit.upper() == 'INCH': |
69 |
return (self.inchStr == value) or (value in self.allowable_inch_str.split(',')) |
|
69 |
if (self.inchStr == value) or (value in self.allowable_inch_str.split(',')): |
|
70 |
return self.inchStr |
|
70 | 71 |
elif size_unit.upper() == 'METRIC': |
71 |
return (self.metricStr == value) or (value in self.allowable_metric_str.split(',')) |
|
72 |
if (self.metricStr == value) or (value in self.allowable_metric_str.split(',')): |
|
73 |
return self.metricStr |
|
72 | 74 |
else: |
73 |
return (self.inchStr == value) or (value in self.allowable_inch_str.split(',')) or ( |
|
74 |
self.metricStr == value) or (value in self.allowable_metric_str.split(',')) |
|
75 |
if (self.inchStr == value) or (value in self.allowable_inch_str.split(',')): |
|
76 |
return self.inchStr |
|
77 |
if (self.metricStr == value) or (value in self.allowable_metric_str.split(',')): |
|
78 |
return self.metricStr |
|
79 |
return False |
|
75 | 80 |
|
76 | 81 |
def find_starts_with(self, value, size_unit='Inch'): |
77 | 82 |
""" find text start with """ |
DTI_PID/DTI_PID/TextItemFactory.py | ||
---|---|---|
115 | 115 |
docData.tracerLineNos.append(item) |
116 | 116 |
else: |
117 | 117 |
item = self.create_note_no_text(textInfo) |
118 |
sizeText = self.isSizeText(text, sizeDelimiter) |
|
118 | 119 |
if item: |
119 | 120 |
pass |
120 | 121 |
elif self.is_reserved_word(text): |
121 | 122 |
item = QEngineeringReservedWordTextItem() |
122 | 123 |
item.setToolTip('Reserved Word = {}'.format(text)) |
123 | 124 |
item.setPlainText(text) |
124 |
elif self.isSizeText(text, sizeDelimiter):
|
|
125 |
elif sizeText:
|
|
125 | 126 |
item = QEngineeringSizeTextItem() |
126 |
text = text.replace(' ', '') |
|
127 |
item.setToolTip('SIZE = {}'.format(text)) |
|
128 |
item.setPlainText(text) |
|
127 |
item.setToolTip('SIZE = {}'.format(sizeText)) |
|
128 |
item.setPlainText(sizeText) |
|
129 | 129 |
elif self.isTagNoText(text): |
130 | 130 |
item = QEngineeringTagNoTextItem() |
131 | 131 |
item.setToolTip('TAG NO = {}'.format(text)) |
... | ... | |
300 | 300 |
@author humkyung |
301 | 301 |
@date 2018.05.02 |
302 | 302 |
''' |
303 |
def isSizeText(self, text, delimiter=None):
|
|
303 |
def isSizeText(self, text, delimiter='X'):
|
|
304 | 304 |
from NominalPipeSize import NominalPipeSizeTable |
305 | 305 |
|
306 | 306 |
sizeUnit = None |
... | ... | |
325 | 325 |
second = split_text[1] if len(split_text) is 2 else None |
326 | 326 |
|
327 | 327 |
tokens = [first, second] if second is not None and len(second) is not 0 else [first] |
328 |
index = 0 |
|
328 | 329 |
for token in tokens: |
329 |
matches = [sizeData for sizeData in pipe_sizes if (sizeData.find(token, sizeUnit) if sizeUnit else sizeData.find(token))] |
|
330 |
if not matches: return False |
|
330 |
matches = [(sizeData.find(token, sizeUnit) if sizeUnit else sizeData.find(token)) for sizeData in pipe_sizes if (sizeData.find(token, sizeUnit) if sizeUnit else sizeData.find(token))] |
|
331 |
if matches: |
|
332 |
tokens[index] = matches[0] |
|
333 |
else: |
|
334 |
return False |
|
335 |
index += 1 |
|
331 | 336 |
|
332 |
return True
|
|
337 |
return delimiter.join(tokens)
|
|
333 | 338 |
|
334 | 339 |
''' |
335 | 340 |
@brief check if given text is tag no |
내보내기 Unified diff