Bug 596076 - DeprecationWarning: use set_markup() instead even if no deprecation is on set_line_wrap in C library
Summary: DeprecationWarning: use set_markup() instead even if no deprecation is on set...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pygtk2
Version: 6.0
Hardware: All
OS: Linux
high
low
Target Milestone: rc
: ---
Assignee: Matthew Barnes
QA Contact: desktop-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-05-26 09:30 UTC by Jan Pazdziora
Modified: 2010-06-14 10:25 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-06-08 20:28:12 UTC


Attachments (Terms of Use)
Test script to show DeprecationWarning (501 bytes, text/plain)
2010-05-26 09:30 UTC, Jan Pazdziora
no flags Details

Description Jan Pazdziora 2010-05-26 09:30:08 UTC
Created attachment 416728 [details]
Test script to show DeprecationWarning

Description of problem:

I have a code which tries to prevent line wrap by calling

  dialog.label.set_line_wrap(False)

on RHEL 6, and pygtk2 (?) complains about the call being deprecated. Using set_property does not help either.

Colleagues at #desktop say that it is not marked as deprecated in C API, so I believe it should not be in python either.

Version-Release number of selected component (if applicable):

# rpm -q pygtk2
pygtk2-2.16.0-3.el6.i686

How reproducible:

Deterministic.

Steps to Reproduce:
1. Run the attached script with python.
  
Actual results:

/tmp/test_wrap.py:11: DeprecationWarning: use set_markup() instead
  dialog.label.set_line_wrap(False)
/tmp/test_wrap.py:12: DeprecationWarning: use set_markup() instead
  dialog.label.set_use_markup(True)

Expected results:

No DeprecationWarnings.

Additional info:

Comment 2 Jan Pazdziora 2010-05-26 09:33:32 UTC
I can avoid the set_use_markup by using

--- /tmp/test_wrap.py.orig	2010-05-26 11:31:27.581399590 +0200
+++ /tmp/test_wrap.py	2010-05-26 11:31:40.452312105 +0200
@@ -7,9 +7,9 @@
 is not reflowed, so every even line is very short because it just has those ends.
 """
 
-dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, text)
+dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK)
 dialog.label.set_line_wrap(False)
-dialog.label.set_use_markup(True)
+dialog.set_markup(text)
 
 dialog.set_position (gtk.WIN_POS_CENTER)
 dialog.show_all ()

(is that equivalent?) but what do I use instead of that set_line_wrap if I wanted to get rid of that call?

Comment 3 Matthew Barnes 2010-06-08 20:28:12 UTC
The deprecation warning is coming from your accessing "dialog.label", which is supposed to be private.  See https://bugzilla.gnome.org/show_bug.cgi?id=309180.

GtkMessageDialog is rather restrictive in what it will let you do with the labels.  You would probably be better off constructing an equivalent window out of GtkDialog, where you'd have full access to the label.

Closing this as NOTABUG since the deprecation is intentional.

Comment 4 Jan Pazdziora 2010-06-14 10:01:43 UTC
Alright. How do I achieve the set_line_wrap equivalent then?

Comment 5 Matthew Barnes 2010-06-14 10:25:34 UTC
As I said, build your own GtkDialog.


Note You need to log in before you can comment on or make changes to this bug.