本文整理汇总了Python中pyatspi.findDescendant函数的典型用法代码示例。如果您正苦于以下问题:Python findDescendant函数的具体用法?Python findDescendant怎么用?Python findDescendant使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findDescendant函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: onWindowActivated
def onWindowActivated(self, event):
"""Called whenever one of gcalctool's toplevel windows is activated.
Arguments:
- event: the window activated Event
"""
if self._resultsDisplay and self._statusLine:
gtk.Script.onWindowActivated(self, event)
return
obj = event.source
role = obj.getRole()
if role != pyatspi.ROLE_FRAME:
gtk.Script.onWindowActivated(self, event)
return
isEditbar = lambda x: x and x.getRole() == pyatspi.ROLE_EDITBAR
self._resultsDisplay = pyatspi.findDescendant(obj, isEditbar)
if not self._resultsDisplay:
self.presentMessage(messages.CALCULATOR_DISPLAY_NOT_FOUND)
isStatusLine = lambda x: x and x.getRole() == pyatspi.ROLE_TEXT \
and not x.getState().contains(pyatspi.STATE_EDITABLE)
self._statusLine = pyatspi.findDescendant(obj, isStatusLine)
gtk.Script.onWindowActivated(self, event)
开发者ID:FractalBobz,项目名称:orca,代码行数:27,代码来源:script.py
示例2: doesrowexist
def doesrowexist(self, window_name, object_name, row_text):
'''
Verify table cell value with given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_name: string
@param row_text: Row text to match
@type string
@return: 1 on success 0 on failure.
@rtype: integer
'''
obj = self._get_object(window_name, object_name)
def _searchString(acc):
try:
itext = acc.queryText()
except NotImplementedError:
return False
return row_text == itext.getText(0,-1)
results = pyatspi.findDescendant(obj, _searchString)
return int(bool(results))
开发者ID:eeejay,项目名称:ldtp2,代码行数:28,代码来源:table.py
示例3: setup
def setup(self, test):
self._registry = pyatspi.Registry()
print self._path
self._desktop = self._registry.getDesktop(0)
self._root = pyatspi.findDescendant(
self._desktop, lambda x: x.name == "atspi-test-main" and x.getRole() == pyatspi.ROLE_WINDOW
)
开发者ID:h4ck3rm1k3,项目名称:pyatspi2,代码行数:7,代码来源:collectiontest.py
示例4: _isCandidateWindow
def _isCandidateWindow(self, window):
if self._script.utilities.isDead(window):
msg = "SOFFICE: %s is not candidate window because it's dead." % window
debug.println(debug.LEVEL_INFO, msg, True)
return False
if window and window.childCount and window.getRole() == pyatspi.ROLE_FRAME:
child = self._findChildDialog(window[0])
if child and child.getRole() == pyatspi.ROLE_DIALOG:
isPageTabList = lambda x: x and x.getRole() == pyatspi.ROLE_PAGE_TAB_LIST
if pyatspi.findDescendant(child, isPageTabList):
return False
isComboBox = lambda x: x and x.getRole() == pyatspi.ROLE_COMBO_BOX
return pyatspi.findDescendant(child, isComboBox)
return False
开发者ID:GNOME,项目名称:orca,代码行数:17,代码来源:spellcheck.py
示例5: findMessageBodyChild
def findMessageBodyChild(self, root):
roles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
isDocument = lambda x: x and x.getRole() in roles
candidate = pyatspi.findDescendant(root, isDocument)
if self.isEmbeddedDocument(candidate):
return self.findMessageBodyChild(candidate)
return candidate
开发者ID:pvagner,项目名称:orca,代码行数:8,代码来源:script_utilities.py
示例6: _isCandidateWindow
def _isCandidateWindow(self, window):
if window and window.childCount and window.getRole() == pyatspi.ROLE_FRAME:
child = window[0]
if child.getRole() == pyatspi.ROLE_DIALOG:
isPageTabList = lambda x: x and x.getRole() == pyatspi.ROLE_PAGE_TAB_LIST
if not pyatspi.findDescendant(child, isPageTabList):
return True
return False
开发者ID:pvagner,项目名称:orca,代码行数:9,代码来源:spellcheck.py
示例7: _findErrorWidget
def _findErrorWidget(self, root):
isPanel = lambda x: x and x.getRole() == pyatspi.ROLE_PANEL
panel = pyatspi.findAncestor(self._changeToEntry, isPanel)
if not panel:
return None
isError = lambda x: x and x.getRole() == pyatspi.ROLE_LABEL \
and not ":" in x.name and not x.getRelationSet()
return pyatspi.findDescendant(panel, isError)
开发者ID:GNOME,项目名称:orca,代码行数:9,代码来源:spellcheck.py
示例8: searchObj
def searchObj(self, appname, ctrlname, elementname):
reg = pyatspi.Registry
desktop = reg.getDesktop(0)
app = pyatspi.findDescendant(desktop, lambda x: x.name == self.appname)
self.appname = app
if self.ctrlname != None and self.ctrlname.startswith("application"):
searchings = []
for i in desktop:
if i is not None:
searchings.append(i)
elif self.ctrlname == None:
searchings = pyatspi.findAllDescendants(self.appname, lambda x: x.name == self.elementname)
elif self.ctrlname == None and self.findtype == "find":
searchings = pyatspi.findDescendant(self.appname, lambda x: x.name == self.elementname)
else:
searchings = self.findFunc()
return searchings
开发者ID:cachen,项目名称:UIEsearching,代码行数:19,代码来源:Esearching.py
示例9: setup
def setup(self, test):
self._registry = pyatspi.Registry()
import time
self._desktop = self._registry.getDesktop(0)
print "--desktop len", len(self._desktop)
for i in self._desktop:
try:
print "-- object",i,i.getRole()
except:
pass
self._root = pyatspi.findDescendant (self._desktop, lambda x: x.name == "atspi-test-main" and x.getRole() == pyatspi.ROLE_APPLICATION)
print "--root", self._root
开发者ID:GNOME,项目名称:pyatspi2,代码行数:12,代码来源:actiontest.py
示例10: findFunc
def findFunc(self):
if self.findtype == 'find':
try:
searchings = [pyatspi.findDescendant(self.appname, lambda x: x.getRoleName() == self.ctrlname)]
except TypeError:
searchings = []
elif self.findtype == 'findAll':
try:
searchings = pyatspi.findAllDescendants(self.appname, lambda x: x.getRoleName() == self.ctrlname)
except TypeError:
searchings = []
return searchings
开发者ID:cachen,项目名称:UIEsearching,代码行数:13,代码来源:Esearching.py
示例11: _find_root_doc
def _find_root_doc(self, window_acc):
agent_id = self._get_agent()
pred = lambda x: False
if agent_id == self.AGENT_MOZILLA or agent_id ==self.AGENT_CHROME:
# Firefox
def pred(x):
p = x.parent
if p.getRole() == pyatspi.ROLE_INTERNAL_FRAME:
attribs = \
dict([a.split(':',1) for a in p.getAttributes()])
if 'browser' in attribs.get('tag', '') and \
p.getState().contains(pyatspi.STATE_SHOWING):
return True
return False
return pyatspi.findDescendant(window_acc, pred)
开发者ID:eeejay,项目名称:specular,代码行数:15,代码来源:speclenium_atspi.py
示例12: _generateChildWidget
def _generateChildWidget(self, obj, **args):
widgetRoles = [pyatspi.ROLE_CHECK_BOX,
pyatspi.ROLE_COMBO_BOX,
pyatspi.ROLE_PUSH_BUTTON,
pyatspi.ROLE_RADIO_BUTTON,
pyatspi.ROLE_SLIDER,
pyatspi.ROLE_TOGGLE_BUTTON]
isWidget = lambda x: x and x.getRole() in widgetRoles
# For GtkListBox, such as those found in the control center
if obj.parent and obj.parent.getRole() == pyatspi.ROLE_LIST_BOX:
widget = pyatspi.findDescendant(obj, isWidget)
if widget:
return self.generate(widget, includeContext=False)
return []
开发者ID:dmtrs32,项目名称:orca,代码行数:16,代码来源:generator.py
示例13: onFocusedChanged
def onFocusedChanged(self, event):
"""Callback for object:state-changed:focused accessibility events."""
if not event.detail1:
return
obj = event.source
try:
role = obj.getRole()
name = obj.name
except:
return
# The dialog will get presented when its first child gets focus.
if role == pyatspi.ROLE_DIALOG:
return
# We're getting a spurious focus claim from the gnome-shell window after
# the window switcher is used.
if role == pyatspi.ROLE_WINDOW:
return
if role == pyatspi.ROLE_MENU_ITEM and not name \
and not self.utilities.labelsForObject(obj):
isRealFocus = lambda x: x and x.getRole() == pyatspi.ROLE_SLIDER
descendant = pyatspi.findDescendant(obj, isRealFocus)
if descendant:
orca.setLocusOfFocus(event, descendant)
return
# This is to present dialog boxes which are, to the user, newly
# activated. And if something is claiming to be focused that is
# not in a dialog, that's good to know as well, so update our
# state regardless.
activeDialog, timestamp = self._activeDialog
if not activeDialog:
isDialog = lambda x: x and x.getRole() == pyatspi.ROLE_DIALOG
dialog = pyatspi.utils.findAncestor(obj, isDialog)
self._activeDialog = (dialog, time.time())
if dialog:
orca.setLocusOfFocus(None, dialog)
labels = self.utilities.unrelatedLabels(dialog)
for label in labels:
self._activeDialogLabels[hash(label)] = label.name
clutter.Script.onFocusedChanged(self, event)
开发者ID:GNOME,项目名称:orca,代码行数:46,代码来源:script.py
示例14: updateToPath
def updateToPath(self, app_name, path):
"""
Update the node with a new accessible by providing a tree path
in an application.
@param app_name: Application name.
@type app_name: string
@param path: The accessible path in the application.
@type path: list of integer
"""
acc = pyatspi.findDescendant(self.desktop, lambda x: x.name.lower() == app_name.lower(), breadth_first=True)
if acc is None:
return
while path:
child_index = path.pop(0)
try:
acc = acc[child_index]
except IndexError:
return
self.update(acc)
开发者ID:GunioRobot,项目名称:accerciser-mirror,代码行数:20,代码来源:node.py
示例15: isComboBoxWithToggleDescendant
def isComboBoxWithToggleDescendant(self, obj):
if not (obj and obj.getRole() == pyatspi.ROLE_COMBO_BOX):
return False
rv = self._isComboBoxWithToggleDescendant.get(hash(obj))
if rv is not None:
return rv
isToggle = lambda x: x and x.getRole() == pyatspi.ROLE_TOGGLE_BUTTON
for child in obj:
if child.getRole() != pyatspi.ROLE_FILLER:
continue
toggle = pyatspi.findDescendant(child, isToggle)
rv = toggle is not None
if toggle:
self._isToggleDescendantOfComboBox[hash(toggle)] = True
break
self._isComboBoxWithToggleDescendant[hash(obj)] = rv
return rv
开发者ID:GNOME,项目名称:orca,代码行数:22,代码来源:script_utilities.py
示例16: doesrowexist
def doesrowexist(self, window_name, object_name, row_text,
partial_match = False):
"""
Verify table cell value with given text
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_name: string
@param row_text: Row text to match
@type string
@param partial_match: Find partial match strings
@type boolean
@return: 1 on success 0 on failure.
@rtype: integer
"""
try:
obj = self._get_object(window_name, object_name)
def _searchString(acc):
try:
itext = acc.queryText()
except NotImplementedError:
return False
if partial_match:
return bool(re.search(row_text, itext.getText(0, -1),
re.M | re.U))
else:
return row_text == itext.getText(0, -1)
results = pyatspi.findDescendant(obj, _searchString)
return int(bool(results))
except:
return 0
开发者ID:nagappan,项目名称:ldtp2,代码行数:38,代码来源:table.py
示例17: _findErrorWidget
def _findErrorWidget(self, root):
isError = lambda x: x and x.getRole() == pyatspi.ROLE_TEXT and x.name \
and x.parent.getRole() != pyatspi.ROLE_COMBO_BOX
return pyatspi.findDescendant(root, isError)
开发者ID:pvagner,项目名称:orca,代码行数:4,代码来源:spellcheck.py
示例18: _findSuggestionsList
def _findSuggestionsList(self, root):
isTable = lambda x: x and x.getRole() == pyatspi.ROLE_TABLE \
and 'Selection' in x.get_interfaces()
return pyatspi.findDescendant(root, isTable)
开发者ID:GNOME,项目名称:orca,代码行数:4,代码来源:spellcheck.py
示例19: _findChangeToEntry
def _findChangeToEntry(self, root):
isEntry = lambda x: x and x.getRole() == pyatspi.ROLE_TEXT \
and x.getState().contains(pyatspi.STATE_SINGLE_LINE)
return pyatspi.findDescendant(root, isEntry)
开发者ID:GNOME,项目名称:orca,代码行数:4,代码来源:spellcheck.py
示例20: findMessageBodyChild
def findMessageBodyChild(self, root):
candidate = pyatspi.findDescendant(root, self.isDocument)
if self.isEmbeddedDocument(candidate):
return self.findMessageBodyChild(candidate)
return candidate
开发者ID:GNOME,项目名称:orca,代码行数:6,代码来源:script_utilities.py
注:本文中的pyatspi.findDescendant函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论