commit/instantTranslate: 3 new changesets

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Mon, 25 Nov 2013 11:21:55 -0000

3 new commits in instantTranslate:

https://bitbucket.org/nvdaaddonteam/instanttranslate/commits/a355dfb85caf/
Changeset:   a355dfb85caf
Branch:      None
User:        ABuffEr
Date:        2013-11-25 11:05:03
Summary:     Fixed a quoting error

Affected #:  1 file

diff --git a/addon/globalPlugins/instantTranslate/__init__.py 
b/addon/globalPlugins/instantTranslate/__init__.py
index da05cfc..6bc1a8a 100644
--- a/addon/globalPlugins/instantTranslate/__init__.py
+++ b/addon/globalPlugins/instantTranslate/__init__.py
@@ -56,7 +56,7 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
                lang_swap = 
_config.instanttranslateConfig['translation']['swap']
                copyTranslation = autoSwap = isAutoSwapped = False
                # determine whether to copy translation on clipboard
-               if 
_config.instanttranslateConfig['settings']['copytranslatedtext'] == 'true"':
+               if 
_config.instanttranslateConfig['settings']['copytranslatedtext'] == 'true':
                        copyTranslation = True
                # determine whether to swap automatically lang_swap and target 
language, if source recognized equal to the target
                if _config.instanttranslateConfig['settings']['autoswap'] == 
'true':


https://bitbucket.org/nvdaaddonteam/instanttranslate/commits/33f1472ea330/
Changeset:   33f1472ea330
Branch:      None
User:        ABuffEr
Date:        2013-11-25 12:17:49
Summary:     Fixed: boolean values returned from config must be compared to 
string values with first capitalized letter

Affected #:  1 file

diff --git a/addon/globalPlugins/instantTranslate/__init__.py 
b/addon/globalPlugins/instantTranslate/__init__.py
index 6bc1a8a..912fd7e 100644
--- a/addon/globalPlugins/instantTranslate/__init__.py
+++ b/addon/globalPlugins/instantTranslate/__init__.py
@@ -26,6 +26,7 @@ from time import sleep
 import threading
 import _config
 import addonHandler
+
 _config.load()
 _addonDir = os.path.join(os.path.dirname(__file__), "..", "..").decode("mbcs")
 _curAddon = addonHandler.Addon(_addonDir)
@@ -56,13 +57,13 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
                lang_swap = 
_config.instanttranslateConfig['translation']['swap']
                copyTranslation = autoSwap = isAutoSwapped = False
                # determine whether to copy translation on clipboard
-               if 
_config.instanttranslateConfig['settings']['copytranslatedtext'] == 'true':
+               if 
_config.instanttranslateConfig['settings']['copytranslatedtext'] == 'True':
                        copyTranslation = True
                # determine whether to swap automatically lang_swap and target 
language, if source recognized equal to the target
-               if _config.instanttranslateConfig['settings']['autoswap'] == 
'true':
+               if _config.instanttranslateConfig['settings']['autoswap'] == 
'True':
                        autoSwap = True
                # keep track if there was a swapping from source=auto during 
previous NVDA session
-               if _config.instanttranslateConfig['temporary']['isautoswapped'] 
== 'true':
+               if _config.instanttranslateConfig['temporary']['isautoswapped'] 
== 'True':
                        isAutoSwapped = True
 
        def createMenu(self):


https://bitbucket.org/nvdaaddonteam/instanttranslate/commits/044e5fce465c/
Changeset:   044e5fce465c
Branch:      configRefactor
User:        ABuffEr
Date:        2013-11-25 12:21:21
Summary:     Fixed lang_to problem using format method, such as in urlTemplate

Affected #:  2 files

diff --git a/addon/globalPlugins/instantTranslate/_config.py 
b/addon/globalPlugins/instantTranslate/_config.py
index a537116..fc18f00 100644
--- a/addon/globalPlugins/instantTranslate/_config.py
+++ b/addon/globalPlugins/instantTranslate/_config.py
@@ -6,8 +6,8 @@ import globalVars
 from logHandler import log
 from locale import getdefaultlocale
 
-INSTANTTRANSLATE_CONFIG_FILENAME = "instanttranslate.ini"
-lo_lang = getdefaultlocale () # get a language of the OS localization.
+INSTANTTRANSLATE_CONFIG_FILENAME = "instantTranslate.ini"
+lo_lang = getdefaultlocale() # get a language of the OS localization.
 s = lo_lang[0] # get the first element of the tuplet.
 lo_lang = s[0:s.find("_")] # get the default language which is translated into.
 
@@ -16,22 +16,20 @@ instanttranslateConfig = None
 _configSpec = """
 [translation]
 from = string(default=auto)
-into = string(default=lo_lang)
+into = string(default={lo_lang})
 swap = string(default=en)
-
 [settings]
 copytranslatedtext = boolean(default=true)
 autoswap = boolean(default=true)
-
 [temporary]
 isautoswapped = boolean(default=false)
 """
 
 def load():
        global instanttranslateConfig
-       if not instanttranslateConfig:
+       if instanttranslateConfig is None:
                path = os.path.join(globalVars.appArgs.configPath, 
INSTANTTRANSLATE_CONFIG_FILENAME)
-               instanttranslateConfig = configobj.ConfigObj(path, 
configspec=StringIO(_configSpec), encoding="utf-8")
+               instanttranslateConfig = configobj.ConfigObj(path, 
configspec=StringIO(_configSpec.format(lo_lang=lo_lang)), encoding="utf-8")
                instanttranslateConfig.newlines = "\r\n"
                instanttranslateConfig.stringify = True
                val = Validator()
@@ -41,8 +39,8 @@ def load():
 
 def save():
        global instanttranslateConfig
-       if not instanttranslateConfig:
+       if instanttranslateConfig is None:
                raise RuntimeError("Instant Translate config is not loaded.")
        val = Validator()
        instanttranslateConfig.validate(val, copy=True)
-       instanttranslateConfig.write()
\ No newline at end of file
+       instanttranslateConfig.write()

diff --git a/addon/globalPlugins/instantTranslate/interface.py 
b/addon/globalPlugins/instantTranslate/interface.py
index c313d14..8b3b278 100644
--- a/addon/globalPlugins/instantTranslate/interface.py
+++ b/addon/globalPlugins/instantTranslate/interface.py
@@ -15,10 +15,10 @@ import globalVars
 import config
 import _config
 import addonHandler
+
 _config.load()
 addonHandler.initTranslation()
 
-
 class InstantTranslateSettingsDialog(gui.SettingsDialog):
        # Translators: name of the dialog.
        title = _("Instant Translate Settings")

Repository URL: https://bitbucket.org/nvdaaddonteam/instanttranslate/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

Other related posts: