Skip to content

Commit

Permalink
chore: 改用本地的questionary模块,使之具备show_description功能
Browse files Browse the repository at this point in the history
  • Loading branch information
weiduhuo committed Oct 29, 2023
1 parent f0e224a commit d077bdd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions utils/relic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import time
import math
import pprint
import questionary
import numpy as np
from collections import Counter
from typing import Any, Dict, List, Literal, Optional, Tuple, Union

from .questionary.questionary import select
# 改用本地的questionary模块,使之具备show_description功能,基于'tmbo/questionary/pull/330'
# from questionary import select # questionary原项目更新并具备当前功能后,可进行替换
from .relic_constants import *
from .calculated import calculated, Array2dict, get_data_hash, str_just
from .config import (read_json_file, modify_json_file, rewrite_json_file,
Expand Down Expand Up @@ -72,7 +74,7 @@ def __init__(self, title=_("崩坏:星穹铁道")):

# 校验遗器哈希值
if not self.check_relic_data_hash():
option = questionary.select(_("是否依据当前遗器数据更新哈希值:"), [_("是"), _("否")]).ask()
option = select(_("是否依据当前遗器数据更新哈希值:"), [_("是"), _("否")]).ask()
if option == _("是"):
self.check_relic_data_hash(updata=True)

Expand All @@ -86,7 +88,7 @@ def relic_entrance(self):
option = None # 保存上一次的选择
while True:
self.calculated.switch_cmd()
option = questionary.select(title, options, default=option).ask()
option = select(title, options, default=option).ask()
if option == _("保存当前人物的配装"):
self.calculated.switch_window()
self.save_loadout_for_char()
Expand Down Expand Up @@ -122,7 +124,7 @@ def equip_loadout_for_char(self):
options_map = {str_just(loadout_name, 12) + self.get_loadout_brief(hash_list): hash_list for loadout_name, hash_list in character_data.items()}
options = list(options_map.keys())
options.append(_("返回上一级"))
option = questionary.select(title, options).ask()
option = select(title, options).ask()
if option == _("返回上一级"):
return
relic_hash = options_map[option]
Expand Down

0 comments on commit d077bdd

Please sign in to comment.