Skip to content

Commit

Permalink
添加三个命令行指令(hiroi-sora#173
Browse files Browse the repository at this point in the history
1. 指定弹出模式-window_top_mode,0为静默模式,1为自动弹出
2. 指定输出文件目录,-output_file_path="目录"
3. 指定输出文件名前缀,-output_file_name="文件名"
  • Loading branch information
hiroi-sora committed Jul 14, 2023
1 parent b41381a commit a534f6e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions utils/command_arg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import utils.gflags as gflags
from utils.logger import GetLog
from utils.config import Config
from utils.config import Config, WindowTopModeFlag

import re
import os
Expand All @@ -18,8 +18,11 @@
Flags = gflags.FLAGS
# 设置
gflags.DEFINE_integer('language', -1, '更改识别语言。传入序号(从0开始),切换为设置页中对应序号的语言。')
gflags.DEFINE_integer('window_top_mode', -1, '窗口置顶模式。0为静默模式,1为自动弹出。')
gflags.DEFINE_string('output_file_path', '', '指定输出文件的目录(文件夹)。')
gflags.DEFINE_string('output_file_name', '', '指定输出文件的文件名(不含后缀)。')
# 指令
gflags.DEFINE_bool('hide', False, 'true时隐藏窗口,最小化到托盘。') # 兼容旧版
gflags.DEFINE_bool('hide', False, 'true时隐藏窗口,最小化到托盘。')
gflags.DEFINE_bool('show', False, 'true时将主窗口弹出到最前方。')
gflags.DEFINE_bool('exit', False, 'true时退出Umi-OCR。')
# 任务
Expand Down Expand Up @@ -65,6 +68,14 @@ def Mission(flags):
lans, index = list(Config.get("ocrConfig").keys()), flags['language']
if(index < len(lans)):
Config.set("ocrConfigName", lans[index])
if flags['window_top_mode'] == 0: # 窗口弹出模式
Config.set("WindowTopMode", WindowTopModeFlag.never)
elif flags['window_top_mode'] == 1:
Config.set("WindowTopMode", WindowTopModeFlag.finish)
if flags['output_file_path']: # 输出文件目录
Config.set("outputFilePath", flags['output_file_path'])
if flags['output_file_name']: # 输出文件文件名前缀
Config.set("outputFileName", flags['output_file_name'])

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

0 comments on commit a534f6e

Please sign in to comment.