Web lists-archives.com

Re: GLib doesn't find the ui resource




Hi,

I can tell from C API perspective.

When you are using gtk-builder-add-from-resource (https://developer.gnome.org/gtk3/stable/GtkBuilder.html#gtk-builder-add-from-resource) system is looking for path from resource file compiled by glib-compile-resources (https://developer.gnome.org/gio/stable/glib-compile-resources.html)

Format for resource file is in https://developer.gnome.org/gio/stable/GResource.html

e.g. (in this case path is "data/splashscreen.png" - it is not real file only path to resource in compiled file - this path is use in call to gtk-builder-add-from-resource)

<?xml version="1.0" encoding="UTF-8"?>
<gresources>
  <gresource prefix="/org/gtk/Example">
    <file>data/splashscreen.png</file>
    <file compressed="true">dialog.ui</file>
    <file preprocess="xml-stripblanks">menumarkup.xml</file>
  </gresource>
</gresources>

It you want to load real ui (created by glade) file from filestystem you shoud use gtk-builder-add-from-file
 (https://developer.gnome.org/gtk3/stable/GtkBuilder.html#gtk-builder-add-from-file).

Maybe in python you should use another method from api therefore,

Regards,
Mariusz 

W dniu 2017-08-30 o 15:48, Sascha Manns pisze:
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]

But if i'm running my app, i'm getting:

/home/sascha/PycharmProjects/gnome-publisher/.env/bin/python3
/home/sascha/PycharmProjects/gnome-publisher/bin/gnome-publisher
Traceback (most recent call last):
  File
"/home/sascha/PycharmProjects/gnome-publisher/src/gnome_publisher/__main__.py",
line 54, in do_startup
    builder.add_from_resource('/org/gnome/Publisher/gtk/app_menu.ui')
GLib.Error: g-resource-error-quark: The resource at
“/org/gnome/Publisher/gtk/app_menu.ui” does not exist (0)
Traceback (most recent call last):
  File
"/home/sascha/PycharmProjects/gnome-publisher/src/gnome_publisher/__main__.py",
line 96, in do_activate
    builder.add_from_resource("/org/gnome/Publisher/ui/main_intro.ui")
GLib.Error: g-resource-error-quark: The resource at
“/org/gnome/Publisher/ui/main_intro.ui” does not exist (0)

But where the GLib searches for the file?

[1]
https://github.com/saigkill/gnome-publisher/blob/master/data/org.gnome.Publisher.gresource.xml
[2]
https://github.com/saigkill/gnome-publisher/blob/master/src/gnome_publisher/__main__.py



_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list