当前位置: 首页>>代码示例>>Python>>正文


Python Settings.set_strv方法代码示例

本文整理汇总了Python中gi.repository.Gio.Settings.set_strv方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.set_strv方法的具体用法?Python Settings.set_strv怎么用?Python Settings.set_strv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gio.Settings的用法示例。


在下文中一共展示了Settings.set_strv方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _setPluginLayouts

# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import set_strv [as 别名]
  def _setPluginLayouts(self, plugin_layouts):
    self.plugviews = GSettings(schema=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(schema=NEWPLUGVIEWS_GSCHEMA, path=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)
开发者ID:javihernandez,项目名称:accerciser,代码行数:14,代码来源:view.py

示例2: MultiViewModel

# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import set_strv [as 别名]

#.........这里部分代码省略.........
    @param plugin: Plugin that moved.
    @type plugin: L{Plugin}
    @param page_num: Plugin's position in view.
    @type page_num: integer
    @param action: Action that triggered this event.
    @type action: string    
    ''' 
    if self._closed or not isinstance(plugin, Plugin): return
    if (view.view_name, plugin.plugin_name) in self._ignore_insertion:
      self._ignore_insertion.remove((view.view_name, plugin.plugin_name))
      return
    if plugin.plugin_name in self._placement_cache:
      self._placement_cache.pop(plugin.plugin_name)

    plugin_layouts = self._getPluginLayouts()
    try:
      plugin_layout = plugin_layouts[view.view_name]
    except KeyError:
      plugin_layouts[view.view_name] = []
      plugin_layout = plugin_layouts[view.view_name]
    if plugin.plugin_name in plugin_layout:
        plugin_layout.remove(plugin.plugin_name)
    if action in ('reordered', 'added'):
      plugin_layout.insert(page_num, plugin.plugin_name)
    elif action == 'removed':
      self._placement_cache[plugin.plugin_name] = (view.view_name, page_num)
    if len(plugin_layout) == 0:
      self._removeView(view)

    self._setPluginLayouts(plugin_layouts)

  def _setPluginLayouts(self, plugin_layouts):
    self.plugviews = GSettings(schema=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(schema=NEWPLUGVIEWS_GSCHEMA, path=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)

  def _getPluginLayouts(self):
    plugin_layouts= {}
    self.plugviews = GSettings(schema=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(schema=NEWPLUGVIEWS_GSCHEMA, path=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


  def addPlugin(self, plugin):
    '''
    Add a plugin to the view. Check if it's placement is cached in this 
开发者ID:javihernandez,项目名称:accerciser,代码行数:70,代码来源:view.py

示例3: PluginManager

# 需要导入模块: from gi.repository.Gio import Settings [as 别名]
# 或者: from gi.repository.Gio.Settings import set_strv [as 别名]

#.........这里部分代码省略.........
    '''
    Instantiate a plugin class pointed to by the given iter.
    
    @param iter: Iter of plugin class we should instantiate.
    @type iter: gtk.TreeIter
    '''
    plugin_class = self[iter][self.COL_CLASS]
    plugin_instance = None
    try:
      plugin_instance = plugin_class(self.node, self.message_manager)
      plugin_instance.init()
      for key_combo in plugin_instance.global_hotkeys:
        self.hotkey_manager.addKeyCombo(
          plugin_class.plugin_name, 
          plugin_class.plugin_name_localized or plugin_class.plugin_name
          , *key_combo)
    except Exception as e:
      self.message_manager.newPluginError(
        plugin_instance, plugin_class,
        traceback.format_exception_only(e.__class__, e)[0].strip(),
        traceback.format_exc())
      try:
        plugin_instance._close()
      except:
        pass
      return
    self[iter][self.COL_INSTANCE] = plugin_instance
    if isinstance(plugin_instance, gtk.Widget):
      self.view_manager.addElement(plugin_instance)
    plugin_instance.onAccChanged(plugin_instance.node.acc)
    disabled_list = self.gsettings.get_strv('disabled-plugins')
    if plugin_instance.plugin_name in disabled_list:
      disabled_list.remove(plugin_instance.plugin_name)
      self.gsettings.set_strv('disabled-plugins', disabled_list)

  def _disablePlugin(self, iter):
    '''
    Disable plugin pointed to by the given iter.
    
    @param iter: Iter of plugin instance to be disabled.
    @type iter: gtk.TreeIter
    '''
    plugin_instance = self[iter][self.COL_INSTANCE]
    if not plugin_instance: return
    for key_combo in plugin_instance.global_hotkeys:
      self.hotkey_manager.removeKeyCombo(
        plugin_instance.plugin_name, *key_combo)
    if isinstance(plugin_instance, gtk.Widget):
      plugin_instance.destroy()
    plugin_instance._close()

    disabled_list = self.gsettings.get_strv('disabled-plugins')
    if not plugin_instance.plugin_name in disabled_list:
      disabled_list.append(plugin_instance.plugin_name)
    self.gsettings.set_strv('disabled-plugins', disabled_list)   

    self[iter][self.COL_INSTANCE] = False

  def _reloadPlugin(self, iter):
    '''
    Reload plugin pointed to by the given iter.
    
    @param iter: Iter of plugin to be reloaded.
    @type iter: gtk.TreeIter
    
    @return: New instance of plugin
开发者ID:javihernandez,项目名称:accerciser,代码行数:70,代码来源:plugin_manager.py


注:本文中的gi.repository.Gio.Settings.set_strv方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。