Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to develop an application using the quickly/pygtk stack. I got my Gsettings schemas all set up in ~/app-name-here/data/glib-2.0/schemas/net.launchpad.app-name-here.gschema.xml correctly and I am able to access it just fine in my preferences dialog window that is located in ~/app-name-here/app-name-here/PreferencesDialog.py via

from gi.repository import Gtk, Gio
settings = Gio.Settings("net.launchpad.app-name-here")
settings.get_boolean('notify')
settings.set_boolean('notify', True)

but when I try to check the value of one of my settings in a file located in ~/app-name-here/bin/Daemon.py that I use as a script to run in the background and send notifications by a similar method of

from gi.repository import Gio
settings = Gio.Settings("net.launchpad.app-name-here")
settings.get_boolean('notify')

it fails at the line that says

settings = Gio.Settings("net.launchpad.app-name-here")

and spits out a nasty error

(Daemon.py:26100): GLib-GIO-ERROR **: Settings schema 'net.launchpad.app-name-here' is not installed

Despite the fact that I can open up dconf-editor and find the settings under net/launchpad/app-name-here. Any thoughts?

share|improve this question

2 Answers 2

So I think I may have psuedo-solved my own problem. I copied my schemas from ~/app-name-here/data/glib-2.0/schemas/net.launchpad.app-name-here.gschema.xml to /usr/share/glib-2.0/schemas/net.launchpad.app-name-here.gschema.xml and then compiled my schemas. I'll put the commands to do so below if it can help anyone. (replace app-name-here with the actual name of your quickly app) I believe that this would be done automatically if I had packaged my app into a *deb and then installed it. I believe the problem was that the schemas were not available to all users or the code outside the directory I was workin.

$: sudo cp ~/app-name-here/data/glib-2.0/schemas/net.launchpad.app-name-here.gschema.xml /usr/share/glib-2.0/schemas/
$: sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
share|improve this answer

"quickly run" adds your ./data/ directory to the XDG_DATA_DIRS environment variable, which lets locally-compiles glib schemas be found by Gio.GSettings. If you do this in your Daemon.py as well, you will be able to run it from your development directory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.