How do I access the preferences from my main dialog window? Also how do I add a new preference?
Posted
by
Captain_Glen
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Captain_Glen
Published on 2012-06-20T02:27:42Z
Indexed on
2012/06/20
3:23 UTC
Read the original article
Hit count: 291
class PreferencesCalorieBurnerDialog(PreferencesDialog):
__gtype_name__ = "PreferencesCalorieBurnerDialog"
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the preferences dialog"""
super(PreferencesCalorieBurnerDialog, self).finish_initializing(builder)
# Bind each preference widget to gsettings
settings = Gio.Settings("net.launchpad.calorie-burner")
widget = self.builder.get_object('example_entry')
settings.bind("example", widget, "text", Gio.SettingsBindFlags.DEFAULT)
#Custom preference
widget = self.builder.get_object('weight')
settings.bind("weight", widget, "float", Gio.SettingsBindFlags.DEFAULT)
Main Dialog
self.PreferencesDialog.get_weight()???
© Ask Ubuntu or respective owner