개정판 59bdc258
issue #663: 인식시 Text를 선택하지 않은 경우 기존의 Text를 재사용하도록 한다.
Change-Id: I97be7d9e420e4f98d40a40ad632c5a734a91e942
DTI_PID/DTI_PID/Commands/LoadCommand.py | ||
---|---|---|
39 | 39 |
def __init__(self): |
40 | 40 |
super(LoadCommand, self).__init__(None) |
41 | 41 |
|
42 |
def execute(self, params, symbol=True, text=True, line=True, unknown=True, update_items=True):
|
|
42 |
def execute(self, params, symbol=True, text=True, line=True, unknown=True, update=True): |
|
43 | 43 |
"""load data form xml file for database""" |
44 | 44 |
from datetime import datetime |
45 | 45 |
from App import App |
... | ... | |
75 | 75 |
value = self.load_data_from_database(drawing, scene, symbol, text, line, unknown) |
76 | 76 |
|
77 | 77 |
"""update items""" |
78 |
if update_items:
|
|
78 |
if update: |
|
79 | 79 |
_items = [_item for _item in scene.items() if hasattr(_item, 'owner') or hasattr(_item, 'connectors')] |
80 | 80 |
if _items: |
81 | 81 |
items = divide_chunks(_items, App.THREAD_MAX_WORKER if len(_items) > App.THREAD_MAX_WORKER else |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1492 | 1492 |
cmd.set_maximum.connect(self.progress.setMaximum) |
1493 | 1493 |
cmd.show_progress.connect(self.progress.setValue) |
1494 | 1494 |
cmd.execute((drawing, self.graphicsView.scene()), |
1495 |
symbol=True, text=True, line=True, unknown=True, update_items=True)
|
|
1495 |
symbol=True, text=True, line=True, unknown=True, update=True) |
|
1496 | 1496 |
# up to here |
1497 | 1497 |
|
1498 | 1498 |
""""update item tree widget""" |
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
101 | 101 |
from App import App |
102 | 102 |
from AppDocData import MessageType |
103 | 103 |
|
104 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
105 |
sys.exc_info()[-1].tb_lineno)
|
|
104 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
105 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
106 | 106 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
107 | 107 |
self.displayLog.emit(MessageType.Error, message) |
108 | 108 |
except: |
... | ... | |
143 | 143 |
except Exception as ex: |
144 | 144 |
from App import App |
145 | 145 |
|
146 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
147 |
sys.exc_info()[-1].tb_lineno)
|
|
146 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
147 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
148 | 148 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
149 | 149 |
|
150 | 150 |
return image |
... | ... | |
1041 | 1041 |
|
1042 | 1042 |
app_doc_data.imgName = os.path.splitext(os.path.basename(mainRes))[0] |
1043 | 1043 |
else: |
1044 |
from LoadCommand import LoadCommand |
|
1044 | 1045 |
import math |
1045 | 1046 |
from TextInfo import TextInfo |
1046 | 1047 |
|
1048 |
"""load texts""" |
|
1049 |
cmd = LoadCommand() |
|
1050 |
cmd.execute((drawing, worker.scene), symbol=False, text=True, line=False, unknown=False, |
|
1051 |
update=False) |
|
1052 |
"""up to here""" |
|
1047 | 1053 |
textItems = [item for item in worker.scene.items() if issubclass(type(item), QEngineeringTextItem)] |
1048 | 1054 |
app_doc_data.texts.extend(textItems) |
1049 | 1055 |
app_doc_data.allItems.extend(textItems) |
... | ... | |
1075 | 1081 |
valid = 0 |
1076 | 1082 |
for text_info in textInfoList: |
1077 | 1083 |
info_center = text_info.center |
1078 |
if sym_xmin < info_center[0] < sym_xmax and info_center[1] > sym_ymin and \ |
|
1079 |
info_center[1] < sym_ymax: |
|
1084 |
if sym_xmin < info_center[0] < sym_xmax and sym_ymin < info_center[1] < sym_ymax: |
|
1080 | 1085 |
valid += 1 |
1081 | 1086 |
break |
1082 | 1087 |
#if valid >= valid_count: |
... | ... | |
1212 | 1217 |
if item and type(item) is QEngineeringLineItem: |
1213 | 1218 |
Worker.changeConnectedLineType(item, sym.conn_type[index]) |
1214 | 1219 |
except Exception as ex: |
1215 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[
|
|
1216 |
-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
|
|
1220 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
1221 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
1217 | 1222 |
worker.displayLog.emit(MessageType.Error, message) |
1218 | 1223 |
# up to here |
1219 | 1224 |
|
... | ... | |
1232 | 1237 |
if conn.connectedItem is line: |
1233 | 1238 |
conn.connectedItem = None |
1234 | 1239 |
except Exception as ex: |
1235 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[
|
|
1236 |
-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
|
|
1240 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
1241 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
1237 | 1242 |
worker.displayLog.emit(MessageType.Error, message) |
1238 | 1243 |
# up to here |
1239 | 1244 |
|
1240 | 1245 |
worker.create_unknown_items(mainRes) |
1241 | 1246 |
worker.add_detected_items_to_scene.emit(worker.scene) |
1242 | 1247 |
worker.cond.wait(worker.mutex) |
1243 |
""" |
|
1244 |
while not worker.scene._end: |
|
1245 |
pass |
|
1246 |
""" |
|
1247 | 1248 |
|
1248 | 1249 |
worker.scene._end = False |
1249 | 1250 |
# clear drawing |
... | ... | |
1251 | 1252 |
|
1252 | 1253 |
worker.updateBatchProgress.emit(len(drawings), 1) |
1253 | 1254 |
except Exception as ex: |
1254 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
1255 |
sys.exc_info()[-1].tb_lineno)
|
|
1255 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
1256 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
1256 | 1257 |
worker.displayLog.emit(MessageType.Error, message) |
1257 | 1258 |
finally: |
1258 | 1259 |
pass |
내보내기 Unified diff