本文整理汇总了Python中gi.repository.Gio.Settings.new_with_path方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.new_with_path方法的具体用法?Python Settings.new_with_path怎么用?Python Settings.new_with_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gio.Settings
的用法示例。
在下文中一共展示了Settings.new_with_path方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setPluginLayouts
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new_with_path [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)
示例2: _onResize
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new_with_path [as 别名]
def _onResize(self, widget, allocation):
"""
Callback for window resizing. Used for persisting view sizes across
sessions.
@param widget: Window widget.
@type widget: gtk.Widget
@param allocation: The new allocation.
@type allocation: gtk.gdk.Rectangle
"""
view_name = self.plugin_view.view_name
gspath = NEWPLUGVIEWS_PATH + view_name.lower().replace(" ", "-") + "/"
gsettings = GSettings.new_with_path(NEWPLUGVIEWS_GSCHEMA, gspath)
gsettings.set_int("width", self.get_allocated_width())
gsettings.set_int("height", self.get_allocated_height())
示例3: _getPluginLayouts
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new_with_path [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
示例4: addKeyCombo
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new_with_path [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.new_with_path(HOTKEYS_GSCHEMA, 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])
示例5: __init__
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new_with_path [as 别名]
def __init__(self, view_name):
"""
Initialize a new plugin view window.
@param view_name: The name of the view.
@type view_name: string
"""
gtk.Window.__init__(self)
self.plugin_view = PluginView(view_name)
self.add(self.plugin_view)
gspath = NEWPLUGVIEWS_PATH + view_name.lower().replace(" ", "-") + "/"
gsettings = GSettings.new_with_path(NEWPLUGVIEWS_GSCHEMA, gspath)
width = gsettings.get_int("width")
height = gsettings.get_int("height")
self.set_default_size(width, height)
self.connect("key_press_event", self._onKeyPress)
self.plugin_view.connect_after("page_removed", self._onPluginRemoved)
self.set_title(view_name)
self.set_position(gtk.WindowPosition.MOUSE)
self.show_all()
self.connect("size-allocate", self._onResize)
示例6: _onComboChanged
# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import new_with_path [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.new_with_path(HOTKEYS_GSCHEMA, 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)