예제 #1
0
    def __init__(self, teacher):
        abstract.LessonbasedGui.__init__(self, teacher, no_notebook=False)
        ################
        # practise_box #
        ################
        self.g_question_title = gu.bLabel(self.practise_box, "", False, False)

        self.g_music_displayer = mpd.MusicDisplayer()
        self.set_size_request(500, -1)
        self.g_music_displayer.show()
        self.practise_box.pack_start(self.g_music_displayer, True, True, 0)
        ###############
        # action_area #
        ###############
        self.g_partbox = gu.bHBox(self.practise_box, False)
        self.g_go_back = Gtk.Button(stock='gtk-go-back')
        self.g_go_back.connect('clicked', self.select_previous)
        self.g_go_back.show()
        self.action_area.pack_start(self.g_go_back, False, False, 0)
        self.g_go_forward = Gtk.Button(stock='gtk-go-forward')
        self.g_go_forward.show()
        self.g_go_forward.connect('clicked', self.select_next)
        self.action_area.pack_start(self.g_go_forward, False, False, 0)
        self.g_play = gu.bButton(self.action_area, _("_Play the whole music"),
                                 self.play)
        self.g_show = gu.bButton(self.action_area, _("_Show"), self.show_answer)
예제 #2
0
    def __init__(self, teacher):
        abstract.LessonbasedGui.__init__(self, teacher, no_notebook=False)
        ################
        # practise_box #
        ################
        self.g_question_title = gu.bLabel(self.practise_box, "", False, False)

        self.g_music_displayer = mpd.MusicDisplayer()
        self.set_size_request(500, -1)
        self.g_music_displayer.show()
        self.practise_box.pack_start(self.g_music_displayer, True, True, 0)
        ###############
        # action_area #
        ###############
        self.g_partbox = gu.bHBox(self.practise_box, False)
        self.g_go_back = Gtk.Button(stock='gtk-go-back')
        self.g_go_back.connect('clicked', self.select_previous)
        self.g_go_back.show()
        self.action_area.pack_start(self.g_go_back, False, False, 0)
        self.g_go_forward = Gtk.Button(stock='gtk-go-forward')
        self.g_go_forward.show()
        self.g_go_forward.connect('clicked', self.select_next)
        self.action_area.pack_start(self.g_go_forward, False, False, 0)
        self.g_play = gu.bButton(self.action_area, _("_Play the whole music"),
                                 self.play)
        self.g_show = gu.bButton(self.action_area, _("_Show"),
                                 self.show_answer)
예제 #3
0
    def _create_select_inputwidget_gui(self):
        """
        This will be called by HarmonicInterval and MelodicInterval
        constructor
        """
        hbox = gu.bHBox(self.config_box, False)
        hbox.set_spacing(gu.PAD_SMALL)
        gu.bLabel(hbox, _("Input interface:"), False)

        combo = Gtk.ComboBoxText()
        for i in range(len(inputwidgets.inputwidget_names)):
            combo.append_text(inputwidgets.inputwidget_names[i])
        if self.get_int('inputwidget') < len(inputwidgets.inputwidget_names):
            combo.set_active(self.get_int('inputwidget'))
        else:
            combo.set_active(0)
        combo.connect('changed', lambda w: self.use_inputwidget(w.get_active()))
        hbox.pack_start(combo, False, False, 0)

        self.g_disable_unused_buttons = gu.nCheckButton(self.m_exname,
                    'disable_unused_intervals', _("_Disable unused buttons"))
        hbox.pack_start(self.g_disable_unused_buttons, True, True, 0)
예제 #4
0
    def _create_select_inputwidget_gui(self):
        """
        This will be called by HarmonicInterval and MelodicInterval
        constructor
        """
        hbox = gu.bHBox(self.config_box, False)
        hbox.set_spacing(gu.PAD_SMALL)
        gu.bLabel(hbox, _("Input interface:"), False)

        combo = gtk.combo_box_new_text()
        for i in range(len(inputwidgets.inputwidget_names)):
            combo.append_text(inputwidgets.inputwidget_names[i])
        if self.get_int('inputwidget') < len(inputwidgets.inputwidget_names):
            combo.set_active(self.get_int('inputwidget'))
        else:
            combo.set_active(0)
        combo.connect('changed', lambda w: self.use_inputwidget(w.get_active()))
        hbox.pack_start(combo, False)

        self.g_disable_unused_buttons = gu.nCheckButton(self.m_exname,
                    'disable_unused_intervals', _("_Disable unused buttons"))
        hbox.pack_start(self.g_disable_unused_buttons)
예제 #5
0
    def create_mainwin_ui(self):
        qbox = gu.hig_dlg_vbox()
        self.g_notebook.append_page(qbox, Gtk.Label(label=_("Questions")))
        gu.bLabel(qbox, _("Enter new chords using the mouse"), False, False)
        hbox = gu.bHBox(qbox, False, False)
        self.g_displayer = mpd.musicdisplayer.ChordEditor()
        self.g_displayer.connect('clicked', self.on_displayer_clicked)
        self.g_displayer.clear(2)
        gu.bLabel(hbox, "")
        hbox.pack_start(self.g_displayer, False)
        gu.bLabel(hbox, "")
        ##
        self.g_question_name = Gtk.Entry()
        qbox.pack_start(gu.hig_label_widget(_("Question title:", True, True, 0), self.g_question_name, None), False)
        self.g_navinfo = Gtk.Label(label="")
        qbox.pack_start(self.g_navinfo, False)

        ##
        self.m_P = EditorLessonfile()
        cvbox = Gtk.VBox()
        self.g_notebook.append_page(cvbox, Gtk.Label(label=_("Lessonfile header")))
        # Header section
        sizegroup = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
        self.g_title = Gtk.Entry()
        cvbox.pack_start(gu.hig_label_widget(_("File title:", True, True, 0), self.g_title,
                        sizegroup))
        self.g_content_chord = Gtk.RadioButton(None, "chord")
        self.g_content_chord_voicing = Gtk.RadioButton(self.g_content_chord, "chord-voicing")
        self.g_content_idbyname = Gtk.RadioButton(self.g_content_chord, "id-by-name")
        box = Gtk.HBox()
        box.pack_start(self.g_content_chord, True, True, 0)
        box.pack_start(self.g_content_chord_voicing, True, True, 0)
        box.pack_start(self.g_content_idbyname, True, True, 0)
        cvbox.pack_start(gu.hig_label_widget(_("Content:", True, True, 0), box, sizegroup))
        self.g_random_transpose = Gtk.Entry()
        cvbox.pack_start(gu.hig_label_widget(_("Random transpose:", True, True, 0),
            self.g_random_transpose, sizegroup))
        #
        #self.g_statusbar = Gtk.Statusbar()
        #self.toplevel_vbox.pack_start(self.g_statusbar, False)
        self.update_appwin()
예제 #6
0
    def __init__(self, teacher):
        abstract.Gui.__init__(self, teacher)

        self.g_percentage = gu.bLabel(self.practise_box, "")
        self.g_percentage.set_name("Heading1")
        self.g_piano = inputwidgets.PianoOctaveWithAccelName(
            self.on_answer_from_user, self.get_accel_key_list())
        self.g_piano.m_visible_accels = not self.get_bool('hide_piano_accels')

        def update_accels(*ignore):
            self.g_piano.m_keys = self.get_accel_key_list()
            self.g_piano.queue_draw()

        for notename in mpd.MusicalPitch.notenames:
            self.add_watch('tone_%s_ak' % notename, update_accels)
        self.practise_box.pack_start(self.g_piano, True, True, 0)

        self.g_flashbar = gu.FlashBar()
        self.g_flashbar.show()
        self.practise_box.pack_start(self.g_flashbar, False, False, 0)
        self.practise_box.set_spacing(gu.PAD)

        self.std_buttons_add(
            ('new-tone', self.new_question),
            ('repeat', lambda _o, self=self: self.m_t.play_question()),
            ('give_up', self.give_up))
        self.practise_box.show_all()
        ##############
        # config_box #
        ##############
        self.config_box.set_spacing(gu.PAD_SMALL)
        self.g_config_elems = gu.bVBox(self.config_box, False)
        table = Gtk.Table()
        table.set_border_width(gu.PAD_SMALL)
        frame = Gtk.Frame(label=_("Weight"))
        self.g_config_elems.pack_start(frame, False, False, 0)
        frame.add(table)
        for x, n in [(1, 'cis'), (3, 'dis'), (7, 'fis'), (9, 'gis'),
                     (11, 'ais')]:
            label = Gtk.Label(label=mpd.MusicalPitch.new_from_notename(
                n).get_user_notename())
            label.set_name("Heading2")
            label.set_alignment(0.2, 1.0)
            table.attach(label,
                         x,
                         x + 2,
                         0,
                         1,
                         xoptions=Gtk.AttachOptions.FILL)
            b = gu.nSpinButton(self.m_exname,
                               n + "_weight",
                               Gtk.Adjustment(1, 0, 1000, 1, 10),
                               digits=0)
            table.attach(b, x, x + 2, 1, 2, xoptions=Gtk.AttachOptions.FILL)
        for x, n in [(0, 'c'), (2, 'd'), (4, 'e'), (6, 'f'), (8, 'g'),
                     (10, 'a'), (12, 'b')]:
            label = Gtk.Label(label=mpd.MusicalPitch.new_from_notename(
                n).get_user_notename())
            label.set_name("Heading2")
            label.set_alignment(0.35, 1.0)
            table.attach(label,
                         x,
                         x + 2,
                         2,
                         3,
                         xoptions=Gtk.AttachOptions.FILL)
            b = gu.nSpinButton(self.m_exname,
                               n + "_weight",
                               Gtk.Adjustment(1, 0, 1000, 1, 10),
                               digits=0)
            table.attach(b, x, x + 2, 3, 4, xoptions=Gtk.AttachOptions.FILL)

        hbox = gu.bHBox(self.g_config_elems, False)
        hbox.pack_start(Gtk.Label(_("Octave:")), False, False, padding=4)
        for oct in self.m_t.OCTAVES:
            b = gu.nCheckButton(self.m_exname,
                                "octave" + str(oct),
                                str(oct),
                                default_value=1)
            hbox.pack_start(b, False, False, 0)
        #############
        self._add_auto_new_question_gui(self.config_box)
        #############
        b = gu.nCheckButton('idtone', 'hide_piano_accels',
                            _("Hide _piano keyboard shortcuts"), False)

        def show_hide_accels(checkbutton):
            self.g_piano.m_visible_accels = not b.get_active()

        b.connect('clicked', show_hide_accels)
        self.config_box.pack_start(b, False, False, 0)
        #
        frame = Gtk.Frame(label=_("When you guess wrong"))
        vbox = Gtk.VBox()
        vbox.set_border_width(gu.PAD_SMALL)
        frame.add(vbox)
        vbox.pack_start(
            gu.nCheckButton(self.m_exname, "warning_sound",
                            _("Play warning sound")), False, False, 0)
        self.config_box.pack_start(frame, False, False, 0)
        self.config_box.show_all()
        ##############
        # statistics #
        ##############
        self.setup_statisticsviewer(statisticsviewer.StatisticsViewer,
                                    _("Identify tone"))
예제 #7
0
파일: tuner.py 프로젝트: gitGNU/gnu_solfege
 def __init__(self, teacher):
     abstract.Gui.__init__(self, teacher)
     self.g_hz = gu.bLabel(self.practise_box, "")
     self.g_notename = gu.bLabel(self.practise_box, "")
     self.g_cent = gu.bLabel(self.practise_box, "")
예제 #8
0
    def __init__(self, teacher):
        abstract.Gui.__init__(self, teacher)

        self.g_percentage = gu.bLabel(self.practise_box, "")
        self.g_percentage.set_name("Heading1")
        self.g_piano = inputwidgets.PianoOctaveWithAccelName(
                       self.on_answer_from_user, self.get_accel_key_list())
        self.g_piano.m_visible_accels = not self.get_bool('hide_piano_accels')

        def update_accels(*ignore):
            self.g_piano.m_keys = self.get_accel_key_list()
            self.g_piano.queue_draw()
        for notename in mpd.MusicalPitch.notenames:
            self.add_watch('tone_%s_ak' % notename, update_accels)
        self.practise_box.pack_start(self.g_piano, True, True, 0)

        self.g_flashbar = gu.FlashBar()
        self.g_flashbar.show()
        self.practise_box.pack_start(self.g_flashbar, False, False, 0)
        self.practise_box.set_spacing(gu.PAD)

        self.std_buttons_add(
            ('new-tone', self.new_question),
            ('repeat', lambda _o, self=self: self.m_t.play_question()),
            ('give_up', self.give_up))
        self.practise_box.show_all()
        ###############
        # config_grid #
        ###############
        table = Gtk.Table()
        table.set_border_width(gu.PAD_SMALL)
        self.g_tones_frame = frame = Gtk.Frame(label=_("Weight"))
        self.g_config_grid.attach(frame, 0, 0, 3, 1)
        frame.add(table)
        for x, n in [(1, 'cis'), (3, 'dis'), (7, 'fis'),
                     (9, 'gis'), (11, 'ais')]:
            label = Gtk.Label(label=mpd.MusicalPitch.new_from_notename(n).get_user_notename())
            label.set_name("Heading2")
            label.set_alignment(0.2, 1.0)
            table.attach(label, x, x + 2, 0, 1, xoptions=Gtk.AttachOptions.FILL)
            b = gu.nSpinButton(self.m_exname, n + "_weight",
                      Gtk.Adjustment(1, 0, 1000, 1, 10), digits=0)
            table.attach(b, x, x + 2, 1, 2, xoptions=Gtk.AttachOptions.FILL)
        for x, n in [(0, 'c'), (2, 'd'), (4, 'e'), (6, 'f'),
                      (8, 'g'), (10, 'a'), (12, 'b')]:
            label = Gtk.Label(label=mpd.MusicalPitch.new_from_notename(n).get_user_notename())
            label.set_name("Heading2")
            label.set_alignment(0.35, 1.0)
            table.attach(label, x, x + 2, 2, 3, xoptions=Gtk.AttachOptions.FILL)
            b = gu.nSpinButton(self.m_exname, n + "_weight",
                   Gtk.Adjustment(1, 0, 1000, 1, 10), digits=0)
            table.attach(b, x, x + 2, 3, 4, xoptions=Gtk.AttachOptions.FILL)

        self.g_octaves_select = hbox = Gtk.HBox()
        self.g_config_grid.attach(hbox, 0, 1, 3, 1)
        hbox.pack_start(Gtk.Label(_("Octave:")), False, False, padding=4)
        for oct in self.m_t.OCTAVES:
            b = gu.nCheckButton(self.m_exname, "octave" + str(oct), str(oct),
                                default_value=1)
            hbox.pack_start(b, False, False, 0)
        #############
        self._add_auto_new_question_gui(row=4)
        #############
        b = gu.nCheckButton('idtone', 'hide_piano_accels', _("Hide _piano keyboard shortcuts"), False)

        def show_hide_accels(checkbutton):
            self.g_piano.m_visible_accels = not b.get_active()
        b.connect('clicked', show_hide_accels)
        self.g_config_grid.attach(b, 0, 2, 1, 1)
        #
        self.g_config_grid.attach(gu.nCheckButton(self.m_exname,
                    "warning_sound",
                    _("Play warning sound when you guess wrong")),
                0, 3, 1, 1)
        self.g_config_grid.show_all()
        ##############
        # statistics #
        ##############
        self.setup_statisticsviewer(statisticsviewer.StatisticsViewer,
                                   _("Identify tone"))
예제 #9
0
 def __init__(self, teacher):
     abstract.Gui.__init__(self, teacher)
     self.g_hz = gu.bLabel(self.practise_box, "")
     self.g_notename = gu.bLabel(self.practise_box, "")
     self.g_cent = gu.bLabel(self.practise_box, "")