[ocrfeeder] Disable unpaper frame in sandbox mode



commit e9bc06fea01b8e6ad6d58673682229c9185ea78a
Author: scx <scx mail gmail com>
Date:   Mon Jan 28 00:43:35 2019 +0100

    Disable unpaper frame in sandbox mode

 configure.ac                            | 12 ++++++++++++
 src/ocrfeeder/studio/widgetPresenter.py | 16 +++++++++++-----
 src/ocrfeeder/util/constants.py.in      |  2 ++
 3 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6f26110..cda459f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,18 @@ AM_MAINTAINER_MODE([enable])
 # to configure or passing V=1 to make
 AM_SILENT_RULES([yes])
 
+dnl == define if sandbox mode is enabled ==
+AC_ARG_ENABLE([sandbox],
+       AS_HELP_STRING([--enable-sandbox], [Enable sandbox mode]),
+       [enable_sandbox="$enableval"],
+       [enable_sandbox="no"])
+
+AS_IF([test "x$enable_sandbox" = "xyes"], [
+       AC_SUBST([SANDBOX], [True])
+], [
+       AC_SUBST([SANDBOX], [False])
+])
+
 dnl == check for python ==
 AM_PATH_PYTHON(2.5)
 
diff --git a/src/ocrfeeder/studio/widgetPresenter.py b/src/ocrfeeder/studio/widgetPresenter.py
index f230cfd..07ddddd 100644
--- a/src/ocrfeeder/studio/widgetPresenter.py
+++ b/src/ocrfeeder/studio/widgetPresenter.py
@@ -1317,15 +1317,20 @@ class PreferencesDialog(Gtk.Dialog):
         self.ocr_engines = ocr_engines
         self.notebook = Gtk.Notebook()
         self.__makeGeneralPreferences(self.__makeColors())
-        self.__makeToolsPreferences(self.__makeUnpaper(),
-                                    self.__makeEngines(),
-                                    self.__makePreProcessorPreferences())
+        if not OCRFEEDER_SANDBOX:
+            self.__makeToolsPreferences(self.__makeUnpaper(),
+                                        self.__makeEngines(),
+                                        self.__makePreProcessorPreferences())
+        else:
+            self.__makeToolsPreferences(self.__makeEngines(),
+                                        self.__makePreProcessorPreferences())
         self.__makeRecognitionPreferences(self.__makeLanguagePreferences(),
                                       self.__makeTextPreferences(),
                                       self.__makeWindowSize(),
                                       self.__makeColumnDetectionPreferences(),
                                       self.__makeBoundsAdjustmentsPreferences())
-        self.unpaper_select.connect('clicked', self.__unpaperSelectDialog)
+        if not OCRFEEDER_SANDBOX:
+            self.unpaper_select.connect('clicked', self.__unpaperSelectDialog)
         self.custom_window_size.connect('toggled', self.__toggledCustomWindowSize)
         self.vbox.add(self.notebook)
         self.set_size_request(*self.PREFERENCES_DIALOG_SIZE)
@@ -1346,7 +1351,8 @@ class PreferencesDialog(Gtk.Dialog):
         self.configuration_manager.setBoxesStroke(
             self.__getColor(self.boxes_stroke_color))
         self.configuration_manager.setImageFill(self.__getColor(self.image_fill_color))
-        self.configuration_manager.setUnpaper(self.unpaper_entry.get_text())
+        if not OCRFEEDER_SANDBOX:
+            self.configuration_manager.setUnpaper(self.unpaper_entry.get_text())
         self.configuration_manager.improve_column_detection = \
             self.improve_column_detection.get_active()
         self.configuration_manager.column_min_width = self.__getColumnMinWidth()
diff --git a/src/ocrfeeder/util/constants.py.in b/src/ocrfeeder/util/constants.py.in
index 3e9210a..4219024 100644
--- a/src/ocrfeeder/util/constants.py.in
+++ b/src/ocrfeeder/util/constants.py.in
@@ -98,3 +98,5 @@ OCRFEEDER_MENUBAR_UI = os.path.join(RESOURCES_DIR, 'menubar.ui')
 ISO_CODES_PATH = '/usr/share/xml/iso-codes/'
 
 APP_ID = 'org.gnome.OCRFeeder'
+
+OCRFEEDER_SANDBOX = @SANDBOX@


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