Re: GLib doesn't find the ui resource



On 30 August 2017 at 14:48, Sascha Manns <Sascha Manns mailbox org> wrote:
Hello list,

i have written some ui files which are compiled through make [1]. I
installed the compiled file in /usr/share/gnome-publisher.

Also i used this lines to add stuff from the resource:
builder = Gtk.Builder()

builder.add_from_resource("/org/gnome/Publisher/ui/main_intro.ui") [2]

Did you remember to load the GResource bundle you installed under your
datadir, when you start your Python application?

C libraries and applications can take advantage of constructor
functions called before main(), and the ability to embed the resources
into the binary; Python (and other languages) do not have support for
that, so you need to explicitly load the GResource.

In Python, you can use:

```
from gi.repository import Gio

datadir = ... # Set this one up from your configuration
resource = Gio.Resource.load(os.path.join(datadir, 'gnome-publisher',
'gnome-publisher.gresource'))
resoures.register()
```

This will load the bundle and register it.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]


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