c0c828440daeb4acb9036f90a84f284c25759d17
[platform/core/uifw/at-spi2-atk.git] / pyatspi / application.py
1 #Copyright (C) 2008 Codethink Ltd
2
3 #This library is free software; you can redistribute it and/or
4 #modify it under the terms of the GNU Lesser General Public
5 #License version 2 as published by the Free Software Foundation.
6
7 #This program is distributed in the hope that it will be useful,
8 #but WITHOUT ANY WARRANTY; without even the implied warranty of
9 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 #GNU General Public License for more details.
11 #You should have received a copy of the GNU Lesser General Public License
12 #along with this program; if not, write to the Free Software
13 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14
15 import interfaces
16 from base import BaseProxy
17 from factory import add_accessible_class
18 from accessible import Accessible
19
20 __all__ = [
21            "Application",
22           ]
23
24 #------------------------------------------------------------------------------
25
26 class Application(Accessible):
27     """
28     An interface identifying an object which is the root of the user
29     interface Accessible hierarchy associated with a running application.
30     Children of Application are typically, but not exclusively, top-level
31     windows.
32     """
33     
34     def getLocale(self, *args, **kwargs):
35         """
36         Gets the locale in which the application is currently operating.
37         For the current message locale, use lctype LOCALE_TYPE_MESSAGES.
38         @param : lctype
39         The LocaleType for which the locale is queried. 
40         @return a string compliant with the POSIX standard for locale
41         description.
42         """
43         func = self.get_dbus_method("getLocale")
44         return func(*args, **kwargs)
45     
46     def pause(self, *args, **kwargs):
47         """
48         Request that the application temporarily stop sending events.
49         In most cases this should pause the application's main event
50         loop.
51         @return : true if the request succeeded, false otherwise.
52         """
53         func = self.get_dbus_method("pause")
54         return func(*args, **kwargs)
55     
56     def registerObjectEventListener(self, *args, **kwargs):
57         """
58         registerObjectEventListener: 
59         @param : listener
60         an EventListener object which will receive the requested events
61         @param : eventName
62         a UTF-8 string indicating the type of (toolkit-specific) event
63         being requested. Register with this application toolkit for "Accessibility::Accessible"
64         event notifications.
65         """
66         func = self.get_dbus_method("registerObjectEventListener")
67         return func(*args, **kwargs)
68     
69     def registerToolkitEventListener(self, *args, **kwargs):
70         """
71         @param : listener
72         an EventListener object which will receive the requested events
73         from the application's toolkits via toolit 'bridges' 
74         @param : eventName
75         a UTF-8 string indicating the type of (toolkit-specific) event
76         being requested. Not all applications can generate toolkit events
77         of a given type.
78         Register with this application's toolkit for "toolkit-specific"
79         event notifications.
80         """
81         func = self.get_dbus_method("registerToolkitEventListener")
82         return func(*args, **kwargs)
83     
84     def resume(self, *args, **kwargs):
85         """
86         Request that the application resume sending events.
87         @return : True if the request succeeded, False otherwise.
88         """
89         func = self.get_dbus_method("resume")
90         return func(*args, **kwargs)
91     
92     def get_id(self):
93         self._pgetter(self._dbus_interface, "id")
94     def set_id(self, value):
95         self._psetter(self._dbus_interface, "id", value)
96     _idDoc = \
97         """
98         The application instance's unique ID as assigned by the registry.
99         """
100     id = property(fget=get_id, fset=set_id, doc=_idDoc)
101     
102     def get_toolkitName(self):
103         self._pgetter(self._dbus_interface, "toolkitName")
104     def set_toolkitName(self, value):
105         self._psetter(self._dbus_interface, "toolkitName", value)
106     _toolkitNameDoc = \
107         """
108         A string indicating the type of user interface toolkit which
109         is used by the application.
110         """
111     toolkitName = property(fget=get_toolkitName, fset=set_toolkitName, doc=_toolkitNameDoc)
112     
113     def get_version(self):
114         self._pgetter(self._dbus_interface, "version")
115     def set_version(self, value):
116         self._psetter(self._dbus_interface, "version", value)
117     _versionDoc = \
118         """
119         A string indicating the version number of the application's accessibility
120         bridge implementation.
121         """
122     version = property(fget=get_version, fset=set_version, doc=_versionDoc)
123
124 # ATTENTION - Register the Application class with the accessible factory.
125 add_accessible_class(interfaces.ATSPI_APPLICATION, Application)
126
127 #END----------------------------------------------------------------------------