1234567891011121314151617181920212223242526272829303132 |
- import os
- from easygui import enterbox
- import sys
- from easygui.boxes.derived_boxes import msgbox
- from images import get_verse_image
- from parser import get_full_verse
- msg ="Введите номер стиха. Например sb 1.1.1 или bg 1.1"
- title = "Ввод стиха"
- while True:
- try: # читаем последний веденный стих
- with open("lastverse", "r") as f:
- last_verse = f.read()
- except Exception:
- last_verse = "bg 4.34"
- verse = enterbox(msg, title, last_verse)
- if verse is None:
- sys.exit(0)
- verses_data = get_full_verse(verse)
- if 'error' not in verses_data:
- f_img = ''
- for i, v in enumerate(verses_data['verses']):
- image = get_verse_image(v)
- if i == 0:
- f_img = image
- os.system(f"eom {f_img}") # для открытия картинки используем програму eom (eye of mate).
- else:
- msgbox(title="Ошибка", msg=verses_data['error'])
|