1. Vladimir Kolev
  2. gSharkDown

Commits

Damián Nohales  committed 2c8c008

I guess I solved the problem with the Lyrics.

Just a hunch, I guess the problem is because loading the dialogs in a new thread, because this, I delegate the Lyrics viewer and error showing to the main thread on SharkDown using gobject.idle_add on LyricsThread.

  • Participants
  • Parent commits 87e74fa
  • Branches default

Comments (0)

Files changed (3)

File lib/SharkDown.py

View file
  • Ignore whitespace
         Tries to retrieve lyrics for selected song from the playlist.
         """
         if self.playlist.playing_song != None:
+            self.lyrics_button.set_sensitive(False)
+            self.lyrics_button.set_label(_("Loading lyrics..."))
             t = LyricsThread(self, self.playlist.playing_song)
             t.start()
         else:
             info = guihelpers.InfoDialog(self.window,
                 _("There should be a playing song to view\nthe lyrics for it."))
             info.show_all()
+            
+    def open_lyrics_viewer(self, lyrics):
+        self.lyrics_button.set_sensitive(True)
+        self.lyrics_button.set_label(_("Lyrics"))
+        if "ERROR:" in lyrics:
+            error = guihelpers.ErrorMessage(self.window, lyrics)
+            error.run()
+        else:
+            lyrdiag = guihelpers.LyricsDialog(self.get_playing_song(), lyrics)
+            lyrdiag.show_all()
 
     def on_show_about(self, widget, data = None):
         """

File lib/guihelpers.py

View file
  • Ignore whitespace
         @param message : The error message to be shown
         """
         gtk.MessageDialog.__init__(self, parent,
-                            gtk.DIALOG_MODAL,
+                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                             gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message)
         self.set_default_response(gtk.RESPONSE_OK)
         self.set_title(_("Error"))
         self.lyrics.add_buttons(gtk.STOCK_OK, gtk.RESPONSE_OK)
         self.lyrics.set_default_response(gtk.RESPONSE_OK)
         self.lyrics.connect('response', self.handle_clicked)
-        song_title = glib.markup_escape_text(song.get_artist()) + " - "
-        song_title += glib.markup_escape_text(song.get_title())
+        song_title = song.get_artist() + " - "
+        song_title += song.get_title()
 
         self.songlabel.set_text(song_title)
-        self.lyrics_buffer.set_text(glib.markup_escape_text(lyrics))
+        self.lyrics_buffer.set_text(lyrics)
 
     def show_all(self):
         """

File lib/tfuncs.py

View file
  • Ignore whitespace
         self.song = song
 
     def run(self):
-        self.parent.lyrics_button.set_sensitive(False)
-        self.parent.lyrics_button.set_label(_("Loading lyrics..."))
         lyrics = lyrdblib.search(self.song.get_artist(), self.song.get_title())
-        self.parent.lyrics_button.set_sensitive(True)
-        self.parent.lyrics_button.set_label(_("Lyrics"))
-        if "ERROR:" in lyrics:
-            error = guihelpers.ErrorMessage(None,
-                lyrics)
-            error.run()
-        else:
-            lyrdiag = guihelpers.LyricsDialog(self.song, lyrics)
-            lyrdiag.show_all()
+        gobject.idle_add(self.parent.open_lyrics_viewer, lyrics)