-
Notifications
You must be signed in to change notification settings - Fork 0
/
jeopardy.py
49 lines (40 loc) · 1.3 KB
/
jeopardy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from ui import *
class Jeopardy:
def __init__(self):
self.desc = None
self.fact = None
self.details = None
def input(self):
self.desc = uinput(text='Description:', required=True, example="Tolstoy's year of birth")
self.fact = uinput(text='Fact:', required=True, example='1828')
self.details = uinput(text='Pronunciation/mnemonics?', example='tall-stoi',
allow_images=True)
def output(self):
print_accent('\n*** Card ***')
print(self.desc)
print_hr()
print(self.fact)
if self.details:
print_hr()
print(self.details)
summarize_images()
print()
def save(self, x):
m = x.models.byName('Basic+details')
x.decks.current()['mid'] = m['id']
n = x.newNote()
n['Front'] = self.desc
n['Back'] = self.fact
combined_details = ''
html = images_save_htmlify(x)
if html:
combined_details += html
if self.details:
combined_details += self.details
if combined_details != '':
n['Details'] = combined_details
x.addNote(n)
x.save()
print_loud('Card saved!', nl=2)
def name(self):
return '->'