Files
ss-tools/whiptailtest.py
Volobuev Andrey 8f6b44c679 backup worked
2025-10-06 13:59:30 +03:00

29 lines
939 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# test_whiptail.py
from superset_tool.utils.whiptail_fallback import (
menu, checklist, yesno, msgbox, inputbox, gauge,
)
rc, env = menu('Тестовое меню', 'Выберите среду:', ['dev', 'prod'])
print('menu →', rc, env)
rc, ids = checklist(
'Тестовый чек‑лист',
'Выберите пункты:',
[('1', 'Первый'), ('2', 'Второй'), ('3', 'Третий')],
)
print('checklist →', rc, ids)
if yesno('Вопрос', 'Продолжить?'):
print('Ответ ДА')
else:
print('Ответ НЕТ')
rc, txt = inputbox('Ввод', 'Введите произвольный текст:')
print('inputbox →', rc, txt)
msgbox('Сообщение', 'Это просто тестовое сообщение.')
with gauge('Прогресс‑бар') as g:
for i in range(0, 101, 20):
g.set_text(f'Шаг {i // 20 + 1}')
g.set_percent(i)