Skip to content

Commit

Permalink
新增命令行指令:切换识别语言(#161
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroi-sora committed Jun 18, 2023
1 parent 5a9af26 commit 9bc76d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ocr/msn.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Msn:

'''任务器必须有四个公有方法:onStart onGet onStop onGet
'''任务器必须有四个公有方法:onStart onGet onStop onError
每个方法必有一个传入值:num。定义如下:
num = {
'all': len(paths), # 全部数量
Expand Down
9 changes: 7 additions & 2 deletions utils/command_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
# ======================= 参数解析 ===================================

Flags = gflags.FLAGS
gflags.DEFINE_bool('no_win', False, '(已过时,请用-hide)true时隐藏窗口,最小化到托盘') # 兼容旧版
gflags.DEFINE_bool('hide', False, 'true时隐藏窗口,最小化到托盘') # 兼容旧版
gflags.DEFINE_bool('no_win', False, '(已过时,请用-hide)true时隐藏窗口,最小化到托盘') # 兼容旧版
gflags.DEFINE_bool('hide', False, 'true时隐藏窗口,最小化到托盘') # 兼容旧版
gflags.DEFINE_bool('show', False, 'true时将主窗口显示到最前(不锁定)。')
gflags.DEFINE_bool('exit', False, 'true时退出Umi-OCR。')
gflags.DEFINE_bool('clipboard', False, 'true时读取一次剪贴板进行识图。')
gflags.DEFINE_bool('screenshot', False, 'true时进行一次截屏识图。')
gflags.DEFINE_string('img', '', '传入本地图片路径。含空格的路径用引号""括起来。多个路径可用逗号,连接。')
gflags.DEFINE_integer('language', -1, '更改识别语言。传入序号(从0开始),切换为设置页中对应序号的语言。')


DictDefault = Flags.FlagValuesDict() # 生成默认值字典
Expand Down Expand Up @@ -60,6 +61,10 @@ def Mission(flags):
Config.main.onCloseWin() # 关闭窗口
else: # 若没有,则
Config.main.win.iconify() # 最小化
if flags['language'] > -1: # 切换语言
lans, index = list(Config.get("ocrConfig").keys()), flags['language']
if(index < len(lans)):
Config.set("ocrConfigName", lans[index])

# 任务
if not Config.main.isMsnReady():
Expand Down

0 comments on commit 9bc76d6

Please sign in to comment.