[ocrfeeder/langs: 7/15] Add the language settings to ConfigurationManager
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder/langs: 7/15] Add the language settings to ConfigurationManager
- Date: Tue, 5 Feb 2013 06:25:18 +0000 (UTC)
commit aba0e873e22a0f32b13b1be77107b2c1995dca3c
Author: Joaquim Rocha <jrocha igalia com>
Date: Mon Jan 28 15:51:01 2013 +0100
Add the language settings to ConfigurationManager
src/ocrfeeder/util/configuration.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/ocrfeeder/util/configuration.py b/src/ocrfeeder/util/configuration.py
index 6c5c402..504f37f 100644
--- a/src/ocrfeeder/util/configuration.py
+++ b/src/ocrfeeder/util/configuration.py
@@ -76,10 +76,10 @@ class ConfigurationManager(object):
ADJUST_BOXES_BOUNDS = 'adjust_boxes_bounds'
BOUNDS_ADJUSTMENT_SIZE = 'bounds_adjustment_size'
DESKEW_IMAGES_AFTER_ADDITION = 'deskew_images_after_addition'
+ LANGUAGE = 'language'
TEMPORARY_FOLDER = tempfile.mkdtemp(prefix = OCRFEEDER_COMPACT_NAME + '_')
-
DEFAULTS = {TEXT_FILL: (94, 156, 235, 150),
BOXES_STROKE: (94, 156, 235, 250),
IMAGE_FILL: (0, 183, 0, 150),
@@ -97,6 +97,7 @@ class ConfigurationManager(object):
DESKEW_IMAGES_AFTER_ADDITION: False,
UNPAPER_IMAGES_AFTER_ADDITION: False,
UNPAPER_EXTRA_OPTIONS: '',
+ LANGUAGE: locale.getdefaultlocale()[0].split('_')[0],
}
conf = dict(DEFAULTS)
@@ -275,6 +276,13 @@ class ConfigurationManager(object):
def setCleanText(self, clean_text):
self.setConf(self.CLEAN_TEXT, clean_text)
+ def getLanguage(self):
+ lang = self.getConf(self.LANGUAGE)
+ return lang
+
+ def setLanguage(self, language):
+ self.setConf(self.LANGUAGE, language)
+
def setAdjustBoxesBounds(self, adjust_boxes_bounds):
self.setConf(self.ADJUST_BOXES_BOUNDS, adjust_boxes_bounds)
@@ -407,3 +415,5 @@ class ConfigurationManager(object):
deskew_images_after_addition = property(getDeskewImagesAfterAddition,
setDeskewImagesAfterAddition)
+
+ language = property(getLanguage, setLanguage)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]