[ocrfeeder] Hide import pdf and unpaper menus if the respective commands are not available



commit a658953d4b5929927704a53a5a1e8e04d472e97a
Author: Joaquim Rocha <jrocha igalia com>
Date:   Fri Jan 22 16:24:24 2010 +0100

    Hide import pdf and unpaper menus if the respective commands are not available

 studio/widgetPresenter.py |    8 ++++++++
 util/constants.py         |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/studio/widgetPresenter.py b/studio/widgetPresenter.py
index 821eaa9..2f942b2 100644
--- a/studio/widgetPresenter.py
+++ b/studio/widgetPresenter.py
@@ -173,6 +173,14 @@ class MainWindow:
         detection_icon = gtk.image_new_from_file(DETECT_ICON)
         detection_icon.show()
         detection_button.set_icon_widget(detection_icon)
+        
+        if not lib.getExecPath(UNPAPER_COMMAND):
+            unpaper_menu = ui_manager.get_widget('/MenuBar/Tools/Unpaper')
+            unpaper_menu.hide()
+        if not lib.getExecPath(GHOSTSCRIPT_COMMAND):
+            import_pdf_menu = ui_manager.get_widget('/MenuBar/File/ImportPDF')
+            import_pdf_menu.hide()
+
         self.action_group = action_group
     
     def setDestroyEvent(self, function):
diff --git a/util/constants.py b/util/constants.py
index 4e28f3c..45cd074 100644
--- a/util/constants.py
+++ b/util/constants.py
@@ -85,3 +85,6 @@ if os.environ.get(_OCRFEEDER_TEST_MODE):
 OCRFEEDER_DEBUG = False
 if os.environ.get(_OCRFEEDER_DEBUG_MODE):
     OCRFEEDER_DEBUG = True
+    
+UNPAPER_COMMAND = 'unpaper'
+GHOSTSCRIPT_COMMAND = 'gs'



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