개정판 82be49cb
issue #1366: fix text area with web and scene
Change-Id: Iab02526052b542bb7bc31569572a77e70ef04ca5
DTI_PID/DTI_PID/RecognitionDialog.py | ||
---|---|---|
81 | 81 |
displayLog = pyqtSignal(MessageType, str) |
82 | 82 |
add_detected_items_to_scene = pyqtSignal(QGraphicsScene) |
83 | 83 |
add_predata_to_scene = pyqtSignal(Drawing, QGraphicsScene, bool, bool, bool, bool, bool) |
84 |
clear_scene = pyqtSignal(list) |
|
84 | 85 |
|
85 | 86 |
def __init__(self, mutex, cond): |
86 | 87 |
super(Worker, self).__init__() |
... | ... | |
796 | 797 |
listWidget.addItem(item) |
797 | 798 |
continue |
798 | 799 |
|
799 |
worker.scene.clear() |
|
800 |
worker.text_scene.clear() |
|
801 |
worker.line_scene.clear() |
|
800 |
#worker.scene.clear() |
|
801 |
#worker.text_scene.clear() |
|
802 |
#worker.line_scene.clear() |
|
803 |
worker.clear_scene.emit([worker.scene, worker.text_scene, worker.line_scene]) |
|
804 |
worker.cond.wait(worker.mutex) |
|
802 | 805 |
|
803 | 806 |
app_doc_data.clearItemList(True) |
804 | 807 |
|
... | ... | |
2525 | 2528 |
self.obj.displayTitle.connect(self.displayTitle) |
2526 | 2529 |
self.obj.add_detected_items_to_scene.connect(self.add_detected_items_to_scene) |
2527 | 2530 |
self.obj.add_predata_to_scene.connect(self.add_predata_to_scene) |
2531 |
self.obj.clear_scene.connect(self.clear_scene) |
|
2528 | 2532 |
|
2529 | 2533 |
# 4 - Connect Thread started signal to Worker operational slot method |
2530 | 2534 |
self.thread.started.connect(self.obj.procCounter) |
... | ... | |
2619 | 2623 |
finally: |
2620 | 2624 |
self.cond.wakeAll() |
2621 | 2625 |
|
2626 |
def clear_scene(self, scenes) -> None: |
|
2627 |
""" clear scenes """ |
|
2628 |
|
|
2629 |
try: |
|
2630 |
for scene in scenes: |
|
2631 |
scene.clear() |
|
2632 |
|
|
2633 |
except Exception as ex: |
|
2634 |
from App import App |
|
2635 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
2636 |
sys.exc_info()[-1].tb_lineno) |
|
2637 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
2638 |
finally: |
|
2639 |
self.cond.wakeAll() |
|
2640 |
|
|
2622 | 2641 |
def add_detected_items_to_scene(self, scene) -> None: |
2623 | 2642 |
"""add detected items to scene""" |
2624 | 2643 |
from SaveWorkCommand import SaveWorkCommand |
DTI_PID/DTI_PID/TextDetector.py | ||
---|---|---|
354 | 354 |
|
355 | 355 |
verticals = [] |
356 | 356 |
horizontals = [] |
357 |
invalid_rects = [] |
|
357 | 358 |
for rect in rects: |
358 | 359 |
if rect.width() < minSize and rect.height() < maxTextSize: |
359 | 360 |
rect._vertical = False |
... | ... | |
362 | 363 |
rect._vertical = True |
363 | 364 |
verticals.append(rect) |
364 | 365 |
elif rect.width() < minSize or rect.height() < minSize: |
365 |
continue
|
|
366 |
invalid_rects.append(rect)
|
|
366 | 367 |
elif rect.height() > rect.width(): |
367 | 368 |
rect._vertical = True |
368 | 369 |
verticals.append(rect) |
... | ... | |
370 | 371 |
rect._vertical = False |
371 | 372 |
horizontals.append(rect) |
372 | 373 |
|
374 |
for rect in invalid_rects: |
|
375 |
rects.remove(rect) |
|
376 |
|
|
373 | 377 |
v_merges = [] |
374 | 378 |
for vertical1 in verticals: |
375 | 379 |
for vertical2 in verticals: |
내보내기 Unified diff