Ticket #1548: 0001-Error-message-improved.2.patch

File 0001-Error-message-improved.2.patch, 1.8 KB (added by humitos, 12 years ago)

A new version after a talk with gonzalo

  • jukeboxactivity.py

    From 7370adb95c63496aca3dc198618fed75dafebc6c Mon Sep 17 00:00:00 2001
    From: Manuel Kaufmann <humitos@gmail.com>
    Date: Thu, 1 Nov 2012 15:32:27 -0300
    Subject: [PATCH Jukebox] Error message improved
    
    A bit of style to the Error Alert that says GStreamer is not able to
    play a media file because of a plug-in is missing.
    
    Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
    ---
     jukeboxactivity.py | 15 +++++++++++++--
     1 file changed, 13 insertions(+), 2 deletions(-)
    
    diff --git a/jukeboxactivity.py b/jukeboxactivity.py
    index f106dd8..9905d2a 100644
    a b class JukeboxActivity(activity.Activity): 
    304304    def _player_eos_cb(self, widget):
    305305        self.songchange('next')
    306306
    307     def _show_error_alert(self, title):
     307    def _show_error_alert(self, title, msg=None):
    308308        alert = ErrorAlert()
    309309        alert.props.title = title
     310        if msg is not None:
     311            alert.props.msg = msg
    310312        self.add_alert(alert)
    311313        alert.connect('response', self._alert_cancel_cb)
    312314        alert.show()
    class JukeboxActivity(activity.Activity): 
    354356        self.player.stop()
    355357        self.player.set_uri(None)
    356358        self.control.set_disabled()
    357         self._show_error_alert("Error: %s - %s" % (message, detail))
     359
     360        file_path = self.playlist[self.currentplaying]['url']\
     361            .replace('journal://', 'file://')
     362        mimetype = mime.get_for_file(file_path)
     363
     364        title = _('This file can\'t be played')
     365        msg = _('Maybe the required plugin was not found '
     366                'for this type of file "%s"') % mimetype
     367        self._switch_canvas(False)
     368        self._show_error_alert(title, msg)
    358369
    359370    def _joined_cb(self, activity):
    360371        logging.debug("someone joined")