本文整理匯總了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 []