本文整理汇总了Python中gi.repository.Gio.Settings.new方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.new方法的具体用法?Python Settings.new怎么用?Python Settings.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gio.Settings
的用法示例。
在下文中一共展示了Settings.new方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def __init__(self, node, hotkey_manager, *main_views):
'''
Initialize the plugin manager.
@param node: The application's main node.
@type node: L{Node}
@param hotkey_manager: Application's hot key manager.
@type hotkey_manager: L{HotkeyManager}
@param main_views: List of permanent plugin views.
@type main_views: list of {PluginView}
'''
gtk.ListStore.__init__(self,
object, # Plugin instance
object, # Plugin class
str) # Plugin path
self.node = node
self.hotkey_manager = hotkey_manager
self.gsettings = GSettings.new(GSCHEMA)
self.view_manager = ViewManager(*main_views)
self.message_manager = MessageManager()
self.message_manager.connect('plugin-reload-request',
self._onPluginReloadRequest)
self.message_manager.connect('module-reload-request',
self._onModuleReloadRequest)
message_tab = self.message_manager.getMessageTab()
self.view_manager.addElement(message_tab)
self._row_changed_handler = \
self.connect('row_changed', self._onPluginRowChanged)
self._loadPlugins()
示例2: _gsettings_set_as_background
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def _gsettings_set_as_background(conf, file_location):
"""Sets the background path to the given path in gsettings"""
gsettings = Settings.new(_GSETTINGS_SCHEMA)
worked = gsettings.set_string(_GSETTINGS_KEY,"file://"+file_location)
# I do not think i need this sync command.
gsettings.sync()
if worked:
_log_succsess(conf,"gsetting")
else:
_log_failed(conf,"gsettings")
raise _exceptions.Failed("could not set gsettings key")
return
示例3: _setPluginLayouts
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def _setPluginLayouts(self, plugin_layouts):
self.plugviews = GSettings.new(PLUGVIEWS_GSCHEMA)
self.plugviews.set_strv("top-panel-layout", plugin_layouts.pop("Top panel"))
self.plugviews.set_strv("bottom-panel-layout", plugin_layouts.pop("Bottom panel"))
for plugview in list(plugin_layouts.keys()):
gspath = NEWPLUGVIEWS_PATH + plugview.lower().replace(" ", "-") + "/"
newview = GSettings.new_with_path(NEWPLUGVIEWS_GSCHEMA, gspath)
newview.set_strv("layout", plugin_layouts[plugview])
l = self.plugviews.get_strv("available-newviews")
l.append(plugview)
self.plugviews.set_strv("available-newviews", l)
示例4: __init__
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def __init__(self, *perm_views):
"""
Initialize view manager.
@param perm_views: List of permanent views, at least one is required.
@type perm_views: list of {PluginView}
"""
self._perm_views = perm_views
gsettings = GSettings.new(PLUGVIEWS_GSCHEMA)
single = gsettings.get_boolean("layout-single")
self._initViewModel(single)
self._setupActions()
示例5: set_background
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def set_background(image_path, check_exist=True):
if check_exist:
with open(image_path, 'rb') as f:
f.read(1)
path_to_file = path.abspath(image_path)
if isinstance(path_to_file, unicode):
path_to_file = path_to_file.encode('utf-8')
uri = 'file://' + quote(path_to_file)
bg_setting = Settings.new('org.gnome.desktop.background')
bg_setting.set_string('picture-uri', uri)
bg_setting.apply()
示例6: _getPluginLayouts
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def _getPluginLayouts(self):
plugin_layouts = {}
self.plugviews = GSettings.new(PLUGVIEWS_GSCHEMA)
plugin_layouts["Top panel"] = self.plugviews.get_strv("top-panel-layout")
plugin_layouts["Bottom panel"] = self.plugviews.get_strv("bottom-panel-layout")
for plugview in self.plugviews.get_strv("available-newviews"):
gspath = NEWPLUGVIEWS_PATH + plugview.lower().replace(" ", "-") + "/"
newview = GSettings.new_with_path(NEWPLUGVIEWS_GSCHEMA, gspath)
layout = newview.get_strv("layout")
if layout:
plugin_layouts[plugview] = layout
else:
l = self.plugviews.get_strv("available-newviews")
l.remove(plugview)
self.plugviews.set_strv("available-newviews", l)
return plugin_layouts
示例7: setSingleMode
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def setSingleMode(self, single):
"""
Toggle single mode on or off.
@param single: True if we want single mode.
@type single: boolean
"""
if isinstance(self._view_model, SingleViewModel) == single:
return
gsettings = GSettings.new(PLUGVIEWS_GSCHEMA)
gsettings.set_boolean("layout-single", single)
plugins = self._view_model.getViewedPlugins()
self._view_model.close()
del self._view_model
for plugin in plugins:
if plugin.get_parent():
plugin.get_parent().remove(plugin)
self._initViewModel(single)
for plugin in plugins:
self._view_model.addElement(plugin)
示例8: __init__
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def __init__(self, node):
"""
Initialize the window.
@param node: Main application's node.
@type node: L{Node}
"""
gtk.Window.__init__(self)
self.set_icon_name("accerciser")
self.set_title(_("Accerciser Accessibility Explorer"))
self.connect("key-press-event", self._onKeyPress)
node.connect("blink-done", self._onBlinkDone)
self.gsettings = GSettings.new(GSCHEMA)
width = self.gsettings.get_int("window-width") or 640
height = self.gsettings.get_int("window-height") or 640
self.set_default_size(width, height)
self.add_accel_group(ui_manager.uimanager.get_accel_group())
# Populate window
self._populateUI(node)
selection = self.treeview.get_selection()
selection.connect("changed", self._onSelectionChanged)
示例9: __init__
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
def __init__(self):
gtk.Alignment.__init__(self)
self.set_padding(12, 12, 18, 12)
self.gsettings = GSettings.new('org.a11y.Accerciser')
self._buildUI()
示例10: ImitationPluginConfigError
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [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'))
示例11: Bag
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new [as 别名]
import gi
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 ToolsAccessor, parseColorString
MAX_BLINKS = 6
gsettings = GSettings.new('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)