[ocrfeeder] Toggle areas' selection menus according to the areas' existence (gb#622568)



commit 6798062a8447d12a2ac936d20960cf0fe07f1b3a
Author: Joaquim Rocha <jrocha igalia com>
Date:   Thu Jun 24 16:56:57 2010 +0200

    Toggle areas' selection menus according to the areas' existence (gb#622568)

 studio/studioBuilder.py   |    1 +
 studio/widgetModeler.py   |    4 +++-
 studio/widgetPresenter.py |    4 ++++
 3 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/studio/studioBuilder.py b/studio/studioBuilder.py
index 922c0e4..d81bdf8 100644
--- a/studio/studioBuilder.py
+++ b/studio/studioBuilder.py
@@ -108,6 +108,7 @@ class Studio:
             self.__addImagesToReviewer(lib.getImagesFromFolder(dirs[0]))
         
         self.main_window.setHasSelectedBoxes(False)
+        self.main_window.setHasContentBoxes(False)
         self.main_window.setHasImages(not self.source_images_selector.isEmpty())
 
         # Show dialog to choose system-wide OCR engines when no engine was found
diff --git a/studio/widgetModeler.py b/studio/widgetModeler.py
index 20c8c30..6028ffa 100644
--- a/studio/widgetModeler.py
+++ b/studio/widgetModeler.py
@@ -351,8 +351,10 @@ class ImageReviewer:
 
     def updateMainWindow(self):
         has_selected_areas = self.selectable_boxes_area.getSelectedAreas()
+        has_boxes = self.selectable_boxes_area.getAllAreas()
         self.main_window.setHasSelectedBoxes(bool(has_selected_areas))
-    
+        self.main_window.setHasContentBoxes(bool(has_boxes))
+
 class ImageReviewer_Controler:
     
     def __init__(self, main_window, images_dict, source_images_selector_widget,
diff --git a/studio/widgetPresenter.py b/studio/widgetPresenter.py
index bc4b00d..a238707 100644
--- a/studio/widgetPresenter.py
+++ b/studio/widgetPresenter.py
@@ -214,6 +214,10 @@ class MainWindow:
         actions = ['RecognizeAreas']
         self.__setActionsSensitiveness(actions, has_selected_boxes)
 
+    def setHasContentBoxes(self, has_content_boxes=True):
+        actions = ['SelectNextArea', 'SelectPreviousArea']
+        self.__setActionsSensitiveness(actions, has_content_boxes)
+
     def __setActionsSensitiveness(self, actions, set_sensitive):
         for gtkaction in [self.action_group.get_action(action) \
                           for action in actions]:



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