strongwind r28 - in trunk: . strongwind



Author: bgmerrell
Date: Thu Jan 15 23:31:26 2009
New Revision: 28
URL: http://svn.gnome.org/viewvc/strongwind?rev=28&view=rev

Log:
* strongwind/accessibles.py: Implement insertText and deleteText
methods from IAccessibleEditableText. (#567884)


Modified:
   trunk/ChangeLog
   trunk/strongwind/accessibles.py

Modified: trunk/strongwind/accessibles.py
==============================================================================
--- trunk/strongwind/accessibles.py	(original)
+++ trunk/strongwind/accessibles.py	Thu Jan 15 23:31:26 2009
@@ -393,6 +393,40 @@
             rv = getattr(gtk.keysyms, key)
         return rv
 
+    def insertText(self, text, offset=0, log=True):
+        '''
+        Insert the specified text into an editable text accessible using
+        an optional offset from the first index of the accessible.  This method
+        uses the IAccessibleEditableText insertText method to insert the
+        specified text.
+        '''
+
+        if log:
+            procedurelogger.action('Enter "%s" into %s.' % (text, self), self)
+
+        ieditable = self._accessible.queryEditableText()
+        ieditable.insertText(offset, text, len(text)) 
+
+    def deleteText(self, start=0, end=None, log=True):
+        '''
+        Delete the text of an editable text accessible.  By default all text is
+        deleted.  Optionally, a start and end index can be specified to delete
+        a range of text.  This method uses the IAccessibleEditableText
+        deleteText method to delete the text.
+        '''
+
+        ieditable = self._accessible.queryEditableText()
+
+        if end is None:
+            end = ieditable.characterCount
+
+        text = ieditable.getText(start, end)
+
+        if log:
+            procedurelogger.action('Delete "%s" from %s.' % (text, self), self)
+
+        ieditable.deleteText(start, end)
+
     # adapted from script_playback.py, originally named type
     def typeText(self, text, log=True):
         'Turns text (a string) into a series of keyboard events'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]