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 622584 - Pygi doesn't allow to convert and int to an enum
Pygi doesn't allow to convert and int to an enum
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks: 623359
 
 
Reported: 2010-06-24 10:28 UTC by Ignacio Casal Quinteiro (nacho)
Modified: 2010-07-26 11:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow passing ints as enum args (3.06 KB, patch)
2010-07-08 09:38 UTC, Tomeu Vizoso
committed Details | Review

Description Ignacio Casal Quinteiro (nacho) 2010-06-24 10:28:07 UTC
See this code in pygtk:
In pygtk this works, but in pygi it doesn't as view.set_smart_home_end(current.get_current_value()) would produce an error.


import gtk
import gtksourceview2 as gsv

view = gsv.View()
def smart(action, current):
    view.set_smart_home_end(current.get_current_value())
    print current.get_current_value()

action_group = gtk.ActionGroup("blah")
action_group.add_radio_actions([("Blah", None, "Disabled", None, "blah", 1), ("Blah2", None, "Disabled2", None, "blah2", 2)],-1, smart, "hello")

for action in action_group.list_actions():
    print action.get_name()
    action.activate()

gtk.main()
Comment 1 Tomeu Vizoso 2010-07-08 09:38:18 UTC
Created attachment 165463 [details] [review]
Allow passing ints as enum args
Comment 2 Tomeu Vizoso 2010-07-08 09:38:52 UTC
(In reply to comment #1)
> Created an attachment (id=165463) [details] [review]
> Allow passing ints as enum args

Is this what you want? Can you confirm this behavior matches pygtk's?
Comment 3 Ignacio Casal Quinteiro (nacho) 2010-07-08 09:49:59 UTC
This patch seems to work for the problem I had with gtksourceview.
Comment 4 Tomeu Vizoso 2010-07-26 11:57:53 UTC
Attachment 165463 [details] pushed as 5ca2a41 - Allow passing ints as enum args