當前位置: 首頁>>代碼示例>>Python>>正文


Python Settings.get_boolean方法代碼示例

本文整理匯總了Python中gi.repository.Gio.Settings.get_boolean方法的典型用法代碼示例。如果您正苦於以下問題:Python Settings.get_boolean方法的具體用法?Python Settings.get_boolean怎麽用?Python Settings.get_boolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gi.repository.Gio.Settings的用法示例。


在下文中一共展示了Settings.get_boolean方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from gi.repository.Gio import Settings [as 別名]
# 或者: from gi.repository.Gio.Settings import get_boolean [as 別名]
class Zoomer:
    def __init__(self):
        self.incr = 0.1
        self._refreshSettings()

    def _refreshSettings(self):
        self.a11yAppPrefs = Settings('org.gnome.desktop.a11y.applications')
        self.magPrefs = Settings('org.gnome.desktop.a11y.magnifier')

    def zoomIn(self):
      mag_factor = self.magPrefs.get_double('mag-factor')
      self.magPrefs.set_double('mag-factor', mag_factor + self.incr)
      self.zoomOn()

    def zoomOut(self):
      mag_factor = self.magPrefs.get_double('mag-factor')
      self.magPrefs.set_double('mag-factor', mag_factor - self.incr)
      self.zoomOn()

    def zoomOff(self):
        self.a11yAppPrefs.set_boolean('screen-magnifier-enabled', False)

    def zoomOn(self):
        self.a11yAppPrefs.set_boolean('screen-magnifier-enabled', True)

    def isActive(self):
        return self.a11yAppPrefs.get_boolean('screen-magnifier-enabled')
開發者ID:timthelion,項目名稱:gnome-shell-zoom-control-window,代碼行數:29,代碼來源:GnomeZoomSettings.py

示例2: isA11yEnabled

# 需要導入模塊: from gi.repository.Gio import Settings [as 別名]
# 或者: from gi.repository.Gio.Settings import get_boolean [as 別名]
def isA11yEnabled():
    """
    Checks if accessibility is enabled via DConf.
    """
    from gi.repository.Gio import Settings
    InterfaceSettings = Settings(schema=a11yDConfKey)
    dconfEnabled = InterfaceSettings.get_boolean('toolkit-accessibility')
    if os.environ.get('GTK_MODULES', '').find('gail:atk-bridge') == -1:
        envEnabled = False
    else:
        envEnabled = True  # pragma: no cover
    return (dconfEnabled or envEnabled)
開發者ID:wangweiqing,項目名稱:dogtail,代碼行數:14,代碼來源:utils.py

示例3: __init__

# 需要導入模塊: from gi.repository.Gio import Settings [as 別名]
# 或者: from gi.repository.Gio.Settings import get_boolean [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(schema=PLUGVIEWS_GSCHEMA)
   single = gsettings.get_boolean('layout-single')
   self._initViewModel(single)
   self._setupActions()
開發者ID:javihernandez,項目名稱:accerciser,代碼行數:14,代碼來源:view.py

示例4: isA11yEnabled

# 需要導入模塊: from gi.repository.Gio import Settings [as 別名]
# 或者: from gi.repository.Gio.Settings import get_boolean [as 別名]
def isA11yEnabled():
    """
    Checks if accessibility is enabled via DConf.
    """
    from gi.repository.Gio import Settings
    try:
        InterfaceSettings = Settings(schema_id=a11yDConfKey)
    except TypeError: # if we have older glib that has deprecated param name
        InterfaceSettings = Settings(schema=a11yDConfKey)
    dconfEnabled = InterfaceSettings.get_boolean('toolkit-accessibility')
    if os.environ.get('GTK_MODULES', '').find('gail:atk-bridge') == -1:
        envEnabled = False
    else:
        envEnabled = True  # pragma: no cover
    return (dconfEnabled or envEnabled)
開發者ID:martiinsiimon,項目名稱:dogtail,代碼行數:17,代碼來源:utils.py


注:本文中的gi.repository.Gio.Settings.get_boolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。