개정판 eccf41cd
issue #49: fix codetable
Change-Id: I7ab36de91e9a408f7887fe5786007865b2087b54
DTI_PID/DTI_PID/CodeTableDialog.py | ||
---|---|---|
497 | 497 |
def makeAllowable(self, code): |
498 | 498 |
''' make allowable for code ''' |
499 | 499 |
from CodeTables import CodeTable |
500 |
import re |
|
501 | 500 |
|
502 | 501 |
founds = [] |
503 | 502 |
code_ori = code |
DTI_PID/DTI_PID/CodeTables.py | ||
---|---|---|
74 | 74 |
def find_match_exactly(self, text): |
75 | 75 |
import re |
76 | 76 |
|
77 |
for value in self.values: |
|
78 |
# code |
|
79 |
if text == value[1]: |
|
80 |
return value[1] |
|
81 |
else: |
|
82 |
match = re.search(value[1], text, re.DOTALL) |
|
83 |
if match and match.start() is 0 and match.end() is len(text): |
|
84 |
return text |
|
85 |
|
|
86 |
# allowable |
|
87 |
matches = [x for x in value[3] if x and text == x] |
|
88 |
if matches: |
|
77 |
try: |
|
78 |
for value in self.values: |
|
79 |
# code |
|
80 |
if text == value[1]: |
|
89 | 81 |
return value[1] |
90 | 82 |
else: |
91 |
if value[3][0]: |
|
92 |
match = re.search(value[3][0], text, re.DOTALL) |
|
93 |
if match and match.start() is 0 and match.end() is len(text): |
|
94 |
return value[1] |
|
83 |
match = re.search(value[1], text, re.DOTALL) |
|
84 |
if match and match.start() is 0 and match.end() is len(text): |
|
85 |
return text |
|
86 |
|
|
87 |
# allowable |
|
88 |
matches = [x for x in value[3] if x and text == x] |
|
89 |
if matches: |
|
90 |
return value[1] |
|
91 |
else: |
|
92 |
if value[3][0]: |
|
93 |
match = re.search(value[3][0], text, re.DOTALL) |
|
94 |
if match and match.start() is 0 and match.end() is len(text): |
|
95 |
return value[1] |
|
96 |
|
|
97 |
return None |
|
98 |
|
|
99 |
except Exception as ex: |
|
100 |
import sys |
|
101 |
from App import App |
|
102 |
from AppDocData import MessageType |
|
103 |
|
|
104 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
105 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
95 | 106 |
|
96 |
return None |
|
107 |
return None
|
|
97 | 108 |
|
98 | 109 |
@staticmethod |
99 | 110 |
def instance(table_name, symbol_attribute_uid=None, custom_table_uid=None): |
내보내기 Unified diff