feat: reworked the genre select
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -27,17 +27,28 @@ PAGE_NAME_FILL = "-"
|
||||
MAX_PAGE_LEN = 21
|
||||
|
||||
|
||||
class GenreIO(components.HumanIO):
|
||||
@staticmethod
|
||||
def ask_to_create(option: components.Option) -> bool:
|
||||
output()
|
||||
return ask_for_bool(f"create the genre {BColors.OKBLUE.value}{option.value}{BColors.ENDC.value}")
|
||||
|
||||
@staticmethod
|
||||
def not_found(key: str) -> None:
|
||||
output(f"\ngenre {BColors.BOLD.value}{key}{BColors.ENDC.value} not found\n", color=BColors.FAIL)
|
||||
|
||||
|
||||
def get_genre():
|
||||
select_genre = components.GenreSelect()
|
||||
select_genre._ask_for_creating_option = lambda key: ask_for_bool(f"Create the genre \"{key}\"")
|
||||
select_genre.human_io = GenreIO
|
||||
|
||||
genre: Optional[components.Option] = None
|
||||
|
||||
while genre is None:
|
||||
for genre in select_genre:
|
||||
print(genre)
|
||||
print(select_genre.pprint())
|
||||
print()
|
||||
|
||||
genre = select_genre.choose(input("Id or new genre: "))
|
||||
genre = select_genre.choose(input("> "))
|
||||
|
||||
return genre.value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user