Skip to content

Commit

Permalink
Merge pull request #750 from iceNo9/feat_add_auto_shutdown
Browse files Browse the repository at this point in the history
feat:添加运行结束自动关机功能
  • Loading branch information
Night-stars-1 authored Nov 5, 2023
2 parents d7ca2a1 + 0f698d4 commit c95fa62
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 67 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
220 changes: 156 additions & 64 deletions star_list.json
Original file line number Diff line number Diff line change
@@ -1,158 +1,250 @@
[
{
"path": "README_CHT.md",
"hash": "f26e29d09b17110ad6f79d5c40224d57"
"path": "get_width.py",
"hash": "f638b665c2c0f9cdd841c8bd35ad0852"
},
{
"path": "Honkai_Star_Rail.py",
"hash": "8cf02bb09a1a6ad9f733cf4b8205d33e"
},
{
"path": "requirements.txt",
"hash": "52b01c9107c262c1ea5ab6191c310997"
},
{
"path": "get_width.py",
"hash": "f638b665c2c0f9cdd841c8bd35ad0852"
"hash": "b012f1db3f52bd02c426c0cbe92166d9"
},
{
"path": "README.md",
"hash": "4262585cc05d08908b3df000c57a4f5d"
},
{
"path": "map_res_list.py",
"hash": "61ddda8760a56ea082d5d7276747312a"
},
{
"path": "README_EN.md",
"hash": "86793ffe1c415f308624e02b9924a4f8"
},
{
"path": "gui.py",
"hash": "aae914d57203b3b571281e78f06b55aa"
"path": "requirements.txt",
"hash": "d52010bafd48cfa9717624af567bc6a1"
},
{
"path": "whl/Polygon3-3.0.9-cp311-cp311-win_amd64.whl",
"hash": "43a2cab179598fdaaa21da76cdaaaafc"
"path": "gui.py",
"hash": "aae914d57203b3b571281e78f06b55aa"
},
{
"path": "whl/cnstd-1.2.2-py3-none-any.whl",
"hash": "2e700dd1d42f71c71b739bd6afa67a8a"
"path": "map_res_list.py",
"hash": "61ddda8760a56ea082d5d7276747312a"
},
{
"path": "whl/Polygon3-3.0.9.1-cp310-cp310-win_amd64.whl",
"hash": "0c19795eb68713cde783a434ea636ba9"
"path": "README_CHT.md",
"hash": "f26e29d09b17110ad6f79d5c40224d57"
},
{
"path": "whl/httpx_socks-0.7.7-py3-none-any.whl",
"hash": "9c9fcdf730445180029471858d8e8c27"
"path": "model/cnstd/1.2/ppocr/en_PP-OCRv3_det_infer.onnx",
"hash": "72708a3ac241e25fefbc606832dc7529"
},
{
"path": "whl/cnocr-2.2.2.3-py3-none-any.whl",
"hash": "fff249a0f8c75f5bc4f0f97c95880bd8"
"path": "model/cnstd/1.2/ppocr/ch_PP-OCRv3_det_infer.onnx",
"hash": "5732f8c84bd4cc0dab35094e7260f080"
},
{
"path": "model/cnocr/label_cn.txt",
"hash": "e3f7c9400f4379e05cadbbc8a43dda45"
},
{
"path": "model/cnocr/2.2/densenet_lite_114-fc/cnocr-v2.2-densenet_lite_114-fc-epoch=037-val-complete_match-epoch=0.9667-model.onnx",
"hash": "079f9e53539b1e636df518dfc8343f38"
},
{
"path": "model/cnocr/2.2/densenet_lite_134-fc/cnocr-v2.2-densenet_lite_134-fc-epoch=034-complete_match_epoch=0.8376-model.onnx",
"hash": "332265c72378b39e83ced6b4e42954c4"
},
{
"path": "model/cnocr/2.2/ppocr/en_number_mobile_v2.0_rec_infer.onnx",
"hash": "442ea7b4dabdbaec95af17a6d17c3503"
},
{
"path": "model/cnocr/2.2/ppocr/en_PP-OCRv3_rec_infer.onnx",
"hash": "003da6ca16cae88c5270882fc5e7417b"
},
{
"path": "model/cnocr/2.2/ppocr/en_number_mobile_v2.0_rec_infer.onnx",
"path": "model/cnocr_for_relic/2.2/densenet_lite_114-fc/cnocr-v2.2-densenet_lite_114-fc-epoch=037-complete_match_epoch=0.7859-model.onnx",
"hash": "d661b811419ff7dde7eb8543690cdd2b"
},
{
"path": "model/cnocr_for_relic/2.2/ppocr/en_number_mobile_v2.0_rec_infer.onnx",
"hash": "442ea7b4dabdbaec95af17a6d17c3503"
},
{
"path": "model/cnocr/2.2/densenet_lite_114-fc/cnocr-v2.2-densenet_lite_114-fc-epoch=037-val-complete_match-epoch=0.9667-model.onnx",
"hash": "079f9e53539b1e636df518dfc8343f38"
"path": "locale/EN/LC_MESSAGES/sra.mo",
"hash": "110d45fcca6c7b86a9770cf3e3009026"
},
{
"path": "model/cnstd/1.2/ppocr/en_PP-OCRv3_det_infer.onnx",
"hash": "72708a3ac241e25fefbc606832dc7529"
"path": "locale/zh_TC/LC_MESSAGES/sra.mo",
"hash": "ef66f8b317d24e3eb326e739cb9b00ee"
},
{
"path": "model/cnstd/1.2/ppocr/ch_PP-OCRv3_det_infer.onnx",
"hash": "5732f8c84bd4cc0dab35094e7260f080"
"path": "locale/zh_CN/LC_MESSAGES/sra.mo",
"hash": "0a0ccfe2f4f2da8626fda930bd84ef9c"
},
{
"path": "utils/calculated.py",
"hash": "d0b467dbb51ecc5ec2ca581e95b1935e"
"path": "utils/log.py",
"hash": "172d7d4d63c1b3136c5600055e666967"
},
{
"path": "utils/update_file.py",
"hash": "eb1ca189b78b35d1a2a09eeb1e39cfed"
"path": "utils/relic.py",
"hash": "abeeb6dc7a248ae1a290a43879409906"
},
{
"path": "utils/exceptions.py",
"hash": "6a0a601665ad74fc01010aaa1229e5c3"
"path": "utils/cv_tools.py",
"hash": "0d39d485230635d3c276bb3a992640f2"
},
{
"path": "utils/record_v7.2.py",
"hash": "03047d50df214d029132f5f9a7372aae"
},
{
"path": "utils/cv_tools.py",
"hash": "8cee1592daf7b4ff153b8ef9c97a39f8"
"path": "utils/adb.py",
"hash": "82993dbc84090d081cff62d95d2d5d7a"
},
{
"path": "utils/requests.py",
"hash": "f004e90febde2faeb7577e928df8380d"
},
{
"path": "utils/map.py",
"hash": "dfeba1fee224dbde5e266ddcdb5b144c"
"hash": "611944e964f7bd10bde59d5bad997aa6"
},
{
"path": "utils/old_cv_tools.py",
"hash": "d58c447d88f7924704ddbc593985bf0b"
"path": "utils/calculated.py",
"hash": "165798560ca78e99c9e6c6a25fef3eb2"
},
{
"path": "utils/adb.py",
"hash": "82993dbc84090d081cff62d95d2d5d7a"
"path": "utils/route_helper.py",
"hash": "cca50ef52d7075c186e12badeb0a35d0"
},
{
"path": "utils/log.py",
"hash": "172d7d4d63c1b3136c5600055e666967"
"path": "utils/relic_constants.py",
"hash": "b83b876b1d6d0d11351f96a638f69713"
},
{
"path": "utils/requests.py",
"hash": "f004e90febde2faeb7577e928df8380d"
"path": "utils/exceptions.py",
"hash": "6a0a601665ad74fc01010aaa1229e5c3"
},
{
"path": "utils/get_angle.py",
"hash": "1f56df0ccc972ab1955078fdc372870f"
},
{
"path": "utils/simulated_universe.py",
"hash": "a034ae2b2de94b16d3ac6ed1dfe3a807"
},
{
"path": "utils/update_file.py",
"hash": "eb1ca189b78b35d1a2a09eeb1e39cfed"
},
{
"path": "utils/config.py",
"hash": "43a1ba7172c4e434b7ea28b93ceca248"
"hash": "7b8f6be30b35eef047d782c014261f5f"
},
{
"path": "utils/get_angle.py",
"hash": "1f56df0ccc972ab1955078fdc372870f"
"path": "utils/old_cv_tools.py",
"hash": "d58c447d88f7924704ddbc593985bf0b"
},
{
"path": "utils/commission.py",
"hash": "173d380cdc984361308350517864d38f"
},
{
"path": "utils/relic.py",
"hash": "4603ab2600b091f963425d31b435280b"
"path": "utils/questionary/README.md",
"hash": "eeeb57320b4f37bf7872e664155ff7af"
},
{
"path": "utils/route_helper.py",
"hash": "cca50ef52d7075c186e12badeb0a35d0"
"path": "utils/questionary/NOTICE",
"hash": "9141c677ada3006a91876bb33b3ebd5a"
},
{
"path": "locale/zh_CN/LC_MESSAGES/sra.mo",
"hash": "0a0ccfe2f4f2da8626fda930bd84ef9c"
"path": "utils/questionary/questionary/version.py",
"hash": "96dcecb8bd4541554d1be2c1eaec4454"
},
{
"path": "locale/zh_TC/LC_MESSAGES/sra.mo",
"hash": "ef66f8b317d24e3eb326e739cb9b00ee"
"path": "utils/questionary/questionary/utils.py",
"hash": "1f6a636d1b97b4fcbb45928e8af71d5a"
},
{
"path": "locale/EN/LC_MESSAGES/sra.mo",
"hash": "110d45fcca6c7b86a9770cf3e3009026"
"path": "utils/questionary/questionary/constants.py",
"hash": "abb63dccac936e5589d80b568f41dfda"
},
{
"path": "utils/questionary/questionary/styles.py",
"hash": "98b2e73ee7803ef0a4b256115f41b435"
},
{
"path": "utils/questionary/questionary/form.py",
"hash": "ed8238bd746cd076dfadafb5767bcfb4"
},
{
"path": "utils/questionary/questionary/py.typed",
"hash": "d41d8cd98f00b204e9800998ecf8427e"
},
{
"path": "utils/questionary/questionary/prompt.py",
"hash": "6ef4d8712a464dae3c6d55e518fdefd4"
},
{
"path": "utils/questionary/questionary/question.py",
"hash": "f09f3f1da53ec97c1a7f3c5053e6f81d"
},
{
"path": "utils/questionary/questionary/prompts/checkbox.py",
"hash": "3d13a70c6b2d47d59d0e465ba0b22c79"
},
{
"path": "utils/questionary/questionary/prompts/autocomplete.py",
"hash": "ef1a8f88b18eeaccdcacac1c5eba82ce"
},
{
"path": "utils/questionary/questionary/prompts/confirm.py",
"hash": "16e9093acd7b83640fd20d712c94e3f1"
},
{
"path": "utils/questionary/questionary/prompts/path.py",
"hash": "15f9c11b9657def75b470f2e6b25a0ca"
},
{
"path": "utils/questionary/questionary/prompts/rawselect.py",
"hash": "aed49c4b350ec45b5095791f37bf758a"
},
{
"path": "utils/questionary/questionary/prompts/common.py",
"hash": "8df03b31d4bf9e6eb8279e53234bc845"
},
{
"path": "utils/questionary/questionary/prompts/select.py",
"hash": "0c00084273d24253469a651532a2e803"
},
{
"path": "utils/questionary/questionary/prompts/press_any_key_to_continue.py",
"hash": "386ac31eca4c276f21fdbe6c329c3cdd"
},
{
"path": "utils/questionary/questionary/prompts/password.py",
"hash": "45cc7d27bb2ca7aa1f90fbe9652ec618"
},
{
"path": "utils/questionary/questionary/prompts/text.py",
"hash": "f3ae150c4b9472903fd0b47a24aec544"
},
{
"path": "whl/cnocr-2.2.2.3-py3-none-any.whl",
"hash": "fff249a0f8c75f5bc4f0f97c95880bd8"
},
{
"path": "whl/Polygon3-3.0.9-cp311-cp311-win_amd64.whl",
"hash": "43a2cab179598fdaaa21da76cdaaaafc"
},
{
"path": "whl/cnstd-1.2.2-py3-none-any.whl",
"hash": "2e700dd1d42f71c71b739bd6afa67a8a"
},
{
"path": "whl/httpx_socks-0.7.7-py3-none-any.whl",
"hash": "9c9fcdf730445180029471858d8e8c27"
},
{
"path": "whl/Polygon3-3.0.9.1-cp310-cp310-win_amd64.whl",
"hash": "0c19795eb68713cde783a434ea636ba9"
}
]
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
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "20231012175452"}
{"version": "20231103165357"}

0 comments on commit c95fa62

Please sign in to comment.