本文整理匯總了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()))