Beispiel #1
0
 def do_report(self, *v):
     yesno = gu.dialog_yesno(
         _("Automatic bug reports are often mostly useless because people omit their email address and add very little info about what happened. Fixing bugs is difficult if we cannot contact you and ask for more information.\n\nI would prefer if you open a web browser and report your bug to the bug tracker at http://bugs.solfege.org.\n\nThis will give your bug report higher priority and it will be fixed faster.\n\nAre you willing to do that?"
           ))
     if yesno:
         return
     self.m_send_exception = 'Nothing'
     b = self.g_text.get_buffer()
     d = reportbug.ReportBugWindow(
         self, b.get_text(b.get_start_iter(), b.get_end_iter()))
     while 1:
         ret = d.run()
         if ret in (gtk.RESPONSE_REJECT, gtk.RESPONSE_DELETE_EVENT):
             break
         elif ret == reportbug.RESPONSE_SEND:
             self.m_send_exception = d.send_bugreport()
             break
     if self.m_send_exception != 'Nothing':
         if self.m_send_exception:
             m = gtk.MessageDialog(
                 self, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,
                 gtk.BUTTONS_CLOSE,
                 "Sending bugreport failed:\n%s" % self.m_send_exception)
         else:
             m = gtk.MessageDialog(self, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO,
                                   gtk.BUTTONS_CLOSE,
                                   'Report sent to http://www.solfege.org')
         m.run()
         m.destroy()
     d.destroy()
 def do_report(self, *v):
     yesno = gu.dialog_yesno(_("Automatic bug reports are often mostly useless because people omit their email address and add very little info about what happened. Fixing bugs is difficult if we cannot contact you and ask for more information.\n\nI would prefer if you open a web browser and report your bug to the bug tracker at http://bugs.solfege.org.\n\nThis will give your bug report higher priority and it will be fixed faster.\n\nAre you willing to do that?"))
     if yesno:
         return
     self.m_send_exception = 'Nothing'
     b = self.g_text.get_buffer()
     d = reportbug.ReportBugWindow(self,
                     b.get_text(b.get_start_iter(), b.get_end_iter()))
     while 1:
         ret = d.run()
         if ret == gtk.RESPONSE_REJECT:
             break
         elif ret == reportbug.RESPONSE_SEND:
             self.m_send_exception = d.send_bugreport()
             break
         elif ret == reportbug.RESPONSE_SEE:
             showdlg = reportbug.ShowTextDialog(self, d.get_bugreport())
             r = showdlg.run()
             if r == reportbug.RESPONSE_SEND:
                 self.m_send_exception = d.send_bugreport()
                 showdlg.destroy()
                 break
             showdlg.destroy()
     if self.m_send_exception != 'Nothing':
         if self.m_send_exception:
             m = gtk.MessageDialog(self, gtk.DIALOG_MODAL,
                 gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE,
                 "Sending bugreport failed:\n%s" % self.m_send_exception)
         else:
             m = gtk.MessageDialog(self, gtk.DIALOG_MODAL,
                 gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE,
                 'Report sent to http://www.solfege.org')
         m.run()
         m.destroy()
     d.destroy()
Beispiel #3
0
 def _add_idbyname_lesson(self, p, filename):
     """
     p is a lessonfile.LessonfileCommon parser that has parsed the file.
     """
     not_ok = len([
         q.music for q in p.m_questions
         if not isinstance(q.music, self.ok_music_types)
     ])
     ok = len([
         q.music for q in p.m_questions
         if isinstance(q.music, self.ok_music_types)
     ])
     if not_ok > 0:
         if ok > 0:
             do_add = gu.dialog_yesno(
                 _("Not all music types are supported. This file contain %(ok)i supported questions and %(not_ok)i that are not supported. The unsupported questions will be ignored. Add any way?"
                   % locals()), self)
         else:
             gu.dialog_ok(
                 _("Could not add the lesson file. It has no questions with a music object with supported music type."
                   ), self)
             do_add = False
     else:
         do_add = True
     if do_add:
         self.m_changed = True
         self._add_common(filename)
Beispiel #4
0
 def parse_lessonfile(self):
     self.m_question = None
     self.q_status = self.QSTATUS_NO
     if not self.m_lessonfile:
         self.m_P = None
         return
     self.m_P = self.lessonfileclass(self.m_lessonfile_defs,
                                     self.m_lessonfile_header_defaults)
     self.m_P.parse_file(self.m_lessonfile)
     if [q for q in self.m_P.m_questions if isinstance(q.get('music'), lessonfile.Cmdline)]:
         run = gu.dialog_yesno(_("The lessonfile contain potentially dangerous code because it run external programs. Run anyway?"))
         if not run:
             self.m_P = None
 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))
Beispiel #6
0
 def parse_lessonfile(self):
     self.m_question = None
     self.q_status = self.QSTATUS_NO
     if not self.m_lessonfile:
         self.m_P = None
         return
     self.m_P = self.lessonfileclass(self.m_lessonfile_defs,
                                     self.m_lessonfile_header_defaults)
     self.m_P.parse_file(self.m_lessonfile)
     if [q for q in self.m_P.m_questions if isinstance(q.get('music'), lessonfile.Cmdline)]:
         run = gu.dialog_yesno(_("The lessonfile contain potentially dangerous code because it run external programs. Run anyway?"), solfege.win)
         if not run:
             self.m_P = None
Beispiel #7
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))
 def _add_idbyname_lesson(self, p, filename):
     """
     p is a lessonfile.LessonfileCommon parser that has parsed the file.
     """
     not_ok = len([q.music for q in p.m_questions if not isinstance(q.music, self.ok_music_types)])
     ok = len([q.music for q in p.m_questions if isinstance(q.music, self.ok_music_types)])
     if not_ok > 0:
         if ok > 0:
             do_add = gu.dialog_yesno(_("Not all music types are supported. This file contain %(ok)i supported questions and %(not_ok)i that are not supported. The unsupported questions will be ignored. Add any way?" % locals()))
         else:
             gu.dialog_ok(_("Could not add the lesson file. It has no questions with a music object with supported music type."))
             do_add = False
     else:
         do_add = True
     if do_add:
         self.m_changed = True
         self._add_common(filename)