[ocrfeeder] Focus box's editor text area automatically (gb#635308)



commit 2381f9d44d341d51301de2ddf10462a8b6ac36a4
Author: Joaquim Rocha <jrocha igalia com>
Date:   Wed May 11 12:09:53 2011 +0200

    Focus box's editor text area automatically (gb#635308)
    
    When selecting the next or previous area/box, now its text area gets
    automatically focused. This change should improve the usability
    especially for visually impaired users who are now able to quickly
    check what is the text assigned to a text area.

 src/ocrfeeder/studio/widgetModeler.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/ocrfeeder/studio/widgetModeler.py b/src/ocrfeeder/studio/widgetModeler.py
index 52884b6..0e2cfad 100644
--- a/src/ocrfeeder/studio/widgetModeler.py
+++ b/src/ocrfeeder/studio/widgetModeler.py
@@ -410,6 +410,13 @@ class ImageReviewer:
         self.main_window.setHasSelectedBoxes(bool(has_selected_areas))
         self.main_window.setHasContentBoxes(bool(has_boxes))
 
+    def focusCurrentEditorTextArea(self):
+        current_page = self.boxeditor_notebook.get_current_page()
+        if current_page == -1:
+            return
+        box_editor = self.boxeditor_notebook.get_nth_page(current_page)
+        box_editor.text_widget.grab_focus()
+
 class ImageReviewer_Controler:
 
     def __init__(self, main_window, source_images_selector_widget,
@@ -861,10 +868,12 @@ class ImageReviewer_Controler:
     def selectPreviousArea(self, widget):
         current_reviewer = self.__getCurrentReviewer()
         current_reviewer.selectable_boxes_area.selectPreviousArea()
+        current_reviewer.focusCurrentEditorTextArea()
 
     def selectNextArea(self, widget):
         current_reviewer = self.__getCurrentReviewer()
         current_reviewer.selectable_boxes_area.selectNextArea()
+        current_reviewer.focusCurrentEditorTextArea()
 
     def selectAllAreas(self, widget):
         current_reviewer = self.__getCurrentReviewer()



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