def add_select_elements_gui(self): self.g_element_frame = frame = Gtk.Frame( label=_("Rhythms to use in question")) self.config_box.pack_start(frame, False, False, 0) self.g_select_rhythms_box = gu.NewLineBox() self.g_select_rhythms_box.set_border_width(gu.PAD_SMALL) frame.add(self.g_select_rhythms_box)
def __init__(self, teacher): abstract.LessonbasedGui.__init__(self, teacher) self.m_key_bindings = {'backspace_ak': self.on_backspace} self.g_music_displayer = mpd.MusicDisplayer() self.practise_box.pack_start(self.g_music_displayer, False, False, 0) self.g_answer_button_box = gu.NewLineBox() self.practise_box.pack_start(self.g_answer_button_box, False, False, 0) # The user fill the answer in this box self.g_answer_frame = Gtk.Frame() self.g_answer_frame.set_shadow_type(Gtk.ShadowType.IN) self.practise_box.pack_start(self.g_answer_frame, False, False, 0) self.g_answer = Gtk.HBox() self.g_answer_frame.add(self.g_answer) self.g_answer_frame.show_all() # Flashbar self.g_flashbar = gu.FlashBar() self.g_flashbar.show() self.practise_box.pack_start(self.g_flashbar, False, False, 0) # action area self.std_buttons_add( ('new', self.new_question), ('play_music', lambda w: self.run_exception_handled(self.m_t.m_P.play_question)), ('display_music', self.show_answer), ('repeat', self.repeat_question), ('guess_answer', self.guess_answer), ('play_tonic', lambda w: self.run_exception_handled(self.m_t.play_tonic)), ('give_up', self.give_up), ('backspace', self.on_backspace), ) ############## # statistics # ############## self.setup_statisticsviewer(statisticsviewer.StatisticsViewer, "")
def __init__(self, teacher): abstract.Gui.__init__(self, teacher) self.m_key_bindings = {'backspace_ak': self.on_backspace} self.g_answer_box = gu.NewLineBox() self.practise_box.pack_start(self.g_answer_box, False, False, 0) #------- hbox = gu.bHBox(self.practise_box) b = Gtk.Button(_("Play")) b.show() b.connect('clicked', self.play_users_answer) hbox.pack_start(b, False, True, 0) self.practise_box.pack_start(Gtk.HBox(False, 0), False, False, padding=gu.PAD_SMALL) self.g_rhythm_viewer = RhythmViewer(self) #FIXME the value 52 is dependant on the theme used self.g_rhythm_viewer.set_size_request(-1, 52) self.g_rhythm_viewer.create_holders() hbox.pack_start(self.g_rhythm_viewer, True, True, 0) # action area self.std_buttons_add( ('new', self.new_question), ('repeat', self.repeat_question), ('give_up', self.give_up), ('backspace', self.on_backspace)) self.practise_box.show_all() ############## # config_box # ############## self.add_select_elements_gui() #-------- self.config_box.pack_start(Gtk.HBox(False, 0), False, False, padding=gu.PAD_SMALL) self.add_select_num_beats_gui() #----- self.config_box.pack_start(Gtk.HBox(False, 0), False, False, padding=gu.PAD_SMALL) #------ hbox = gu.bHBox(self.config_box, False) hbox.set_spacing(gu.PAD_SMALL) hbox.pack_start( gu.nCheckButton(self.m_exname, "not_start_with_rest", _("Don't start the question with a rest")), False, False, 0) sep = Gtk.VSeparator() hbox.pack_start(sep, False, False, 0) hbox.pack_start(Gtk.Label(_("Beats per minute:")), False, False, 0) spin = gu.nSpinButton(self.m_exname, 'bpm', Gtk.Adjustment(60, 20, 240, 1, 10)) hbox.pack_start(spin, False, False, 0) self._add_auto_new_question_gui(self.config_box) self.config_box.show_all()
def add_select_elements_gui(self, grid, row): self.g_element_frame = frame = Gtk.Frame(label=_("Rhythms to use in question")) grid.attach(frame, 0, row, 3, 1) self.g_select_rhythms_box = gu.NewLineBox() self.g_select_rhythms_box.set_border_width(gu.PAD_SMALL) frame.add(self.g_select_rhythms_box)