[pygtk] Unable to wrap enum

varun_shrivastava shrivastavavarun at yahoo.co.in
Mon Jun 18 21:00:40 WST 2007


hi
i m trying to wrap a gobject to python but unable to wrap enumerations .i
have a enumeration as shown
typedef enum{
    HI,
    HELLO,
    BYE
} HelloHi;


the def file generated using h2def.py looks like

 ;; Enumerations and flags ...
 
(define-enum Hi
   (in-module "Hello")
   (c-name "HelloHi")
   (gtype-id "HELLO_TYPE_HI")
   (values
     '("hi" "HI")
     '("hello" "HELLO")
     '("bye" "BYE")
  )
)

the add_constants function in wrapper file has entry as shown

void
 demo_add_constants(PyObject *module, const gchar *strip_prefix)
 {
   pyg_enum_add(module, "Hi", strip_prefix, HELLO_TYPE_HI);
 
   if (PyErr_Occurred())
     PyErr_Print();
 }

Now when i compile all files to generate the shared objects, it displays
following error

pygtk-codegen-2.0 --prefix demo --override demo.override demo.defs > demo.c                              
Warning: generating old-style constructor for:add_num_new
Could not write function add_num_get_enumval: No ArgType for const-gint
Warning: Constructor for AddNum needs to be updated to new API
         See http://live.gnome.org/PyGTK_2fWhatsNew28#update-constructors
***INFO*** The coverage of global functions is 50.00% (1/2)
***INFO*** There are no declared methods.
***INFO*** There are no declared virtual proxies.
***INFO*** There are no declared virtual accessors.
***INFO*** There are no declared interface proxies.
cc `pkg-config --cflags gtk+-2.0 pygtk-2.0` -I/usr/include/python2.4/ -I.  
-c -o demo.o demo.c
demo.c: In function ‘demo_add_constants’:
demo.c:123: error: ‘HELLO_TYPE_HI’ undeclared (first use in this function)
demo.c:123: error: (Each undeclared identifier is reported only once
demo.c:123: error: for each function it appears in.)
make: *** [demo.o] Error 1


kindly help
-- 
View this message in context: http://www.nabble.com/Unable-to-wrap-enum-tf3940058.html#a11174956
Sent from the Gtk+ - Python mailing list archive at Nabble.com.



More information about the pygtk mailing list