forked from hiroi-sora/Umi-OCR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput_panel.py
40 lines (32 loc) · 1.19 KB
/
output_panel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 输出到软件面板
from utils.config import Config
from ocr.output import Output
from utils.logger import GetLog
Log = GetLog()
class OutputPanel(Output):
def __init__(self):
self.panelOutput = Config.main.panelOutput # 输出接口
self.isDebug = Config.get('isDebug') # 是否输出调试
self.outputPath = Config.get('outputFilePath') # 输出文件夹,用于计划任务的完成后打开文件夹
def print(self, text, highlight=''):
self.panelOutput(text, highlight=highlight)
def debug(self, text):
'''输出调试信息'''
self.print(f'[调试信息] {text}')
def text(self, text):
'''输出正文'''
self.print(text)
def img(self, textBlockList, imgInfo, numData, textDebug):
'''输出图片结果'''
# 输出标题
self.print('\n')
self.print(imgInfo['name'], highlight='blue') # 高亮输出文件名
# debug信息
textOut = '\n\n'
if self.isDebug and textDebug:
textOut += textDebug
# 正文
for tb in textBlockList:
if tb['text']:
textOut += f'{tb["text"]}\n'
self.print(textOut+'\n')