translate / virtaal

Easy-to-use and powerful offline translation tool
https://virtaal.translatehouse.org
GNU General Public License v2.0
300 stars 58 forks source link

It is not possible to configure the spell check #3284

Open mbouzada opened 6 years ago

mbouzada commented 6 years ago

In Debian 9 and Ubuntu 18.4, to work in Galician, having installed the indicated in https://virtaal.readthedocs.io/en/latest/spell_checking.html including the hunspell package, it is not possible to activate the spellchecker in Edit → Preferences → Addons

rffontenelle commented 6 years ago

Works for me in Arch Linux. Was the package built with spellchecking support? Could you run Virtaal from command line e see if any helping error message is displayed?

mbouzada commented 6 years ago

Error messages launching virtaal from command line

ERROR:root:Failed to load plugin "spellchecker" No module named gtkspell Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/spellchecker.py", line 69, in init import gtkspell ImportError: No module named gtkspell ERROR:root:Failed to load plugin "tinytm" could not translate host name "www.tinytm.org" to address: Nome ou servicio descoñecido Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/tm/models/tinytm.py", line 60, in init host=self.config["server"] File "/usr/lib/python2.7/dist-packages/psycopg2/init.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) OperationalError: could not translate host name "www.tinytm.org" to address: Nome ou servicio descoñecido

/usr/lib/python2.7/dist-packages/virtaal/views/mainview.py:575: Warning: /build/glib2.0-B1uXKV/glib2.0-2.50.3/./gobject/gsignal.c:3492: signal name 'selection_changed' is invalid for instance '0x559acdc7c4a0' of type 'GailMenuItem' gtk.main() ERROR:root:Failed to load plugin "spellchecker" No module named gtkspell Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/spellchecker.py", line 69, in init import gtkspell ImportError: No module named gtkspell ERROR:root:Failed to load plugin "spellchecker" No module named gtkspell Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/spellchecker.py", line 69, in init import gtkspell ImportError: No module named gtkspell ERROR:root:Failed to load plugin "spellchecker" No module named gtkspell Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/spellchecker.py", line 69, in init import gtkspell ImportError: No module named gtkspell

"spellcheck" packages installed

miguel@asustao:~$ apt-cache search gtkspell gir1.2-gspell-1 - spell-checking library for GTK+ applications - GObject introspection libgspell-1-1 - spell-checking library for GTK+ applications libgspell-1-common - libgspell architecture-independent files libgspell-1-dev - spell-checking library for GTK+ applications - development files libgtkspell-dev - Development files for GtkSpell libgtkspell0 - a spell-checking addon for GTK's TextView widget gir1.2-gtkspell3-3.0 - GObject introspection data for the GtkSpell library libgtkspell3-3-0 - spell-checking addon for GTK+'s TextView widget libgtkspell3-3-dev - Development files for GtkSpell libgtkspellmm-3.0-0v5 - C++ wrapper library for GtkSpell (shared libraries) libgtkspellmm-3.0-dev - C++ wrapper library for GtkSpell (development files) libgtkspellmm-3.0-doc - C++ wrappers for GtkSpell (documentation) libgtk2-spell-perl - Perl interface to the GtkSpell library python-gtkspellcheck - Python 2 spellchecking library GTK+ based on Enchant python-gtkspellcheck-doc - Python GTK+ Spellcheck common documentation python3-gtkspellcheck - Python 3 spellchecking library for GTK+ based on Enchant

2018-07-21 11:28 GMT+02:00 Rafael Fontenelle notifications@github.com:

Works for me in Arch Linux. Was the package built with spellchecking support? Could you run Virtaal from command line e see if any helping error message is displayed?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/translate/virtaal/issues/3284#issuecomment-406783574, or mute the thread https://github.com/notifications/unsubscribe-auth/AD5QuaWkGt7SzCy5wN0OBb7_a7HsO238ks5uIvRFgaJpZM4VS-UZ .

-- Membro do «Grupo de Amigos GNU/Linux de Pontevedra (GALPon)» http://galpon.org Membro de «Proxecto Trasno» http://trasno.gal Co-coordinador do proxecto «GALPon MiniNo» http://minino.galpon.org

mbouzada commented 6 years ago

sorry, I correct, the previous list is available packages and now I add the installed packages

miguel@asustao:~$ dpkg -l |grep gtkspell ii gir1.2-gtkspell3-3.0:amd64 3.0.9-1 amd64 GObject introspection data for the GtkSpell library ii libgtkspell0 2.0.16-1.1 amd64 a spell-checking addon for GTK's TextView widget ii libgtkspell3-3-0:amd64 3.0.9-1 amd64 spell-checking addon for GTK+'s TextView widget ii python-gtkspellcheck 4.0.5-1 all Python 2 spellchecking library GTK+ based on Enchant ii python3-gtkspellcheck 4.0.5-1 all Python 3 spellchecking library for GTK+ based on Enchant

2018-07-23 13:14 GMT+02:00 Miguel Bouzada mbouzada@gmail.com:

Error messages launching virtaal from command line

ERROR:root:Failed to load plugin "spellchecker" No module named gtkspell Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/spellchecker.py", line 69, in init import gtkspell ImportError: No module named gtkspell ERROR:root:Failed to load plugin "tinytm" could not translate host name "www.tinytm.org" to address: Nome ou servicio descoñecido Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/tm/models/tinytm.py", line 60, in init host=self.config["server"] File "/usr/lib/python2.7/dist-packages/psycopg2/init.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) OperationalError: could not translate host name "www.tinytm.org" to address: Nome ou servicio descoñecido

/usr/lib/python2.7/dist-packages/virtaal/views/mainview.py:575: Warning: /build/glib2.0-B1uXKV/glib2.0-2.50.3/./gobject/gsignal.c:3492: signal name 'selection_changed' is invalid for instance '0x559acdc7c4a0' of type 'GailMenuItem' gtk.main() ERROR:root:Failed to load plugin "spellchecker" No module named gtkspell Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/spellchecker.py", line 69, in init import gtkspell ImportError: No module named gtkspell ERROR:root:Failed to load plugin "spellchecker" No module named gtkspell Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/spellchecker.py", line 69, in init import gtkspell ImportError: No module named gtkspell ERROR:root:Failed to load plugin "spellchecker" No module named gtkspell Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/virtaal/controllers/plugincontroller.py", line 109, in enable_plugin self.plugins[name] = plugin_class(name, self.controller) File "/usr/lib/python2.7/dist-packages/virtaal/plugins/spellchecker.py", line 69, in init import gtkspell ImportError: No module named gtkspell

"spellcheck" packages installed

miguel@asustao:~$ apt-cache search gtkspell gir1.2-gspell-1 - spell-checking library for GTK+ applications - GObject introspection libgspell-1-1 - spell-checking library for GTK+ applications libgspell-1-common - libgspell architecture-independent files libgspell-1-dev - spell-checking library for GTK+ applications - development files libgtkspell-dev - Development files for GtkSpell libgtkspell0 - a spell-checking addon for GTK's TextView widget gir1.2-gtkspell3-3.0 - GObject introspection data for the GtkSpell library libgtkspell3-3-0 - spell-checking addon for GTK+'s TextView widget libgtkspell3-3-dev - Development files for GtkSpell libgtkspellmm-3.0-0v5 - C++ wrapper library for GtkSpell (shared libraries) libgtkspellmm-3.0-dev - C++ wrapper library for GtkSpell (development files) libgtkspellmm-3.0-doc - C++ wrappers for GtkSpell (documentation) libgtk2-spell-perl - Perl interface to the GtkSpell library python-gtkspellcheck - Python 2 spellchecking library GTK+ based on Enchant python-gtkspellcheck-doc - Python GTK+ Spellcheck common documentation python3-gtkspellcheck - Python 3 spellchecking library for GTK+ based on Enchant

2018-07-21 11:28 GMT+02:00 Rafael Fontenelle notifications@github.com:

Works for me in Arch Linux. Was the package built with spellchecking support? Could you run Virtaal from command line e see if any helping error message is displayed?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/translate/virtaal/issues/3284#issuecomment-406783574, or mute the thread https://github.com/notifications/unsubscribe-auth/AD5QuaWkGt7SzCy5wN0OBb7_a7HsO238ks5uIvRFgaJpZM4VS-UZ .

-- Membro do «Grupo de Amigos GNU/Linux de Pontevedra (GALPon)» http://galpon.org Membro de «Proxecto Trasno» http://trasno.gal Co-coordinador do proxecto «GALPon MiniNo» http://minino.galpon.org

-- Membro do «Grupo de Amigos GNU/Linux de Pontevedra (GALPon)» http://galpon.org Membro de «Proxecto Trasno» http://trasno.gal Co-coordinador do proxecto «GALPon MiniNo» http://minino.galpon.org

rffontenelle commented 6 years ago

Please enter in Python 2 interactive console (run python or python2 in the terminal), then type import gtkspell and hit Enter to see if it successfully imports the library. Let me know if no error message is displayed, or, if displayed, paste it in here.

mbouzada commented 6 years ago

miguel@asustao:~$ python Python 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import gtkspell Traceback (most recent call last): File "", line 1, in ImportError: No module named gtkspell

miguel@asustao:~$ python2 Python 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516] on linux2 Type "help", "copyright", "credits" or "license" for more information. import gtkspell Traceback (most recent call last): File "", line 1, in ImportError: No module named gtkspell

miguel@asustao:~$

2018-07-23 14:15 GMT+02:00 Rafael Fontenelle notifications@github.com:

Please enter in Python 2 interactive console (run python or python2 in the terminal) e type import gtkspell and hit Enter to see if it successfully imports the library. Let me know if no error message is displayed, or, if displayed, paste it in here.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/translate/virtaal/issues/3284#issuecomment-407037600, or mute the thread https://github.com/notifications/unsubscribe-auth/AD5QuYakHwbwqW0aAskzscZAzB4bBJtrks5uJb5VgaJpZM4VS-UZ .

-- Membro do «Grupo de Amigos GNU/Linux de Pontevedra (GALPon)» http://galpon.org Membro de «Proxecto Trasno» http://trasno.gal Co-coordinador do proxecto «GALPon MiniNo» http://minino.galpon.org

rffontenelle commented 6 years ago

I realized something: Arch Linux builds Python2's version of pygtkspellcheck setting the GTKSPELL=true parameter (see build rules for this package in Arch) which adds the file gtkspell.py (and other compiled files) to the resulting package (see the package's file list in Arch). This enables the exact library I asked you to try to import.

The python-gtkspellcheck package on Debian and Ubuntu, however, doesn't seem to have this gtkspell.py file included in the package's file list and in no other package as far as I can tell. That's probably the reason why you are unable to successfully import gtkspell.

In order to include gtkspell library to the resulting python-gtkspellcheck package it only takes a GTKSPELL=true parameter added to ./setup.py line when building the package, as can be seen from the upstream's source code.

Can you file a bug report against python-gtkspellcheck from Debian and Ubuntu requesting them to add GTKSPELL=true parameter?

mbouzada commented 6 years ago

Ok, i will inform about the bug.

Thanks!

2018-07-23 15:00 GMT+02:00 Rafael Fontenelle notifications@github.com:

I realized something: Arch Linux builds Python2's version of pygtkspellcheck setting the GTKSPELL=true parameter (see build rules for this package in Arch https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/python-gtkspellcheck#n31) which adds the file gtkspell.py (and other compiled files) to the resulting package (see the package's file list in Arch https://www.archlinux.org/packages/community/any/python2-gtkspellcheck/files/). This enables the exact library I asked you to try to import.

The python-gtkspellcheck package on Debian and Ubuntu, however, doesn't seem to have this gtkspell.py file included in the package's file list https://packages.debian.org/stretch/all/python-gtkspellcheck/filelist and in no other package as far as I can tell. That's probably the reason why you are unable to successfully import gtkspell.

In order to include gtkspell library to the resulting python-gtkspellcheck package it only takes a GTKSPELL=true parameter added to ./setup.py line when building the package, as can be seen from the upstream's source code https://github.com/koehlma/pygtkspellcheck/blob/master/setup.py#L78https://github.com/koehlma/pygtkspellcheck/blob/master/setup.py%23L78 .

Can you file a bug report against python-gtkspellcheck from Debian and Ubuntu requesting them to add GTKSPELL=true parameter?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/translate/virtaal/issues/3284#issuecomment-407049606, or mute the thread https://github.com/notifications/unsubscribe-auth/AD5QuaDUYIs8x8e9gbGdjaxY_U-oj9qZks5uJcjygaJpZM4VS-UZ .

-- Membro do «Grupo de Amigos GNU/Linux de Pontevedra (GALPon)» http://galpon.org Membro de «Proxecto Trasno» http://trasno.gal Co-coordinador do proxecto «GALPon MiniNo» http://minino.galpon.org

smcv commented 6 years ago

The upstream source code release that's used in Debian, which was downloaded from https://pypi.org/project/pygtkspellcheck/#files, doesn't include the gtkspell.py module (presumably the upstream developer built their sdist tarball without specifically enabling the gtkspell module). That module appears to only be available from the upstream git repository.

It seems to be a deprecated wrapper to emulate an older PyGTK API.

I suspect virtaal's spellchecker plugin should use gtkspellchecker directly, instead of going via gtkspell (there's hardly any code in the gtkspell.py wrapper). This is a necessary step if virtaal is ever going to move to Python 3, because the gtkspell module is not available for Python 3.

smcv commented 6 years ago

The gtkspell module was already described as a "legacy API" in the commit that added it to gtkspellcheck in 2012, so it seems to be going quite far back into technical debt.

rffontenelle commented 6 years ago

Well, then I guess some kind of workaround have to be done in order to run Virtaal with spellchecking in this scenario. Here are the options that come to me right now:

smcv commented 6 years ago

Or change the spellchecker plugin so that instead of trying to use pygtkspellcheck via gtkspell, it calls into pygtkspellcheck directly? gtkspell is a very thin wrapper around pygtkspellcheck: it doesn't add any new functionality.

rffontenelle commented 6 years ago

Indeed, @smcv. It only takes a Pull Request and an active admin (which I am not) to approve and merge.

unho commented 6 years ago

@friedelwolff This is important. Can you speed up this? Thanks in advance.

unho commented 6 years ago

BTW people, it would be much easier to get the fix landed if you actually propose it as a pull request.

friedelwolff commented 6 years ago

Thank you for reporting this. I believe basic functionality will be possible through pygtkspellcheck without changes to Virtaal. I think I got pygtkspellcheck pretending to be python-gtkspell to work a long while ago already. I didn't commit it, because of some outstanding issues:

If I remember correctly the performance of pygtkspellcheck is pretty bad. I started with some optimisation work on pygtkspellcheck and pyenchant, but I never finished it. Additionally, we should reconsider our current handling of the popup, etc.

If I remember correctly I even considered reimplementing pygtkspellcheck in Virtaal to get exactly the right behaviour (we can do some nice things if we are in control), but obviously I have not had the time to pursue even simpler solutions.

Please report on how your testing with pygtkspellcheck went if you can install it with GTKSPELL=true.

mbouzada commented 6 years ago

@friedelwolff I could not run ./configure, therefore I could not do the test

rffontenelle commented 6 years ago

@friedelwolff, I have gtkspell enabled in my Arch, as mentioned in this comment. What information should I provide you and where (here or another issue, to not hijack this thread) ?

friedelwolff commented 6 years ago

@rffontenelle It seems that you gave all the required information, thank you. It is good to know that pygtkspell can be a drop-in substitute for python-gtkspell. Now we need to lobby distributions to package it that way. For me on Mageia, python-gtkspell still works fine, though, so I'm not sure what went wrong in the last few years. Sorry that I haven't had more time for maintenance on Virtaal recently!