本文整理汇总了Python中gi.repository.Gio.Settings.get_string方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.get_string方法的具体用法?Python Settings.get_string怎么用?Python Settings.get_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gio.Settings
的用法示例。
在下文中一共展示了Settings.get_string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addKeyCombo
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import get_string [as 别名]
def addKeyCombo(self, component, localized_component, description, callback, keypress, modifiers):
"""
Adds the given key combination with the appropriate callbacks to
the L{HotkeyManager}. If an identical description with the identical
component already exists in the model, just reassign with the new callback.
I{Note:} It is important that the component and description strings be
unique.
@param component: The component name, usually the plugin name, or "Core".
@type component: string
@param description: A description of the action performed during the given
keycombo.
@type description: string
@param callback: The callback to call when the given key combination
is pressed.
@type callback: callable
@param keypress: The key symbol of the keystroke that performs given operation.
@type keypress: long
@param modifiers: The modifiers that must be depressed for function to
be perfomed.
@type modifiers: int
"""
component_desc_pairs = list(zip([row[COL_COMPONENT] for row in self], [row[COL_DESC] for row in self]))
if (component, description) in component_desc_pairs:
path = component_desc_pairs.index((component, description))
self[path][COL_CALLBACK] = callback
else:
gspath = self._getComboGSettingsPath(component, description)
gsettings = GSettings(schema=HOTKEYS_GSCHEMA, path=gspath)
if gsettings.get_string("hotkey-combo"):
final_keypress, final_modifiers = gtk.accelerator_parse(gsettings.get_string("hotkey-combo"))
else:
final_keypress, final_modifiers = keypress, modifiers
self.append([component, description, callback, int(final_keypress), final_modifiers, localized_component])
示例2: _onComboChanged
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import get_string [as 别名]
def _onComboChanged(self, model, path, iter):
"""
Callback for row changes. Copies the changed key combos over to gsettings.
@param model: The model that emitted the signal. Should be this class instance.
@type model: L{gtk.TreeModel}
@param path: The path of the row that has changed.
@type path: tuple
@param iter: The iter of the row that has changed.
@type iter: L{gtk.TreeIter}
"""
if not model[iter][COL_COMPONENT] or not model[iter][COL_DESC]:
return
gspath = self._getComboGSettingsPath(model[iter][COL_COMPONENT], model[iter][COL_DESC])
gsettings = GSettings(schema=HOTKEYS_GSCHEMA, path=gspath)
combo_name = gtk.accelerator_name(model[iter][COL_KEYPRESS], gdk.ModifierType(model[iter][COL_MOD]))
key = gsettings.get_string("hotkey-combo")
if key != combo_name and key != "/":
gsettings.set_string("hotkey-combo", combo_name)
示例3: GSettings
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import get_string [as 别名]
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GObject
from gi.repository.Gio import Settings as GSettings
# from gi.repository import cairo
import cairo
import pyatspi
import string
from tools import Tools, parseColorString
MAX_BLINKS = 6
gsettings = GSettings(schema="org.a11y.Accerciser")
BORDER_COLOR, BORDER_ALPHA = parseColorString(gsettings.get_string("highlight-border"))
FILL_COLOR, FILL_ALPHA = parseColorString(gsettings.get_string("highlight-fill"))
HL_DURATION = int(gsettings.get_double("highlight-duration") * 1000)
class Bag(object):
"""
Bag class for converting a dicionary to an object with attributes.
"""
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def __str__(self):
示例4: GSettings
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import get_string [as 别名]
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GLib
from gi.repository import GObject
from gi.repository.Gio import Settings as GSettings
#from gi.repository import cairo
import cairo
import pyatspi
import string
from .tools import Tools, parseColorString
MAX_BLINKS = 6
gsettings = GSettings(schema='org.a11y.Accerciser')
BORDER_COLOR, BORDER_ALPHA = parseColorString(
gsettings.get_string('highlight-border'))
FILL_COLOR, FILL_ALPHA = parseColorString(
gsettings.get_string('highlight-fill'))
HL_DURATION = int(gsettings.get_double('highlight-duration')*1000)
class Bag(object):
'''
Bag class for converting a dicionary to an object with attributes.
'''
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def __str__(self):
return ', '.join(list(vars(self).keys()))