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 622606 - [Gtk] Add overrides for RadioButton
[Gtk] Add overrides for RadioButton
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-06-24 14:13 UTC by Johan (not receiving bugmail) Dahlin
Modified: 2010-10-13 18:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[Gtk] Add overrides for Button/RadioButton (1.44 KB, patch)
2010-06-24 14:13 UTC, Johan (not receiving bugmail) Dahlin
committed Details | Review
Gtk.Button unit tests (1.08 KB, patch)
2010-06-24 15:35 UTC, johnp
committed Details | Review

Description Johan (not receiving bugmail) Dahlin 2010-06-24 14:13:01 UTC
Currently untested.
Comment 1 Johan (not receiving bugmail) Dahlin 2010-06-24 14:13:04 UTC
Created attachment 164509 [details] [review]
[Gtk] Add overrides for Button/RadioButton
Comment 2 johnp 2010-06-24 15:35:02 UTC
Created attachment 164515 [details] [review]
Gtk.Button unit tests
Comment 3 johnp 2010-06-24 15:47:00 UTC
Comment on attachment 164509 [details] [review]
[Gtk] Add overrides for Button/RadioButton

>From 8c90f60118e35f257ee7601a120fac0b7ae9ebdb Mon Sep 17 00:00:00 2001
>From: Johan Dahlin <johan@gnome.org>
>Date: Thu, 24 Jun 2010 11:12:32 -0300
>Subject: [PATCH] [Gtk] Add overrides for Button/RadioButton
>
>Currently untested.
>
>https://bugzilla.gnome.org/show_bug.cgi?id=622606
>---
> gi/overrides/Gtk.py |   20 ++++++++++++++++++++
> 1 files changed, 20 insertions(+), 0 deletions(-)
>
>diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
>index 0c3dcc5..7fe608f 100644
>--- a/gi/overrides/Gtk.py
>+++ b/gi/overrides/Gtk.py
>@@ -399,6 +399,26 @@ class TreeViewColumn(Gtk.TreeViewColumn):
> TreeViewColumn = override(TreeViewColumn)
> __all__.append('TreeViewColumn')
> 
>+class Button(Gtk.Button):
>+    def __init__(self, label=None, stock=None, use_underline=False):
>+        if stock:
>+            label = stock
>+            use_stock = True
>+            use_underline = True
>+        else:
>+            use_stock = False
>+        Gtk.Button.__init__(self, label=label, use_stock=use_stock,
>+                            use_underline=use_underline)
>+Button = override(Button)
>+__all__.append('Button')

The above button patch is good to commit w/ the test patch I attached

>+class RadioButton(Gtk.RadioButton):
>+    def __init__(self, group=None, label=None, use_underline=False):
>+        Gtk.RadioButton.__init__(self, group=group, label=label,
>+                                 use_underline=use_underline)
>+RadioButton = override(RadioButton)
>+__all__.append('RadioButton')
>+

There is a memory management issue with RadioButton groups being a list of radio buttons that gets modified by GTK which is why we added the join_group API for RadioActions (it takes a RadioAction instead of a group and joins the RadioAction's group inside of GTK).  The same API needs to be added for RadioButtons.  Colin stated that he did not think the get_group/set_group API is wrappable via GI due to the fact that the list is modified when setting it.   

> import sys
> 
> initialized, argv = Gtk.init_check(sys.argv)
>-- 
>1.6.6.1
Comment 4 Tomeu Vizoso 2010-08-16 08:15:03 UTC
Thanks!

Attachment 164515 [details] pushed as 231e934 - Gtk.Button unit tests
Comment 5 Tomeu Vizoso 2010-08-16 08:16:22 UTC
(In reply to comment #3)
> 
> There is a memory management issue with RadioButton groups being a list of
> radio buttons that gets modified by GTK which is why we added the join_group
> API for RadioActions (it takes a RadioAction instead of a group and joins the
> RadioAction's group inside of GTK).  The same API needs to be added for
> RadioButtons.  Colin stated that he did not think the get_group/set_group API
> is wrappable via GI due to the fact that the list is modified when setting it.  

Any idea which API would be bindings-friendly?
Comment 6 johnp 2010-09-07 02:33:57 UTC
The RadioAction object added a join_group method which takes another RadioAction.  This should be copied for RadioButton.
Comment 7 johnp 2010-09-07 03:05:11 UTC
https://bugzilla.gnome.org/show_bug.cgi?id=628935 fixes the group issue