MCPcopy
hub / github.com/yuka-friends/Windrecorder / render

Function render

windrecorder/ui/setting.py:33–426  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31
32
33def render():
34 st.markdown(_t("set_md_title"))
35
36 col1b, col2b, col3b = st.columns([1, 0.5, 1.5])
37 with col1b:
38 # 更新数据库
39 st.markdown(_t("set_md_index_db"))
40
41 # 绘制数据库提示横幅
42 draw_db_status()
43
44 def update_database_clicked():
45 st.session_state.update_button_disabled = True
46
47 col1, col2 = st.columns([1, 1])
48 with col1:
49 # 设置ocr引擎
50 ocr_engine = st.selectbox(
51 _t("set_selectbox_local_ocr_engine"),
52 config.support_ocr_lst,
53 index=[index for index, value in enumerate(config.support_ocr_lst) if value == config.ocr_engine][0],
54 help=_t("set_selectbox_local_ocr_engine_help"),
55 )
56
57 with col2:
58 # 设定ocr引擎语言
59 if "os_support_lang" not in st.session_state: # 获取系统支持的OCR语言
60 st.session_state.os_support_lang = utils.get_os_support_lang()
61
62 ocr_lang_index = legal_ocr_lang_index()
63 if ocr_engine == "Windows.Media.Ocr.Cli":
64 config_ocr_lang = st.selectbox(
65 _t("set_selectbox_ocr_lang"),
66 st.session_state.os_support_lang,
67 index=ocr_lang_index,
68 help=_t("set_help_ocr_lang_windows_ocr_engine"),
69 )
70 third_party_engine_ocr_lang = config.third_party_engine_ocr_lang
71 else:
72 config_ocr_lang = config.ocr_lang
73 if OCR_SUPPORT_CONFIG[ocr_engine]["support_multiple_languages"]:
74 third_party_engine_ocr_lang = st.multiselect(
75 label=_t("set_selectbox_ocr_lang"),
76 options=[value for value in OCR_SUPPORT_CONFIG[ocr_engine]["support_lang_option"].values()],
77 default=[
78 value
79 for key, value in OCR_SUPPORT_CONFIG[ocr_engine]["support_lang_option"].items()
80 if key in config.third_party_engine_ocr_lang
81 ],
82 )
83 else:
84 try:
85 third_party_engine_ocr_lang_index = [
86 index
87 for index, value in enumerate(OCR_SUPPORT_CONFIG[ocr_engine]["support_lang_option"])
88 if value == config.third_party_engine_ocr_lang[0]
89 ][0]
90 except (KeyError, IndexError):

Callers

nothing calls this directly

Calls 8

draw_db_statusFunction · 0.85
legal_ocr_lang_indexFunction · 0.85
screen_ignore_paddingFunction · 0.85
set_config_langFunction · 0.85
runMethod · 0.80
set_and_save_configMethod · 0.80

Tested by

no test coverage detected