本文整理匯總了Python中gi.repository.Gio.Settings.list_schemas方法的典型用法代碼示例。如果您正苦於以下問題:Python Settings.list_schemas方法的具體用法?Python Settings.list_schemas怎麽用?Python Settings.list_schemas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gi.repository.Gio.Settings
的用法示例。
在下文中一共展示了Settings.list_schemas方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ImitationPluginConfigError
# 需要導入模塊: from gi.repository.Gio import Settings [as 別名]
# 或者: from gi.repository.Gio.Settings import list_schemas [as 別名]
from gi.repository.Gtk import accelerator_parse
from gi.repository.Gio import Settings
# Check if gschema installed
if 'org.gnome.gedit.plugins.imitation' not in Settings.list_schemas():
class ImitationPluginConfigError(Exception):
pass
raise ImitationPluginConfigError('Imitation gschema not installed')
# Functions for getting config values
s = Settings.new('org.gnome.gedit.plugins.imitation').get_string
def p(accel_str):
""" Parse accelerator string and warn of invalid formats """
# Always results in lowercase keyvals (accounted for when matching)
accel = accelerator_parse(accel_str)
if accel[0] == 0:
print('Imitation plugin: invalid accelerator string "' + accel_str + '"')
return accel
# configurable (restart gedit to apply changes)
MARK_TOGGLE = p(s('mark-toggle'))
MARK_UP = p(s('mark-up'))
MARK_DOWN = p(s('mark-down'))
MARK_ALT_UP = p(s('mark-alt-up'))
MARK_ALT_DOWN = p(s('mark-alt-down'))