GNOME Bugzilla – Bug 746724
Implement g_settings_bind_with_mapping and handle range/flag __setitem__
Last modified: 2018-01-10 20:49:22 UTC
Created attachment 300247 [details] [review] fix patch g_settings_bind is a function that binds an object property with a settings key. This is available in the python binding. g_settings_bind_with_mapping allows users to assign a mapping that converts the settings value to the desired widget value and vice versa, eg. when the widget value should be twice the settings value. This is not available in the python binding (possibly due to the difficulty in introspecting functions). This patch implements this function in the gi overrides. Implementing this requires properly implementing the __setitem__ override. The __setitem__ override allows users to access schema values through settings = Gio.Settings.new(schema) value = settings[key] However, this is only implemented for key types "type" and "enum". Attempting to use it for the other types "range" and "flags" will raise a NotImplementedError. So this patch implements this functionality for all possible key types. For reference, support for "enum" was implemented here: https://bugzilla.gnome.org/show_bug.cgi?id=685947
Created attachment 300560 [details] [review] Update to previous patch Don't re-implement range checking as GSettings already does that (and nicely returns a False instead of abruptly crashing when the value is out of range)
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pygobject/issues/98.