我正在关注http://www.micahcarrick.com/gsettings-python-gnome-3.html从 python 使用 GSettings,并且我已经成功读取了一个值:
from gi.repository import Gio
gso=Gio.Settings.new("org.gnome.desktop.wm.preferences")
gso.get_value("focus-mode")
这将返回一个“GLib.Variant”,它是一组枚举值中的一个。为了获得我可以设置的有效枚举,我使用:
gso.get_range("focus-mode")
但是,文档说
g_settings_get_range 自 2.40 版以来已被弃用,不应在新编写的代码中使用。请改用 g_settings_schema_key_get_range()。
那么,如何从 python 中使用 g_settings_schema_key_get_range 呢?
更一般地说,在给定 C 文档的情况下,我如何自省 Gio 以找出如何从 python 中使用它?