개정판 7e2d59db
issue #643: fix text replace and fix code table import from excel
Change-Id: Ic4fc08d1c39620b7503d3d452318d00e1740d218
DTI_PID/DTI_PID/CodeTableDialog.py | ||
---|---|---|
314 | 314 |
for tableData in tableDatas: |
315 | 315 |
table.setItem(row, 0, QTableWidgetItem(tableData[0])) # UID |
316 | 316 |
table.setItem(row, 1, QTableWidgetItem(tableData[1])) # Name |
317 |
table.setItem(row, 2, QTableWidgetItem(tableData[2])) # Description |
|
318 |
table.setItem(row, 3, QTableWidgetItem(tableData[3] if type(tableData[3]) is str else ','.join(tableData[3]))) # Allowables |
|
317 |
table.setItem(row, 2, QTableWidgetItem(tableData[2] if tableData[2] else '')) # Description |
|
318 |
table.setItem(row, 3, QTableWidgetItem((tableData[3] if type(tableData[3]) is str else ','.join(tableData[3])) \ |
|
319 |
if tableData[3] else '')) # Allowables |
|
319 | 320 |
row += 1 |
320 | 321 |
except Exception as ex: |
321 | 322 |
from App import App |
DTI_PID/DTI_PID/NominalPipeSize.py | ||
---|---|---|
85 | 85 |
if value.startswith(self.inchStr): |
86 | 86 |
return self.inchStr, self.inchStr |
87 | 87 |
else: |
88 |
matches = [x for x in self.allowable_inch_str.split(',') if value.startswith(x)] |
|
88 |
matches = [x for x in self.allowable_inch_str.split(',') if x and value.startswith(x)]
|
|
89 | 89 |
if matches: return self.inchStr, matches[0] |
90 | 90 |
elif size_unit.upper() == 'METRIC': |
91 | 91 |
if value.startswith(self.metricStr): |
92 | 92 |
return self.metricStr, self.metricStr |
93 | 93 |
else: |
94 |
matches = [x for x in self.allowable_metric_str.split(',') if value.startswith(x)] |
|
94 |
matches = [x for x in self.allowable_metric_str.split(',') if x and value.startswith(x)]
|
|
95 | 95 |
if matches: return self.metricStr, matches[0] |
96 | 96 |
else: |
97 | 97 |
if value.startswith(self.inchStr): |
... | ... | |
99 | 99 |
elif value.startswith(self.metricStr): |
100 | 100 |
return self.metricStr, self.metricStr |
101 | 101 |
else: |
102 |
matches = [x for x in self.allowable_inch_str.split(',') if value.startswith(x)] |
|
102 |
matches = [x for x in self.allowable_inch_str.split(',') if x and value.startswith(x)]
|
|
103 | 103 |
if matches: return self.inchStr, matches[0] |
104 | 104 |
|
105 |
matches = [x for x in self.allowable_metric_str.split(',') if value.startswith(x)] |
|
105 |
matches = [x for x in self.allowable_metric_str.split(',') if x and value.startswith(x)]
|
|
106 | 106 |
if matches: return self.metricStr, matches[0] |
107 | 107 |
|
108 | 108 |
return None, None |
DTI_PID/DTI_PID/TextItemEditDialog.py | ||
---|---|---|
84 | 84 |
"""replace text""" |
85 | 85 |
self.find_text() |
86 | 86 |
|
87 |
text_find = self.ui.lineEditFindText.text() |
|
87 | 88 |
replace = self.ui.lineEditReplaceText.text() |
88 | 89 |
model = self.ui.tableViewResult.model() |
89 | 90 |
if replace and model.rowCount(): |
... | ... | |
93 | 94 |
data = item.data() |
94 | 95 |
if data and data.text() != replace: |
95 | 96 |
text = data.text() |
96 |
messages.append(f"replaced: {text} --> {replace}")
|
|
97 |
data.setPlainText(text.replace(text, replace)) |
|
97 |
messages.append(f"replaced: {text} --> {text.replace(text_find, replace)}")
|
|
98 |
data.setPlainText(text.replace(text_find, replace))
|
|
98 | 99 |
|
99 | 100 |
if messages: |
100 | 101 |
QMessageBox.information(self, self.tr('Information'), '\r\n'.join(messages)) |
내보내기 Unified diff