Giter Site home page Giter Site logo

gouyong's Introduction

##这是一个Linux词典应用程序,目标够用就好!

####欢迎大家一起改进开发,让够用越来越够用,用起来越来越舒服。 (在线翻译资源来自互联网,版权属于相关网站)

图例:

在线:

image

离线:

image

Features:

  1. 结合ButtonRelease和owner-change实现了X window下的最优取词机制,避免了像stardict一样不能再次取同一个词,和像openyoudao一样影响复制且影响其他程序对剪贴板的使用。
  2. 托盘可以暂停取词,还可以切换离线,在线模式。
  3. 自动调整弹出窗口的位置,鼠标远离窗口一定范围时窗口自动关闭。

TODO:

  • 顺畅自如的选词弹窗翻译;
  • 简洁的操作,酷炫的UI;
  • 离线词典;
  • OCR图像取词翻译;
  • 性能优化;
  • 打包,软件源部署.

依赖:

  1. python-gi 3.12
  2. python-xlib
  3. gir1.2-appindicator3-0.1
  4. gir1.2-webkit-3.0
  5. python-marisa-trie

进度:

  1. 选词翻译基本达成。2014年 08月 25日 星期一 14:58:23 CST
  2. 顺畅选词弹窗网络翻译达成。2014年 08月 31日 星期日 17:29:26 CST
  3. 离线词典使用StarDict词库达成。2014年 09月 03日 星期三 17:10:44 CST
  4. 初步优化性能。2014年 09月 07日 星期日 18:30:23 CST
  5. 简单打包。2014年 09月 07日 星期日 18:30:41 CST
  6. 生成deb包。2014年 09月 10日 星期三 02:54:05 CST
  7. 优化选词机制,可以直接再次选取同一词,不会清空selection影响其他程序。2014年 09月 11日 星期四 19:32:42 CST

安装&运行:

  1. 加入ppa源:
    sudo add-apt-repository 'deb http://ppa.launchpad.net/lcqtdwj/python-marisa-trie/ubuntu trusty main'
  2. 更新源:
    sudo apt-get update
  3. 安装够用:
    sudo apt-get install gouyong 如果提示依赖不满足,请执行 sudo apt-get -f install
  4. 在启动器搜索够用,打开会在系统托盘出现够用图标。然后就可以划词翻译了,在线翻译可能会比较慢,请第一次多等一会。

(注:条件原因,Lz只测试了ubuntu14.04,其他版本如果不能启动,请在终端输入:GouYong,把开始的几行复制给我,帮助够用改进,谢谢啦。)

打包:

使用fpm,stdeb, setuptools_git等工具。

gouyong's People

Contributors

jiffies avatar polyrabbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gouyong's Issues

Kali Rolling

获取某个单词,偏慢出现窗口,差不多3-5秒,而且不是空白的,就是一闪而过。
操作系统:

➜ /home/greenhand2learn >uname -a                                           [2016-09-29 10:24:23]
Linux Anonymous 4.6.0-kali1-amd64 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86_64 GNU/Linux
➜ /home/greenhand2learn >lsb_release -a                                     [2016-09-29 10:24:25]
No LSB modules are available.
Distributor ID: Kali
Description:    Kali GNU/Linux Rolling
Release:    kali-rolling
Codename:   kali-rolling

运行报错信息

/usr/local/lib/python2.7/dist-packages/GouYong-0.3-py2.7.egg/GouYong/src/window.py:2: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gdk,Gtk,GLib,WebKit,GObject
/usr/local/lib/python2.7/dist-packages/GouYong-0.3-py2.7.egg/GouYong/src/window.py:2: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gdk,Gtk,GLib,WebKit,GObject
/usr/local/lib/python2.7/dist-packages/GouYong-0.3-py2.7.egg/GouYong/src/window.py:2: PyGIWarning: WebKit was imported without specifying a version first. Use gi.require_version('WebKit', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gdk,Gtk,GLib,WebKit,GObject
[INFO 2016-09-29 10:18:27,940 youdaoQuery]:cache folder exists.
/usr/local/lib/python2.7/dist-packages/GouYong-0.3-py2.7.egg/GouYong/src/indicator.py:3: PyGIWarning: AppIndicator3 was imported without specifying a version first. Use gi.require_version('AppIndicator3', '0.1') before import to ensure that the right version gets loaded.
  from gi.repository import AppIndicator3 as appindicator
[INFO 2016-09-29 10:18:29,273 window]:textbuffer init <Gtk.TextBuffer object at 0x7f9a60ecf8c0 (GtkTextBuffer at 0x2d8d980)>.
[INFO 2016-09-29 10:18:29,275 dict_manager]:['stardict-21shijishuangxiangcidian-2.4.2', 'lazy-dict']
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-8u102-b14.1-2-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
============Not Found fmt and trie,analysis now.
[INFO 2016-09-29 10:18:32,031 dict_manager]:载入/usr/share/GouYong/dict/lazy-dict/懒虫简明英汉词典
[DEBUG 2016-09-29 10:18:32,095 record]:work run

(GouYong:22255): Gdk-CRITICAL **: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
[DEBUG 2016-09-29 10:18:33,489 window]:Not working.
[DEBUG 2016-09-29 10:18:33,489 window]:need at 26110661
[DEBUG 2016-09-29 10:18:33,489 utils]:elapsed time: 0.004053 ms
[DEBUG 2016-09-29 10:18:34,808 window]:Not working.
[DEBUG 2016-09-29 10:18:34,808 window]:need at 26111981
[DEBUG 2016-09-29 10:18:34,809 utils]:elapsed time: 0.005007 ms
[DEBUG 2016-09-29 10:18:36,976 window]:Not working.
[DEBUG 2016-09-29 10:18:36,977 window]:need at 26114149
[DEBUG 2016-09-29 10:18:36,977 utils]:elapsed time: 0.005007 ms
[DEBUG 2016-09-29 10:18:38,400 window]:Not working.
[DEBUG 2016-09-29 10:18:38,400 window]:need at 26115573
[DEBUG 2016-09-29 10:18:38,401 utils]:elapsed time: 0.003815 ms
[DEBUG 2016-09-29 10:18:38,577 window]:Not working.
[DEBUG 2016-09-29 10:18:38,577 window]:need at 26115749

无法ctrl+c停止运行,一直显示这个

[DEBUG 2016-09-29 10:24:53,984 window]:Signal callback already woking.
[DEBUG 2016-09-29 10:24:54,153 window]:Signal callback already woking.
[DEBUG 2016-09-29 10:24:54,488 window]:Signal callback already woking.

debian7.7执行GouYong报错:TypeError: new() takes exactly 1 argument (0 given)

liangsh@lsh-dev:~/Downloads/marisa-0.2.4$ GouYong
[INFO 2015-01-19 19:14:23,541 youdaoQuery]:cache folder exists.
Traceback (most recent call last):
File "/usr/local/bin/GouYong", line 9, in
load_entry_point('GouYong==0.3', 'gui_scripts', 'GouYong')()
File "/usr/local/lib/python2.7/dist-packages/GouYong-0.3-py2.7.egg/GouYong/src/window.py", line 256, in main
pop=Popup()
File "/usr/local/lib/python2.7/dist-packages/GouYong-0.3-py2.7.egg/GouYong/src/window.py", line 32, in init
self.init_textview()
File "/usr/local/lib/python2.7/dist-packages/GouYong-0.3-py2.7.egg/GouYong/src/window.py", line 36, in init_textview
self.textbuffer = Gtk.TextBuffer.new()
File "/usr/lib/python2.7/dist-packages/gi/types.py", line 72, in constructor
return info.invoke(cls, _args, *_kwargs)
TypeError: new() takes exactly 1 argument (0 given)

fedora 无法读取idx词典

使用fedora 20进行测试,顺便打了个 rpm包(https://copr.fedoraproject.org/coprs/mosquito/myrepo/)
本机依赖:

  • pygobject3-base = 3.10 (python-gi) # 比您列出的低了点
  • gobject-introspection = 3.10
  • marisa-python = 0.2.4

修改了以下几点:

  1. 可执行文件 GouYong -> gouyong (修改setup.py)
  2. 打了个patch
    --- GouYong/src/window.py 2014-10-28 01:50:05.976805122 +0800
    +++ GouYong/src/window.py 2014-10-28 03:16:56.698224308 +0800
    @@ -12,7 +12,7 @@
    -WIDTH = 700
    +WIDTH = 703
    @@ -32,7 +32,7 @@
  •    self.textbuffer = Gtk.TextBuffer.new()
    
  •    self.textbuffer = Gtk.TextBuffer.new(table=None)
    
  • sed -i -e 's@marisa_trie@marisa@g' -e 's@RecordTrie@Trie@g' GouYong/lib/pystardict.py

执行出错:
$ gouyong
[INFO 2014-10-28 03:32:45,305 dict_manager]:['stardict-21shijishuangxiangcidian-2.4.2', 'lazy-dict']
java version "1.7.0_65"
OpenJDK Runtime Environment (fedora-2.5.2.5.fc20-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

Traceback (most recent call last):
File "/usr/bin/gouyong", line 9, in
load_entry_point('gouyong==0.2', 'gui_scripts', 'gouyong')()
File "/usr/lib/python2.7/site-packages/gouyong/src/window.py", line 248, in main
dm.open_dict()
File "/usr/lib/python2.7/site-packages/gouyong/src/dict_manager.py", line 38, in open_dict
self.dict = Dictionary(os.path.join(self.dict_dir,dict_name))
File "/usr/lib/python2.7/site-packages/gouyong/src/../lib/pystardict.py", line 439, in init
self.idx = _StarDictIdx(dict_prefix=filename_prefix, container=self)
File "/usr/lib/python2.7/site-packages/gouyong/src/../lib/pystardict.py", line 183, in init
self.trie = marisa.Trie(fmt,dict)
TypeError: init() takes exactly 1 argument (3 given)

尝试修复:
注释了/usr/lib/python2.7/site-packages/gouyong//lib/pystardict.py的148, 149, 183, 184, 189, 190 之后,可以成功运行,并使用网络取词功能,但本机词典不可用。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.