Skip to content

Commit

Permalink
锁定取词
Browse files Browse the repository at this point in the history
  • Loading branch information
bjzhangxin committed Jun 7, 2014
1 parent b899c2d commit 1f4d9ba
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cache/expand.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h3 style="text-align: center">汉英互译 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<h3 style="text-align: center">汉日互译 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %zh2jap%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汉日例句 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;%zh2japlj% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;使用说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%helps%<h3>
<h3 style="text-align: center">汉韩互译 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %zh2ko%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汉韩例句 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;%zh2kolj% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;退出程序&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%exits%<h3>
<h3 style="text-align: center">&nbsp;&nbsp;汉法互译 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %zh2fr%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汉法例句 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;%zh2frlj% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;展开选项&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%expand%<h3>
<h3 style="text-align: center">谷歌翻译 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %goslate% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;维基百科 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;%Wikipedia% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;豆瓣读书&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %douban%<h3>
<h3 style="text-align: center">谷歌翻译 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %goslate% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;锁定取词 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;%lock% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;豆瓣读书&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %douban%<h3>
</div>
</body>
</html>
15 changes: 15 additions & 0 deletions cache/lock.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE HTML>
<html class="ua-ch ua-ch-28 ua-wk ua-linux">
<head>
<meta charset="utf-8"/>
<meta name="description" content=""/>
<link href="/usr/share/openyoudao/css/entry-min.css" type="text/css" rel="stylesheet"/>
<link href="/usr/share/openyoudao/css/pad.css" media="screen and (orientation: portrait), screen and (orientation: landscape)" rel="stylesheet" type="text/css">
<title>Openyoudao首页</title>
</head>
<body>
<div id="w">
<h2 style="text-align: center">取词功能已锁定,解锁请抹黑:%lock%<h2>
</div>
</body>
</html>
16 changes: 16 additions & 0 deletions cache/unlock.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE HTML>
<html class="ua-ch ua-ch-28 ua-wk ua-linux">
<head>
<meta charset="utf-8"/>
<meta name="description" content=""/>
<link href="/usr/share/openyoudao/css/entry-min.css" type="text/css" rel="stylesheet"/>
<link href="/usr/share/openyoudao/css/pad.css" media="screen and (orientation: portrait), screen and (orientation: landscape)" rel="stylesheet" type="text/css">
<title>Openyoudao首页</title>
</head>
<body>
<div id="w">
<h2 style="text-align: center">取词功能已解锁,请选择待翻译的词语,或返回首页<h2>
<h2 style="text-align: center">%index%<h2>
</div>
</body>
</html>
3 changes: 2 additions & 1 deletion gl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
global headyoudao
global bodystartyoudao
import locale

#[config]
lock="0"
#[youdao config]
pre_text=""
locale=locale.getdefaultlocale()
Expand Down
12 changes: 11 additions & 1 deletion openyoudao.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand Down Expand Up @@ -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 = ""
Expand All @@ -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:
Expand Down

0 comments on commit 1f4d9ba

Please sign in to comment.