From 0f698d4fbfcba3f73435bab3a7c198a4d430e7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A0=E6=AA=AC=E6=A9=99=E5=91=B3=E5=A4=B9=E5=BF=83?= =?UTF-8?q?=E7=B3=96?= <80755556+iceNo9@users.noreply.github.com> Date: Sun, 5 Nov 2023 13:00:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E8=87=AA=E5=8A=A8=E5=85=B3=E6=9C=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20=E6=B7=BB=E5=8A=A0config.json=E7=9A=84=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=85=B3=E6=9C=BA=E5=BC=80=E5=85=B3=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=9B=20=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E60S?= =?UTF-8?q?=E5=85=B3=E6=9C=BA=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Honkai_Star_Rail.py | 8 ++++++++ gui.py | 13 ++++++++++++- utils/config.py | 3 ++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Honkai_Star_Rail.py b/Honkai_Star_Rail.py index f6546f05..6d96c066 100644 --- a/Honkai_Star_Rail.py +++ b/Honkai_Star_Rail.py @@ -102,6 +102,8 @@ def stop(self): return [{}] def end(self): + if sra_config_obj.auto_shutdown: + os.system("shutdown -s -t 60") try: plugin_manager.hook.end(SRA=self) except: @@ -256,6 +258,12 @@ def set_config(self, start = True): options = [_('没打开'), _('打开了'), _('这是什么')] option = questionary.select(title, options).ask() sra_config_obj.auto_battle_persistence = options.index(option) + + title = _("需要锄大地结束后自动关机么?:") + options = [_('不需要'), _('需要')] + option = questionary.select(title, options).ask() + sra_config_obj.auto_shutdown = bool(options.index(option)) + sra_config_obj.start = True raise Exception(_("请重新运行")) diff --git a/gui.py b/gui.py index 241dca68..b5a5b11c 100644 --- a/gui.py +++ b/gui.py @@ -243,7 +243,9 @@ def set_config(e): language = list(filter(lambda key: language_dict[key] == language, language_dict))[0] fighting_list = [_('没打开'), _('打开了'), _('这是什么')] + shutdown_list = [_('不需要'), _('需要')] fighting = fighting_list[sra_config_obj.auto_battle_persistence] + shutdown = shutdown_list[sra_config_obj.auto_shutdown] github_proxy_list = ['https://ghproxy.com/', 'https://ghproxy.net/', "不设置代理"] github_proxy = sra_config_obj.github_proxy @@ -300,7 +302,14 @@ def set_config(e): value=fighting, width=200, ) - + shutdown_dd = ft.Dropdown( + label= _("需要锄大地结束后自动关机么?"), + hint_text= _("设置自动关机?"), + options=[ft.dropdown.Option(i) for i in shutdown_list], + value=shutdown, + width=200, + ) + open_map_tf = ft.TextField(label=_("打开地图按钮"), value=open_map, width=200) def save(e): sra_config_obj.github_proxy = "" if github_proxy_dd.value == "不设置代理" else github_proxy_dd.value @@ -310,6 +319,7 @@ def save(e): sra_config_obj.level = level_dd.value sra_config_obj.language = language_dict[language_dd.value] sra_config_obj.auto_battle_persistence = fighting_list.index(fighting_dd.value) + sra_config_obj.auto_shutdown = bool(shutdown_list.index(shutdown_dd.value)) sra_config_obj.start = True to_page_main(page) page.clean() @@ -324,6 +334,7 @@ def save(e): open_map_tf, language_dd, fighting_dd, + shutdown_dd, ft.ElevatedButton(_("保存"), on_click=save), ) diff --git a/utils/config.py b/utils/config.py index dc333ee7..f1df29f9 100644 --- a/utils/config.py +++ b/utils/config.py @@ -328,7 +328,8 @@ class SRAData(metaclass=SRADataMeta): """是否在打印遗器信息时显示拓展信息""" ndigits_for_relic: int = 2 """在打印遗器信息时的小数精度""" - + auto_shutdown: bool = False + """是否自动关机""" def __init__(self) -> None: ... From 7587e0dfc02082cc78bc203b77dce6c292ce4617 Mon Sep 17 00:00:00 2001 From: Weiduhuo <1281586535@qq.com> Date: Fri, 10 Nov 2023 15:25:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=AE=89=E8=A3=85'onnxruntime'=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fa58ac5d..97d6cc05 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ packaging protobuf sympy whl/Polygon3-3.0.9-cp311-cp311-win_amd64.whl -cnocr>=2.2.2.3 +cnocr[ort-cpu]>=2.2.2.3 docopt httpx httpx_socks