-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix deprecation warnings #156
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your work. The changes look mostly good, I just marked a couple of issues.
|
||
self.set_default_size(150, 100) | ||
|
||
label = Gtk.Label("This is a dialog to display additional information") | ||
label = Gtk.Label.new("This is a dialog to display additional information") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer Gtk.Label(label="…")
here.
label = Gtk.Label("This is a normal label") | ||
|
||
label = Gtk.Label.new("This is a normal label") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Gtk.Label(label="…")
.
examples/label_example.py
Outdated
label = Gtk.Label( | ||
|
||
label = Gtk.Label.new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Gtk.Label(label="…")
.
examples/label_example.py
Outdated
label = Gtk.Label("This is an example of a line-wrapped label. It " | ||
|
||
label = Gtk.Label.new("This is an example of a line-wrapped label. It " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Gtk.Label(label="…")
.
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) | ||
Gtk.StyleContext.add_class(box.get_style_context(), "linked") | ||
|
||
button = Gtk.Button() | ||
button.add(Gtk.Arrow(Gtk.ArrowType.LEFT, Gtk.ShadowType.NONE)) | ||
button = Gtk.Button.new_from_icon_name("pan-start-symbolic", Gtk.IconSize.MENU) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"pan-start-symbolic" is a different symbol from Gtk.ArrowType.LEFT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know but this was the suggested replacement in my searching
@@ -13,12 +13,12 @@ def __init__(self): | |||
|
|||
self.page1 = Gtk.Box() | |||
self.page1.set_border_width(10) | |||
self.page1.add(Gtk.Label('Default Page!')) | |||
self.notebook.append_page(self.page1, Gtk.Label('Plain Title')) | |||
self.page1.add(Gtk.Label.new("Default Page!")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use keyword arguments instead of .new
.
|
||
self.page2 = Gtk.Box() | ||
self.page2.set_border_width(10) | ||
self.page2.add(Gtk.Label('A page with an image for a Title.')) | ||
self.page2.add(Gtk.Label.new("A page with an image for a Title.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use keyword arguments instead of .new
.
vbox.pack_start(Gtk.ModelButton("Item 1"), False, True, 10) | ||
vbox.pack_start(Gtk.Label("Item 2"), False, True, 10) | ||
vbox.pack_start(Gtk.ModelButton(label="Item 1"), False, True, 10) | ||
vbox.pack_start(Gtk.Label.new("Item 2"), False, True, 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use keyword arguments instead of .new
.
|
||
box = self.get_content_area() | ||
|
||
label = Gtk.Label("Insert text you want to search for:") | ||
label = Gtk.Label.new("Insert text you want to search for:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use keyword arguments instead of .new
.
My reasoning for using With GtkLabel it seems better to use
Also it ties in with the associated method
Another reason to avoid using the default class constructor with attributes is that Gtk deprecation warnings will be missed: #156 (comment) |
Fixes the PyGTKDeprecationWarning outputs in terminal, mostly related to positional arguments. Added a `make test` command to quickly check that examples run and view output in terminal for deprecated warnings. Fixes: sebp#150
Fixes the PyGTKDeprecationWarning outputs in terminal, mostly related
to positional arguments.
Added a
make test
command to quickly check that examples run and viewoutput in terminal for deprecated warnings.
Fixes: #150, #78