dogtail r375 - in trunk: . dogtail
- From: zcerza svn gnome org
- To: svn-commits-list gnome org
- Subject: dogtail r375 - in trunk: . dogtail
- Date: Mon, 21 Jan 2008 16:32:39 +0000 (GMT)
Author: zcerza
Date: Mon Jan 21 16:32:39 2008
New Revision: 375
URL: http://svn.gnome.org/viewvc/dogtail?rev=375&view=rev
Log:
* dogtail/wrapped.py: Add dogtail.wrapped module, with superclasses
for Node and Application wrappers to use in custom application wrappers. We
need this because dogtail.tree.{Node,Application} are no longer wrapper
classes, and thus can't be subclasses directly.
Added:
trunk/dogtail/wrapped.py
Modified:
trunk/ChangeLog
Added: trunk/dogtail/wrapped.py
==============================================================================
--- (empty file)
+++ trunk/dogtail/wrapped.py Mon Jan 21 16:32:39 2008
@@ -0,0 +1,32 @@
+"""
+Superclasses for application wrappers
+
+Subclass these classes if you want to create application wrappers, e.g.:
+http://svn.gnome.org/viewvc/dogtail-tests/trunk/appwrappers/dogtail/appwrappers/gedit.py?view=markup
+"""
+__author__ = "Zack Cerza <zcerza redhat com>"
+import tree
+import Accessibility
+
+def makeWrapperClass(wrappedClass, name):
+ class klass(object):
+ def __init__(self, obj):
+ self.obj = obj
+
+ def __getattr__(self, name):
+ if name == 'obj': return self.__dict__['obj']
+ return getattr(self.obj, name)
+
+ def __setattr__(self, name, value):
+ if name == 'obj':
+ self.__dict__['obj'] = value
+ else:
+ return setattr(self.obj, name, value)
+
+ klass.__name__ = name
+ return klass
+
+Application = makeWrapperClass(Accessibility.Application, \
+ "WrappedApplication")
+Node = makeWrapperClass(Accessibility.Accessible, "WrappedNode")
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]