Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_inner_widget(self):
return urwid.Text(self.get_display_text())
def __init__(self, top="", middle="", bottom="", pitch=None, *args,
**kwargs):
self.pitch = pitch
self.pitch_str = str(pitch)
self.note_str = pitch.note
top = self.note_str
text = urwid.Text("{}\n{}\n{}".format(top, middle, bottom))
fill = urwid.Filler(text)
adapter = urwid.BoxAdapter(fill, height=3)
pad = urwid.Padding(adapter)
box = urwid.LineBox(pad)
attr = urwid.AttrMap(w=box, attr_map='default')
super(KeyboardButton, self).__init__(w=attr, *args, **kwargs)
def __init__(self, *args, **kwargs):
self.footer_left = urwid.Text('r - Repeat question; q - Quit')
self.footer_right = urwid.Text('--', align='right')
header = urwid.AttrMap(urwid.Padding(urwid.Text('birdears ─ Functional'
' Ear Training')),
'header')
footer = urwid.AttrMap(urwid.Padding(urwid.Columns(widget_list=[
self.footer_left, self.footer_right])), 'footer')
loading = urwid.Text('loading...')
adapter = urwid.Filler(loading)
super(TextUserInterfaceWidget, self).__init__(body=adapter,
header=header,
footer=footer)
# Melodic Dictation
# Key: C Major Descending scale
# Octaves: 2
# Chromatics: True
# Number of notes: 4
#
# C Chromatic Descending scale
# 1 octave
top_text = "Key: {tonic} {mode} {random}({n_octaves} {octaves_str})\n"\
"Descending: {descending}\n" \
"Chromatic: {chromatic}\n" \
"Intervals: {intervals}" \
.format(**top_variables)
top_widget = urwid.Text(top_text)
self.question_widget = QuestionWidget(top_widget=top_widget,
keyboard=self.keyboard,
display=self.question.display)
self.tui_widget.contents.update({'body': (self.question_widget, None)})
if self.question.n_input_notes > 0:
answers_text = "Answers: +{correct} / -{incorrect} ".\
format(correct=self.correct, incorrect=self.wrong)
else:
answers_text = "(Question type doesn't takes answer)"
self.tui_widget.footer_right.set_text(answers_text)
with LOCK:
self.loop.draw_screen()
def draw_display(self, question_display):
self.display = dict()
display_wids = list()
for key, value in question_display.items():
self.display[key] = urwid.Text(value)
display_wids.append(urwid.LineBox(self.display[key]))
display_widget = urwid.Filler(urwid.Pile(widget_list=display_wids))
return display_widget
def __init__(self, *args, **kwargs):
self.footer_left = urwid.Text('r - Repeat question; q - Quit')
self.footer_right = urwid.Text('--', align='right')
header = urwid.AttrMap(urwid.Padding(urwid.Text('birdears ─ Functional'
' Ear Training')),
'header')
footer = urwid.AttrMap(urwid.Padding(urwid.Columns(widget_list=[
self.footer_left, self.footer_right])), 'footer')
loading = urwid.Text('loading...')
adapter = urwid.Filler(loading)
super(TextUserInterfaceWidget, self).__init__(body=adapter,
header=header,
footer=footer)