本文整理汇总了Python中theme.Theme.get_attribute方法的典型用法代码示例。如果您正苦于以下问题:Python Theme.get_attribute方法的具体用法?Python Theme.get_attribute怎么用?Python Theme.get_attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类theme.Theme
的用法示例。
在下文中一共展示了Theme.get_attribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SettingsManager
# 需要导入模块: from theme import Theme [as 别名]
# 或者: from theme.Theme import get_attribute [as 别名]
#.........这里部分代码省略.........
self._config[key] = value
def get_notmuch_setting(self, section, key, fallback=None):
"""
look up config values from notmuch's config
:param section: key is in
:type section: str
:param key: key to look up
:type key: str
:param fallback: fallback returned if key is not present
:type fallback: str
:returns: config value with type as specified in the spec-file
"""
value = None
if section in self._notmuchconfig:
if key in self._notmuchconfig[section]:
value = self._notmuchconfig[section][key]
if value is None:
value = fallback
return value
def get_theming_attribute(self, mode, name, part=None):
"""
looks up theming attribute
:param mode: ui-mode (e.g. `search`,`thread`...)
:type mode: str
:param name: identifier of the atttribute
:type name: str
:rtype: urwid.AttrSpec
"""
colours = int(self._config.get('colourmode'))
return self._theme.get_attribute(colours, mode, name, part)
def get_threadline_theming(self, thread):
"""
looks up theming info a threadline displaying a given thread. This
wraps around :meth:`~alot.settings.theme.Theme.get_threadline_theming`,
filling in the current colour mode.
:param thread: thread to theme
:type thread: alot.db.thread.Thread
"""
colours = int(self._config.get('colourmode'))
return self._theme.get_threadline_theming(thread, colours)
def get_tagstring_representation(self, tag, onebelow_normal=None,
onebelow_focus=None):
"""
looks up user's preferred way to represent a given tagstring.
:param tag: tagstring
:type tag: str
:param onebelow_normal: attribute that shines through if unfocussed
:type onebelow_normal: urwid.AttrSpec
:param onebelow_focus: attribute that shines through if focussed
:type onebelow_focus: urwid.AttrSpec
If `onebelow_normal` or `onebelow_focus` is given these attributes will
be used as fallbacks for fg/bg values '' and 'default'.
This returns a dictionary mapping
:normal: to :class:`urwid.AttrSpec` used if unfocussed
:focussed: to :class:`urwid.AttrSpec` used if focussed
:translated: to an alternative string representation