diff --git a/cache/expand.html b/cache/expand.html index fbed998..1017630 100755 --- a/cache/expand.html +++ b/cache/expand.html @@ -15,7 +15,7 @@

汉英互译       

汉日互译            %zh2jap%         汉日例句               %zh2japlj%               使用说明               %helps%

汉韩互译            %zh2ko%           汉韩例句               %zh2kolj%               退出程序               %exits%

  汉法互译            %zh2fr%           汉法例句               %zh2frlj%                 展开选项               %expand%

-

谷歌翻译            %goslate%          维基百科               %Wikipedia%               豆瓣读书           %douban%

+

谷歌翻译            %goslate%          锁定取词               %lock%               豆瓣读书           %douban%

diff --git a/cache/lock.html b/cache/lock.html new file mode 100755 index 0000000..9637664 --- /dev/null +++ b/cache/lock.html @@ -0,0 +1,15 @@ + + + + + + + + Openyoudao首页 + + +
+

取词功能已锁定,解锁请抹黑:%lock%

+

+ + diff --git a/cache/unlock.html b/cache/unlock.html new file mode 100755 index 0000000..2995d70 --- /dev/null +++ b/cache/unlock.html @@ -0,0 +1,16 @@ + + + + + + + + Openyoudao首页 + + +
+

取词功能已解锁,请选择待翻译的词语,或返回首页

+

%index%

+

+ + diff --git a/gl.py b/gl.py index a3fdef4..7a92c64 100644 --- a/gl.py +++ b/gl.py @@ -10,7 +10,8 @@ global headyoudao global bodystartyoudao import locale - +#[config] +lock="0" #[youdao config] pre_text="" locale=locale.getdefaultlocale() diff --git a/openyoudao.py b/openyoudao.py index ee9541f..e7398c2 100755 --- a/openyoudao.py +++ b/openyoudao.py @@ -42,7 +42,7 @@ def record_callback(reply): pipe.close() print "您选取的是: ", text text = text.strip('\r\n\x00').lower().strip() - if(gl.pre_text != text and text!=""): + if(gl.pre_text != text and text!=""and gl.lock=="0" or text=="%lock%"): url = "" gl.pre_text = text if(False==os.path.exists(gl.cachedir)): @@ -93,6 +93,8 @@ def record_callback(reply): gl.searchurl=gl.zh2fr url = "" gl.Dict="youdao" + + #config elif "%index%" in text: gl.homeurl="file:///usr/share/openyoudao/config.html" url = "" @@ -109,6 +111,14 @@ def record_callback(reply): elif "%expand%" in text: gl.homeurl="file:///usr/share/openyoudao/expand.html" url = "" + elif "%lock%" in text: + if gl.lock=="0": + gl.lock="1" + gl.homeurl="file:///usr/share/openyoudao/lock.html" + else: + gl.lock="0" + gl.homeurl="file:///usr/share/openyoudao/unlock.html" + url = "" elif "%exits%" in text: Alive=0 else: