Skip to content

Commit

Permalink
Merge pull request #754 from Starry-Wind/main-beta
Browse files Browse the repository at this point in the history
Main beta
  • Loading branch information
Night-stars-1 authored Nov 10, 2023
2 parents 0654db2 + b167fb7 commit 7df1c99
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Honkai_Star_Rail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(_("请重新运行"))

Expand Down
13 changes: 12 additions & 1 deletion gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -324,6 +334,7 @@ def save(e):
open_map_tf,
language_dd,
fighting_dd,
shutdown_dd,
ft.ElevatedButton(_("保存"), on_click=save),
)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ class SRAData(metaclass=SRADataMeta):
"""是否在打印遗器信息时显示拓展信息"""
ndigits_for_relic: int = 2
"""在打印遗器信息时的小数精度"""

auto_shutdown: bool = False
"""是否自动关机"""

def __init__(self) -> None:
...
Expand Down

0 comments on commit 7df1c99

Please sign in to comment.