s: @classmethod
def validate_dbus_object(cls, path, _state):
"""Return whether this class is the appropriate proxy object class for
a given dbus path and state.
The default version matches the name of the dbus object and the class.
Subclasses of CustomProxyObject can override it to define a different
validation method.
:param path: The dbus path of the object to check
:param state: The dbus state dict of the object to check
(ignored in default implementation)
:returns: Whether this class is appropriate for the dbus object
"""
state_name = xpathselect.get_classname_from_path(path)
if isinstance(state_name, str):
state_name = state_name.encode('utf-8')
class_name = cls.__name__.encode('utf-8')
return state_name == class_name
b: (<class 'address_book_app.pages._common.PageWithHeader'>, <class 'address_book_app.pages._common.PageWithBottomEdge'>)
s: @classmethod
def validate_dbus_object(cls, path, state):
name = introspection.get_classname_from_path(path)
return (name == b'webbrowser-app' and
state['applicationName'][1] == 'webbrowser-app')
b: (<class 'address_book_app.AddressBookApp'>, <class 'address_book_app.pages._common.PageWithBottomEdge'>, <class 'autopilot.introspection.qt.QtObjectProxyMixin'>, <class 'address_book_app.pages._common.PageWithHeader'>)
s: @classmethod
def validate_dbus_object(cls, path, state):
name = introspection.get_classname_from_path(path)
return (name == b'webbrowser-app' and
state['applicationName'][1] == 'webbrowser-app')
b: (<class 'address_book_app.AddressBookApp'>, <class 'address_book_app.pages._common.PageWithBottomEdge'>, <class 'autopilot.introspection.qt.QtObjectProxyMixin'>, <class 'address_book_app.pages._common.PageWithHeader'>)