After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668864 - rhythmbox-2.95 lyrics plugin fails to save edited lyrics with gtk3 introspection (pygobject-3.0.3, gtk+-3.2.3)
rhythmbox-2.95 lyrics plugin fails to save edited lyrics with gtk3 introspect...
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: Plugins (other)
2.95
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-27 17:18 UTC by Bernd Feige
Modified: 2012-02-01 21:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for /usr/lib/rhythmbox/plugins/lyrics/lyrics.py to use 3-argument get_text (382 bytes, patch)
2012-02-01 13:50 UTC, Bernd Feige
committed Details | Review

Description Bernd Feige 2012-01-27 17:18:00 UTC
Modifying the text and pressing "save" in the lyrics panel results in
TypeError: get_text() takes exactly 4 arguments (3 given)
Traceback (most recent call last):
  • File "/usr/lib/rhythmbox/plugins/lyrics/lyrics.py", line 212 in edit_callback
    save_callback()
  • File "/usr/lib/rhythmbox/plugins/lyrics/lyrics.py", line 202 in save_callback
    text = buf.get_text(startiter, enditer)
  • File "/usr/lib/python2.7/site-packages/gi/types.py", line 43 in function
    return info.invoke(*args, **kwargs)
TypeError: get_text() takes exactly 4 arguments (3 given)

This is due to a third argument "gboolean include_hidden_chars" being required.

It can be fixed by the following simple patch to
/usr/lib/rhythmbox/plugins/lyrics/lyrics.py:

=== modified file 'lyrics.py'
--- lyrics.py    2012-01-26 13:15:55 +0000
+++ lyrics.py    2012-01-26 13:16:08 +0000
@@ -199,7 +199,7 @@
             buf = self.buffer
             startiter = buf.get_start_iter()
             enditer = buf.get_end_iter()
-            text = buf.get_text(startiter, enditer)
+            text = buf.get_text(startiter, enditer, False)
             save_lyrics(self.cache_path, text)
             self.get_lyrics()

Reference: Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=400911
Comment 1 André Klapper 2012-01-28 17:58:33 UTC
Can you elaborate what pygtk has to do here, as configure.ac does not list any dependency for pygtk but only pygobject? Did you mean pygobject instead?

(Also, attaching patches as attachments is prefered as they can be searched for in the Bugzilla query, and are listed and linked on the product overview page.)
Comment 2 Bernd Feige 2012-01-29 18:09:08 UTC
Sorry, I'm (In reply to comment #1)
> Can you elaborate what pygtk has to do here, as configure.ac does not list any
> dependency for pygtk but only pygobject? Did you mean pygobject instead?

Sorry, as I understand now pygtk is now replaced  / implemented via pygobject. To clarify I opened a python console in rb and did:

from gi.repository import Gtk
Gtk

and got:

<gi.module.DynamicModule 'Gtk' from '/usr/lib/girepository-1.0/Gtk-3.0.typelib'>

so it's probably also not pygobject requiring three arguments but simply GTK3:

qfile -v /usr/lib/girepository-1.0/Gtk-3.0.typelib

results in:

x11-libs/gtk+-3.2.3 (/usr/lib/girepository-1.0/Gtk-3.0.typelib)

> (Also, attaching patches as attachments is prefered as they can be searched for
> in the Bugzilla query, and are listed and linked on the product overview page.)

I'll happily fix the bug header and attach a patch file once the bug is confirmed. Thanks!
Comment 3 Bernd Feige 2012-02-01 13:42:12 UTC
(In reply to comment #0)
> Modifying the text and pressing "save" in the lyrics panel results in
> TypeError: get_text() takes exactly 4 arguments (3 given)
> Traceback (most recent call last):
>
Comment 4 Bernd Feige 2012-02-01 13:50:32 UTC
Created attachment 206571 [details] [review]
Patch for /usr/lib/rhythmbox/plugins/lyrics/lyrics.py to use 3-argument get_text

Set the third argument to True because that's the default for pygtk, cf. http://www.pygtk.org/docs/pygtk/class-gtktextbuffer.html#method-gtktextbuffer--get-text
Comment 5 Jonathan Matthew 2012-02-01 21:29:57 UTC
Review of attachment 206571 [details] [review]:

pushed as commit a200004, thanks