Example #1
0
 def on_rename_profile(self, w):
     if self.m_default_profile == self.get_profile():
         rename_default = True
     else:
         rename_default = False
     dlg = RenameProfileDialog(self.get_profile())
     dlg.show_all()
     ret = dlg.run()
     if ret == Gtk.ResponseType.ACCEPT:
         path, column = self.g_tw.get_cursor()
         it = self.g_liststore.get_iter(path)
         try:
             os.rename(
                 os.path.join(filesystem.app_data(), u"profiles",
                              self.get_profile()),
                 os.path.join(filesystem.app_data(), u"profiles",
                              dlg.g_entry.get_text().decode("utf-8")))
             if rename_default:
                 self.m_default_profile = dlg.g_entry.get_text().decode(
                     "utf-8")
         except OSError, e:
             gu.display_exception_message(e)
             dlg.destroy()
             return
         path, column = self.g_tw.get_cursor()
         self.g_liststore.set(self.g_liststore.get_iter(path), 0,
                              dlg.g_entry.get_text().decode("utf-8"))
Example #2
0
    def on_rename_profile(self, w):
        if self.m_default_profile == self.get_profile():
            rename_default = True

        else:
            rename_default = False
        dlg = RenameProfileDialog(self.get_profile())
        dlg.show_all()
        ret = dlg.run()

        if ret == Gtk.ResponseType.ACCEPT:
            path, column = self.g_tw.get_cursor()
            it = self.g_liststore.get_iter(path)
            try:
                os.rename(os.path.join(
                    filesystem.app_data(), u"profiles", self.get_profile()),
                    os.path.join(filesystem.app_data(),
                        u"profiles", dlg.g_entry.get_text().decode("utf-8")))

                if rename_default:
                    self.m_default_profile = dlg.g_entry.get_text().decode("utf-8")
            except OSError, e:
                gu.display_exception_message(e)
                dlg.destroy()
                return
            path, column = self.g_tw.get_cursor()
            self.g_liststore.set(self.g_liststore.get_iter(path),
                0, dlg.g_entry.get_text().decode("utf-8"))
Example #3
0
 def practise_lessonfile(self, filename):
     def cleanup():
         module = lessonfile.infocache.get(filename, 'module')
         if module in self.m_teachers:
             self.m_teachers[module].m_P = None
         if module in solfege.win.box_dict:
             solfege.win.box_dict[module].practise_box.set_sensitive(False)
             solfege.win.box_dict[module].g_config_grid.set_sensitive(False)
             solfege.win.box_dict[module].action_area.set_sensitive(False)
             solfege.win.box_dict[module].std_buttons_end_practise()
     try:
         module = self._practise_lessonfile(filename)
     except (lessonfile.LessonfileParseException,
             dataparser.DataparserException,
             parsetree.ParseTreeException,
             IOError) as e:
         cleanup()
         gu.display_exception_message(e, lessonfile=filename)
         return
     except abstract.ExerciseModuleImportError as e:
         solfege.win.display_error_message2(
             _("Exercise module not found"), str(e))
         return
     if 'm_discards' in dir(self.m_teachers[module].m_P):
         for msg in self.m_teachers[module].m_P.m_discards:
             print(msg, file=sys.stderr)
     solfege.win.box_dict[module].practise_box.set_sensitive(True)
     solfege.win.box_dict[module].g_config_grid.set_sensitive(True)
     solfege.win.box_dict[module].action_area.set_sensitive(True)
     solfege.win.box_dict[module].on_start_practise()
     w = solfege.win.g_ui_manager.get_widget("/Menubar/HelpMenu/PerExerciseHelp/HelpTheory")
     if w:
         w.set_sensitive(bool(self.m_teachers[module].m_P.header.theory))
     return module
Example #4
0
    def practise_lessonfile(self, filename):
        def cleanup():
            module = lessonfile.infocache.get(filename, 'module')
            if module in self.m_teachers:
                self.m_teachers[module].m_P = None
            if module in solfege.win.box_dict:
                solfege.win.box_dict[module].practise_box.set_sensitive(False)
                solfege.win.box_dict[module].g_config_grid.set_sensitive(False)
                solfege.win.box_dict[module].action_area.set_sensitive(False)
                solfege.win.box_dict[module].std_buttons_end_practise()

        try:
            module = self._practise_lessonfile(filename)
        except (lessonfile.LessonfileParseException,
                dataparser.DataparserException, parsetree.ParseTreeException,
                IOError) as e:
            cleanup()
            gu.display_exception_message(e, lessonfile=filename)
            return
        except abstract.ExerciseModuleImportError as e:
            solfege.win.display_error_message2(_("Exercise module not found"),
                                               str(e))
            return
        if 'm_discards' in dir(self.m_teachers[module].m_P):
            for msg in self.m_teachers[module].m_P.m_discards:
                print(msg, file=sys.stderr)
        solfege.win.box_dict[module].practise_box.set_sensitive(True)
        solfege.win.box_dict[module].g_config_grid.set_sensitive(True)
        solfege.win.box_dict[module].action_area.set_sensitive(True)
        solfege.win.box_dict[module].on_start_practise()
        w = solfege.win.g_ui_manager.get_widget(
            "/Menubar/HelpMenu/PerExerciseHelp/HelpTheory")
        if w:
            w.set_sensitive(bool(self.m_teachers[module].m_P.header.theory))
        return module
Example #5
0
 def delete_obsolete_statistics(self, *w):
     if gu.dialog_delete(_("Delete obsolete statistics?"), self,
             _(u"This will delete the directory «%s».") % os.path.join(filesystem.app_data(), u"statistics")):
         try:
             shutil.rmtree(os.path.join(filesystem.app_data(), u"statistics"))
         except OSError, e:
             gu.display_exception_message(e)
         self.update_old_statistics_info()
Example #6
0
 def delete_obsolete_statistics(self, *w):
     if gu.dialog_delete(
             _("Delete obsolete statistics?"), self,
             _(u"This will delete the directory «%s».") %
             os.path.join(filesystem.app_data(), u"statistics")):
         try:
             shutil.rmtree(
                 os.path.join(filesystem.app_data(), u"statistics"))
         except OSError, e:
             gu.display_exception_message(e)
         self.update_old_statistics_info()
Example #7
0
 def on_delete_profile(self, w):
     if gu.dialog_yesno(_(u"Permanently delete the user profile «%s»?") % self.get_profile(), self):
         path, column = self.g_tw.get_cursor()
         it = self.g_liststore.get_iter(path)
         try:
             shutil.rmtree(os.path.join(filesystem.app_data(), u"profiles", self.get_profile()))
         except OSError, e:
             gu.display_exception_message(e)
             return
         self.g_liststore.remove(it)
         if not self.g_liststore.iter_is_valid(it):
             it = self.g_liststore[-1].iter
         self.g_tw.set_cursor(self.g_liststore.get_path(it))
Example #8
0
 def quit_program(self):
     if isinstance(solfege.win.get_view(), abstract.Gui):
         g = solfege.win.get_view()
         # Check that the lesson file has a header, because if the
         # user tries to quit the program after parsing a bad lesson
         # file, we cannot call end_practise() without risking more
         # exceptions.
         if g.m_t.m_P and hasattr(g.m_t.m_P, 'header'):
             g.on_end_practise()
     try:
         cfg.sync()
     except IOError, e:
         gu.display_exception_message(e)
Example #9
0
 def quit_program(self):
     if isinstance(solfege.win.get_view(), abstract.Gui):
         g = solfege.win.get_view()
         # Check that the lesson file has a header, because if the
         # user tries to quit the program after parsing a bad lesson
         # file, we cannot call end_practise() without risking more
         # exceptions.
         if g.m_t.m_P and hasattr(g.m_t.m_P, 'header'):
             g.on_end_practise()
     try:
         cfg.sync()
     except IOError, e:
         gu.display_exception_message(e)
Example #10
0
 def on_delete_profile(self, w):
     if gu.dialog_yesno(_("Permanently delete the user profile «%s»?") % self.get_profile(), self):
         path, column = self.g_tw.get_cursor()
         it = self.g_liststore.get_iter(path)
         try:
             shutil.rmtree(os.path.join(filesystem.app_data(), "profiles", self.get_profile()))
         except OSError as e:
             gu.display_exception_message(e)
             return
         self.g_liststore.remove(it)
         if not self.g_liststore.iter_is_valid(it):
             it = self.g_liststore[-1].iter
         self.g_tw.set_cursor(self.g_liststore.get_path(it))
Example #11
0
 def on_create_profile(self, w):
     dlg = NewProfileDialog()
     dlg.show_all()
     ret = dlg.run()
     if ret == gtk.RESPONSE_ACCEPT:
         pdir = os.path.join(filesystem.app_data(), u"profiles",
                             dlg.g_entry.get_text())
         if not os.path.exists(pdir):
             try:
                 os.makedirs(pdir)
                 self.g_liststore.append((dlg.g_entry.get_text(), ))
                 self.g_tw.set_cursor((len(self.g_liststore) - 1, ))
             except OSError, e:
                 gu.display_exception_message(e)
Example #12
0
 def on_create_profile(self, w):
     dlg = NewProfileDialog()
     dlg.show_all()
     ret = dlg.run()
     if ret == Gtk.ResponseType.ACCEPT:
         pdir = os.path.join(filesystem.app_data(),
                             u"profiles", dlg.g_entry.get_text().decode("utf-8"))
         if not os.path.exists(pdir):
             try:
                 os.makedirs(pdir)
                 self.g_liststore.append((dlg.g_entry.get_text().decode("utf-8"),))
                 self.g_tw.set_cursor((len(self.g_liststore)-1,))
             except OSError, e:
                 gu.display_exception_message(e)
Example #13
0
 def practise_lessonfile(self, filename):
     def cleanup():
         module = lessonfile.infocache.get(filename, 'module')
         self.m_teachers[module].m_P = None
         solfege.win.box_dict[module].practise_box.set_sensitive(False)
         solfege.win.box_dict[module].config_box.set_sensitive(False)
         solfege.win.box_dict[module].action_area.set_sensitive(False)
         solfege.win.box_dict[module].std_buttons_end_practise()
     try:
         module = self._practise_lessonfile(filename)
     except (lessonfile.LessonfileParseException,
             dataparser.DataparserException), e:
         cleanup()
         gu.display_exception_message(e, lessonfile=filename)
         return
Example #14
0
    def standard_exception_handler(self, e, cleanup_function=lambda: False):
        """
        Use this method to try to catch a few common solfege exceptions.
        It should only be used to catch exceptions after the file has
        successfully parsed by the lessonfile parser, and only used in
        exercises where the mpd code that might be wrong is comming from
        lesson files, not generated code.

        Usage:
        try:
            do something
        except Exception, e:
            if not self.standard_exception_handler(e):
                raise
        """
        sourcefile, lineno, func, code = traceback.extract_tb(sys.exc_info()[2])[0]
        # We can replace characters because we will only display the
        # file name, not open the file.
        sourcefile = sourcefile.decode(sys.getfilesystemencoding(), 'replace')
        if solfege.app.m_options.disable_exception_handler:
            return False
        
        elif isinstance(e, lessonfile.NoQuestionsConfiguredException):
            cleanup_function()
            solfege.win.display_error_message2(e.args[0], e.args[1])
            return True
        
        elif isinstance(e, lessonfile.LessonfileException):
            cleanup_function()
            self._lessonfile_exception(e, sourcefile, lineno)
            return True
        
        elif isinstance(e, mpd.MpdException):
            cleanup_function()
            self._mpd_exception(e, sourcefile, lineno)
            return True
        
        elif isinstance(e, osutils.BinaryBaseException):
            cleanup_function()
            solfege.win.display_error_message2(e.msg1, e.msg2)
            return True
        
        elif isinstance(e, osutils.OsUtilsException):
            cleanup_function()
            gu.display_exception_message(e)
            return True
        return False
Example #15
0
    def practise_lessonfile(self, filename):
        def cleanup():
            module = lessonfile.infocache.get(filename, 'module')
            self.m_teachers[module].m_P = None
            solfege.win.box_dict[module].practise_box.set_sensitive(False)
            solfege.win.box_dict[module].config_box.set_sensitive(False)
            solfege.win.box_dict[module].action_area.set_sensitive(False)
            solfege.win.box_dict[module].std_buttons_end_practise()

        try:
            module = self._practise_lessonfile(filename)
        except (lessonfile.LessonfileParseException,
                dataparser.DataparserException, parsetree.ParseTreeException,
                IOError), e:
            cleanup()
            gu.display_exception_message(e, lessonfile=filename)
            return
Example #16
0
    def standard_exception_handler(self, e, cleanup_function=lambda: False):
        """
        Use this method to try to catch a few common solfege exceptions.
        It should only be used to catch exceptions after the file has
        successfully parsed by the lessonfile parser, and only used in
        exercises where the mpd code that might be wrong is comming from
        lesson files, not generated code.

        Usage:
        try:
            do something
        except Exception, e:
            if not self.standard_exception_handler(e):
                raise
        """
        sourcefile, lineno, func, code = traceback.extract_tb(
            sys.exc_info()[2])[0]
        # We can replace characters because we will only display the
        # file name, not open the file.
        sourcefile = sourcefile.decode(sys.getfilesystemencoding(), 'replace')
        if solfege.app.m_options.disable_exception_handler:
            return False
        elif isinstance(e, lessonfile.NoQuestionsConfiguredException):
            cleanup_function()
            solfege.win.display_error_message2(e.args[0], e.args[1])
            return True
        elif isinstance(e, lessonfile.LessonfileException):
            cleanup_function()
            self._lessonfile_exception(e, sourcefile, lineno)
            return True
        elif isinstance(e, mpd.MpdException):
            cleanup_function()
            self._mpd_exception(e, sourcefile, lineno)
            return True
        elif isinstance(e, osutils.BinaryBaseException):
            cleanup_function()
            solfege.win.display_error_message2(e.msg1, e.msg2)
            return True
        elif isinstance(e, osutils.OsUtilsException):
            cleanup_function()
            gu.display_exception_message(e)
            return True
        return False
Example #17
0
 def quit_program(self):
     if isinstance(solfege.win.get_view(), abstract.Gui):
         g = solfege.win.get_view()
         # Check that the lesson file has a header, because if the
         # user tries to quit the program after parsing a bad lesson
         # file, we cannot call end_practise() without risking more
         # exceptions.
         if g.m_t.m_P and hasattr(g.m_t.m_P, 'header'):
             g.on_end_practise()
     try:
         cfg.sync()
     except IOError as e:
         gu.display_exception_message(e)
     try:
         if solfege.db:
             solfege.db.conn.commit()
             solfege.db.conn.close()
     except sqlite3.ProgrammingError as e:
         gu.display_exception_message(e)
     if soundcard.synth:
         soundcard.synth.close()
     shutil.rmtree(lessonfile.MusicBaseClass.temp_dir, True)
Example #18
0
 def quit_program(self):
     if isinstance(solfege.win.get_view(), abstract.Gui):
         g = solfege.win.get_view()
         # Check that the lesson file has a header, because if the
         # user tries to quit the program after parsing a bad lesson
         # file, we cannot call end_practise() without risking more
         # exceptions.
         if g.m_t.m_P and hasattr(g.m_t.m_P, 'header'):
             g.on_end_practise()
     try:
         cfg.sync()
     except IOError as e:
         gu.display_exception_message(e)
     try:
         if solfege.db:
             solfege.db.conn.commit()
             solfege.db.conn.close()
     except sqlite3.ProgrammingError as e:
         gu.display_exception_message(e)
     if soundcard.synth:
         soundcard.synth.close()
     shutil.rmtree(lessonfile.MusicBaseClass.temp_dir, True)
Example #19
0
 def setup_sound(self):
     if sys.platform == 'win32' and \
                 cfg.get_string("sound/type") == "sequencer-device":
         # just in case c:\home\.solfegerc is wrong
         cfg.set_string("sound/type", "winsynth")
     if self.m_options.no_sound \
        or cfg.get_string("sound/type") == "fake-synth":
         soundcard.initialise_using_fake_synth(
             self.m_options.verbose_sound_init)
     elif cfg.get_string("sound/type") == "alsa-sequencer":
         if alsaseq:
             try:
                 clientid, portid = self.get_list("sound/alsa-client-port")
             except ValueError:
                 clientid, portid = (None, None)
             try:
                 soundcard.initialise_alsa_sequencer(
                     (clientid, portid), self.m_options.verbose_sound_init)
             except alsaseq.SequencerError as e:
                 logging.debug(
                     "initialise_alsa_sequencer failed. Using fake synth.")
                 self.display_sound_init_error_message(e)
                 soundcard.initialise_using_fake_synth(True)
                 return
         else:
             if solfege.splash_win:
                 solfege.splash_win.hide()
             gu.dialog_ok(
                 _("The pyalsa Python module is missing"), solfege.win,
                 _("Solfege was configured to use the Python modules from www.alsa-project.org, but the modules were not found. You must reconfigure sound in the preferences window (Ctrl-F12) or restart Solfege in a way that it finds the modules."
                   ))
             soundcard.initialise_using_fake_synth(True)
             if solfege.splash_win:
                 solfege.splash_win.show()
     elif cfg.get_string("sound/type") == "winsynth":
         try:
             soundcard.initialise_winsynth(
                 cfg.get_int("sound/synth_number"),
                 verbose_init=self.m_options.verbose_sound_init)
         except ImportError as e:
             self.display_sound_init_error_message(e)
             cfg.set_string("sound/type", "fake-synth")
             soundcard.initialise_using_fake_synth(True)
             return
         except RuntimeError as e:
             # We can get here if winmidi.output_devices() in winsynth
             # __init__ returns no devices. Don't know when, but it could
             # happen.
             gu.display_exception_message(e)
             cfg.set_string("sound/type", "fake-synth")
             soundcard.initialise_using_fake_synth(True)
             return
         if cfg.get_int("sound/synth_number") != soundcard.synth.m_devnum:
             solfege.win.display_error_message2(
                 _("MIDI setup"),
                 _("MIDI Device %(olddev)i not available. Will use device %(newdev)i."
                   ) % {
                       'olddev': cfg.get_int("sound/synth_number"),
                       'newdev': soundcard.synth.m_devnum
                   })
             cfg.set_int("sound/synth_number", soundcard.synth.m_devnum)
     elif cfg.get_string("sound/type") == "external-midiplayer":
         soundcard.initialise_external_midiplayer(
             verbose_init=self.m_options.verbose_sound_init)
         soundcard.synth.error_report_cb = solfege.win.display_error_message
     elif cfg.get_string("sound/type") == '':
         solfege.win.display_error_message(
             _("You should configure sound from the 'Sound' page "
               "of the preferences window."))
     elif cfg.get_string("sound/type") == "sequencer-device":
         try:
             soundcard.initialise_devicefile(
                 cfg.get_string("sound/device_file"),
                 cfg.get_int("sound/synth_number"),
                 verbose_init=self.m_options.verbose_sound_init)
         except (soundcard.SoundInitException, OSError, ImportError) as e:
             self.m_sound_init_exception = e
             soundcard.initialise_using_fake_synth(True)
     if cfg.get_string("programs/csound") == "AUTODETECT":
         for p in osutils.find_csound_executables():
             cfg.set_string("programs/csound", p)
             break
         else:
             # If not csound binary was found, then we set the string empty.
             # This means that autodetection will only happen the first time
             # you run the program. But later will newly installed binaries
             # be shown in the combo box of the preferences window.
             cfg.set_string("programs/csound", "")
     if cfg.get_string("programs/mma") == "AUTODETECT":
         for p in osutils.find_mma_executables(
                 cfg.get_list("app/win32_ignore_drives")):
             cfg.set_string("programs/mma", p)
             break
         else:
             cfg.set_string("programs/mma", "")
Example #20
0
             solfege.splash_win.show()
 elif cfg.get_string("sound/type") == "winsynth":
     try:
         soundcard.initialise_winsynth(
             cfg.get_int("sound/synth_number"),
             verbose_init=self.m_options.verbose_sound_init)
     except ImportError, e:
         self.display_sound_init_error_message(e)
         cfg.set_string("sound/type", "fake-synth")
         soundcard.initialise_using_fake_synth(True)
         return
     except RuntimeError, e:
         # We can get here if winmidi.output_devices() in winsynth
         # __init__ returns no devices. Don't know when, but it could
         # happen.
         gu.display_exception_message(e)
         cfg.set_string("sound/type", "fake-synth")
         soundcard.initialise_using_fake_synth(True)
         return
     if cfg.get_int("sound/synth_number") != soundcard.synth.m_devnum:
         solfege.win.display_error_message2(
             _("MIDI setup"),
             _("MIDI Device %(olddev)i not available. Will use device %(newdev)i."
               ) % {
                   'olddev': cfg.get_int("sound/synth_number"),
                   'newdev': soundcard.synth.m_devnum
               })
         cfg.set_int("sound/synth_number", soundcard.synth.m_devnum)
 elif cfg.get_string("sound/type") == "external-midiplayer":
     soundcard.initialise_external_midiplayer(
         verbose_init=self.m_options.verbose_sound_init)
Example #21
0
 def quit_program(self):
     try:
         cfg.sync()
     except IOError, e:
         gu.display_exception_message(e)
Example #22
0
 def setup_sound(self):
     if sys.platform == 'win32' and \
                 cfg.get_string("sound/type") == "sequencer-device":
         # just in case c:\home\.solfegerc is wrong
         cfg.set_string("sound/type", "winsynth")
     if self.m_options.no_sound \
        or cfg.get_string("sound/type") == "fake-synth":
         soundcard.initialise_using_fake_synth(self.m_options.verbose_sound_init)
     elif cfg.get_string("sound/type") == "alsa-sequencer":
         if alsaseq:
             try:
                 clientid, portid = self.get_list("sound/alsa-client-port")
             except ValueError:
                 clientid, portid = (None, None)
             try:
                 soundcard.initialise_alsa_sequencer((clientid, portid),
                         self.m_options.verbose_sound_init)
             except alsaseq.SequencerError as e:
                 logging.debug("initialise_alsa_sequencer failed. Using fake synth.")
                 self.display_sound_init_error_message(e)
                 soundcard.initialise_using_fake_synth(True)
                 return
         else:
             if solfege.splash_win:
                 solfege.splash_win.hide()
             gu.dialog_ok(_("The pyalsa Python module is missing"),
                 solfege.win,
                 _("Solfege was configured to use the Python modules from www.alsa-project.org, but the modules were not found. You must reconfigure sound in the preferences window (Ctrl-F12) or restart Solfege in a way that it finds the modules."))
             soundcard.initialise_using_fake_synth(True)
             if solfege.splash_win:
                 solfege.splash_win.show()
     elif cfg.get_string("sound/type") == "winsynth":
         try:
             soundcard.initialise_winsynth(cfg.get_int("sound/synth_number"),
                   verbose_init=self.m_options.verbose_sound_init)
         except ImportError as e:
             self.display_sound_init_error_message(e)
             cfg.set_string("sound/type", "fake-synth")
             soundcard.initialise_using_fake_synth(True)
             return
         except RuntimeError as e:
             # We can get here if winmidi.output_devices() in winsynth
             # __init__ returns no devices. Don't know when, but it could
             # happen.
             gu.display_exception_message(e)
             cfg.set_string("sound/type", "fake-synth")
             soundcard.initialise_using_fake_synth(True)
             return
         if cfg.get_int("sound/synth_number") != soundcard.synth.m_devnum:
             solfege.win.display_error_message2(_("MIDI setup"), _("MIDI Device %(olddev)i not available. Will use device %(newdev)i.") % {'olddev': cfg.get_int("sound/synth_number"), 'newdev': soundcard.synth.m_devnum})
             cfg.set_int("sound/synth_number", soundcard.synth.m_devnum)
     elif cfg.get_string("sound/type") == "external-midiplayer":
         soundcard.initialise_external_midiplayer(
                 verbose_init=self.m_options.verbose_sound_init)
         soundcard.synth.error_report_cb = solfege.win.display_error_message
     elif cfg.get_string("sound/type") == '':
         solfege.win.display_error_message(
             _("You should configure sound from the 'Sound' page "
               "of the preferences window."))
     elif cfg.get_string("sound/type") == "sequencer-device":
         try:
             soundcard.initialise_devicefile(
                          cfg.get_string("sound/device_file"),
                          cfg.get_int("sound/synth_number"),
                          verbose_init=self.m_options.verbose_sound_init)
         except (soundcard.SoundInitException, OSError, ImportError) as e:
             self.m_sound_init_exception = e
             soundcard.initialise_using_fake_synth(True)
     if cfg.get_string("programs/csound") == "AUTODETECT":
         for p in osutils.find_csound_executables():
             cfg.set_string("programs/csound", p)
             break
         else:
             # If not csound binary was found, then we set the string empty.
             # This means that autodetection will only happen the first time
             # you run the program. But later will newly installed binaries
             # be shown in the combo box of the preferences window.
             cfg.set_string("programs/csound", "")
     if cfg.get_string("programs/mma") == "AUTODETECT":
         for p in osutils.find_mma_executables(cfg.get_list("app/win32_ignore_drives")):
             cfg.set_string("programs/mma", p)
             break
         else:
             cfg.set_string("programs/mma", "")
Example #23
0
         if solfege.splash_win:
             solfege.splash_win.show()
 elif cfg.get_string("sound/type") == "winsynth":
     try:
         soundcard.initialise_winsynth(cfg.get_int("sound/synth_number"),
               verbose_init=self.m_options.verbose_sound_init)
     except ImportError, e:
         self.display_sound_init_error_message(e)
         cfg.set_string("sound/type", "fake-synth")
         soundcard.initialise_using_fake_synth(True)
         return
     except RuntimeError, e:
         # We can get here if winmidi.output_devices() in winsynth
         # __init__ returns no devices. Don't know when, but it could
         # happen.
         gu.display_exception_message(e)
         cfg.set_string("sound/type", "fake-synth")
         soundcard.initialise_using_fake_synth(True)
         return
     if cfg.get_int("sound/synth_number") != soundcard.synth.m_devnum:
         solfege.win.display_error_message2(_("MIDI setup"), _("MIDI Device %(olddev)i not available. Will use device %(newdev)i.") % {'olddev': cfg.get_int("sound/synth_number"), 'newdev': soundcard.synth.m_devnum})
         cfg.set_int("sound/synth_number", soundcard.synth.m_devnum)
 elif cfg.get_string("sound/type") == "external-midiplayer":
     soundcard.initialise_external_midiplayer(
             verbose_init=self.m_options.verbose_sound_init)
     soundcard.synth.error_report_cb = solfege.win.display_error_message
 elif cfg.get_string("sound/type") == '':
     solfege.win.display_error_message(
         _("You should configure sound from the 'Sound' page "
           "of the preferences window."))
 elif cfg.get_string("sound/type") == "sequencer-device":