Commit 6817c167 authored by kuchune's avatar kuchune

add search AccessibleValue-related properties with description

parent 35fcc29d
Pipeline #211196245 failed with stages
in 0 seconds
......@@ -104,15 +104,19 @@ class Predicate(object):
class IsAnApplicationNamed(Predicate):
"""Search subclass that looks for an application by name"""
def __init__(self, appName):
def __init__(self, appName, description=None):
self.appName = TranslatableString(appName)
self.debugName = self.describeSearchResult()
self.satisfiedByNode = self._genCompareFunc()
self.description = TranslatableString(description)
def _genCompareFunc(self):
def satisfiedByNode(node):
try:
return node.roleName == 'application' and stringMatches(self.appName, node.name)
if self.description == None:
return node.roleName == 'application' and stringMatches(self.appName, node.name)
else:
return node.roleName == 'application' and stringMatches(self.appName, node.name) and stringMatches(self.description, node.description)
except GLib.GError as e:
if re.match(r"name :[0-9]+\.[0-9]+ was not provided", e.message):
logger.log("Dogtail: warning: omiting possibly broken at-spi application record")
......
......@@ -1170,7 +1170,7 @@ class Root (Node):
"""
return root.findChildren(predicate.GenericPredicate(roleName="application"), recursive=False, showingOnly=False)
def application(self, appName, retry=True):
def application(self, appName, description='', retry=True):
"""
Gets an application by name, returning an Application instance
or raising an exception.
......@@ -1179,7 +1179,7 @@ class Root (Node):
if no such child is found, and will eventually raise an exception. It
also logs the search.
"""
return root.findChild(predicate.IsAnApplicationNamed(appName), recursive=False, retry=retry, showingOnly=False)
return root.findChild(predicate.IsAnApplicationNamed(appName, description), recursive=False, retry=retry, showingOnly=False)
class Application (Node):
......
......@@ -79,16 +79,16 @@ Vitezslav Humpa <vhumpa@redhat.com>""",
packages=['dogtail'],
scripts=scripts(),
data_files=[
('share/doc/dogtail/examples',
('EGG-INFO/share/doc/dogtail/examples',
examples()),
('share/doc/dogtail/examples/data',
('EGG-INFO/share/doc/dogtail/examples/data',
examples_data()),
('share/doc/dogtail/tests',
('EGG-INFO/share/doc/dogtail/tests',
tests()),
('share/dogtail/glade', ['sniff/sniff.ui']),
('share/dogtail/icons', sniff_icons()),
('share/applications', ['sniff/sniff.desktop']),
('share/icons/hicolor/scalable/apps', icons('svg'))
('EGG-INFO/share/dogtail/glade', ['sniff/sniff.ui']),
('EGG-INFO/share/dogtail/icons', sniff_icons()),
('EGG-INFO/share/applications', ['sniff/sniff.desktop']),
('EGG-INFO/share/icons/hicolor/scalable/apps', icons('svg'))
],
options = {
'build_scripts': {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment