本文整理汇总了Python中gi.repository.Atspi.role_get_name方法的典型用法代码示例。如果您正苦于以下问题:Python Atspi.role_get_name方法的具体用法?Python Atspi.role_get_name怎么用?Python Atspi.role_get_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Atspi
的用法示例。
在下文中一共展示了Atspi.role_get_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getLocalizedRoleName
# 需要导入模块: from gi.repository import Atspi [as 别名]
# 或者: from gi.repository.Atspi import role_get_name [as 别名]
def getLocalizedRoleName(self, obj, role=None):
"""Returns the localized name of the given Accessible object; the name
is suitable to be brailled.
Arguments:
- obj: an Accessible object
- role: an optional pyatspi role to use instead
"""
if _settingsManager.getSetting('brailleRolenameStyle') \
== settings.BRAILLE_ROLENAME_STYLE_SHORT:
objRole = role or obj.getRole()
rv = shortRoleNames.get(objRole)
if rv:
return rv
if not isinstance(role, pyatspi.Role):
try:
return obj.getLocalizedRoleName()
except:
return ''
if not role:
return ''
nonlocalized = Atspi.role_get_name(role)
atkRole = Atk.role_for_name(nonlocalized)
return Atk.role_get_localized_name(atkRole)
示例2: _generateRoleName
# 需要导入模块: from gi.repository import Atspi [as 别名]
# 或者: from gi.repository.Atspi import role_get_name [as 别名]
def _generateRoleName(self, obj, **args):
"""Returns an array of sounds indicating the role of obj."""
if not _settingsManager.getSetting('playSoundForRole'):
return []
role = args.get('role', obj.getRole())
filename = Atspi.role_get_name(role).replace(' ', '_')
result = self._convertFilenameToIcon(filename)
if result:
return [result]
return []