using GResources



Hello everyone!

I'm writing an app in Python 2.7.3 using Gtk 3 and I'm using GResources
to load data rather than accessing files rawly.

With Glade ui files I've had no issue at all, but for loading images or
custom CSS I'm failing to achive the goal. 

This is the code I'm using:

...
# Registering the GResource
resource = Gio.resource_load(DATA_DIR + "serere.gresource")
Gio.Resource._register(resource)

...
#Trying to load an image
gfile = Gio.File.new_for_uri(
  'resource:///cu/nova/serere/icons/image_name.png'
)
gicon = Gio.FileIcon(gfile)
self.image.set_from_gicon(gicon)
...

#Trying to load CSS
self.css_provider = Gtk.CssProvider()
gfile = Gio.File.new_for_uri(
  "resource:///cu/nova/serere/gtk3/serere.css"
)
self.css_provider.load_from_file(gfile)
...

Where 'self.image' is off course a Gtk.Image

In both cases I get this on the shell:

TypeError: metaclass conflict: the metaclass of a derived class must be
a (non-strict) subclass of the metaclasses of all its bases
**
ERROR:/build/buildd/pygobject-3.2.2/gi/_gobject/pygobject.c:929:pygobject_new_full: assertion failed: (tp != NULL)

What should I be doing that I'm not??

Best regards


10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]