Spell checking in the edit view

Reported by Pititjo on 2009-03-12
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Getting Things GNOME!
Medium
Unassigned

Bug Description

It might be great to have spell checking in the taskeditor.

GtkSpell can be use for this. I think spell checking can be a method in the TaskView class.

<http://gtkspell.sourceforge.net/>
<http://pygtk.org/pygtkspell/class-gtkspell.html>

Related branches

lp:~jonathan-barnoud/gtg/spellcheck
Rejected for merging into lp:~gtg/gtg/old-trunk
Luca Invernizzi: Disapprove on 2010-02-03
Bertrand Rousseau (community): Resubmit on 2009-07-30
Changed in gtg:
importance: Undecided → Medium
status: New → Confirmed
Pititjo (jonathan-barnoud) wrote :

Here a dummy spell checking implementation in the TaskView class. It need the python-gnome2-extra package which provide gtkspell.

The spelling can't be deactivate and the local is the system one define in $LANG. I read the gtg code in order to find how the user config can be use.

Lionel Dricot (ploum) wrote :

Pitijo > Thanks for the patch. Maybe can you push your branch on launchpad, it would be more convenient for you. The preferences are currently read in the beginning of browser.py. But we should refactorize this out of browser.py in its own class.

Maybe should we use Gconf ?

Changed in gtg:
status: Confirmed → In Progress

On Thu, Mar 12, 2009 at 2:48 PM, Lionel Dricot <email address hidden> wrote:
> Pitijo > Thanks for the patch. Maybe can you push your branch on
> launchpad, it would be more convenient for you. The preferences are
> currently read in the beginning of browser.py. But we should refactorize
> this out of browser.py in its own class.
>
> Maybe should we use Gconf ?

How does Gconf and XDG specifications interact?

> ** Changed in: gtg
>       Status: Confirmed => In Progress
>
> ** Tags added: toreview
>
> --
> Spell checking in the edit view
> https://bugs.launchpad.net/bugs/341655
> You received this bug notification because you are a member of Gtg
> developers, which is the registrant for gtg.
>
> Status in Getting Things Gnome!: In Progress
>
> Bug description:
> It might be great to have spell checking in the taskeditor.
>
> GtkSpell can be use for this. I think spell checking can be a method in the TaskView class.
>
> <http://gtkspell.sourceforge.net/>
> <http://pygtk.org/pygtkspell/class-gtkspell.html>
>

--
Bertrand Rousseau
Place communale 1, 1450 Chastre, Belgium
e-mail : <email address hidden>
tel : +32 485 96 69 86

Lionel Dricot (ploum) wrote :

>> Maybe should we use Gconf ?
>
> How does Gconf and XDG specifications interact?

There's no interaction. XDG says : "if you have to store something in a
file, do it that way". With gconf, you don't store something in a file,
you store in gconf so you don't have to care.

But indeed, gconf itself saves stuffs in files, currently in .gconf.
There's a bug opened to ask gconf to put stuffs in XDG_CONFIG_HOME instead
but that's up to gconf.

The only thing an application developer needs to keep in mind is that
gconf is for preferences only, not data. (Evolution, I'm looking at you!)

Changed in gtg:
assignee: nobody → jonathan-barnoud
Pititjo (jonathan-barnoud) wrote :

I update my branch with an experimental support of gtkspell.

I added a toggle button in the testeditor toolbar wich activate or deactivate the check. For display it you have to add a "spell" section in your $HOME/.config/gtg file :

[spell]
experimental_spell = True
spell_check = True

The spell_check option define if the check is activate when you open a taskeditor.

You can also set the language in setting the "spell_language" option with your local. If you don't or if you give a wrong local, gtkspell uses your environment local define in $LANG.

I hope my code (and my english) are not too bad. There still bugs when a misspell is in a link and you want correct it.

Pititjo (jonathan-barnoud) wrote :

It seem to cause bug with task refresh when link changes. That cause many link are created by mistake and legitimate links are not more displayed as links. That even without correcting a misspell.

Pititjo (jonathan-barnoud) wrote :
Download full text (5.2 KiB)

*** glibc detected *** python: munmap_chunk(): invalid pointer: 0x0000000001eb0dec ***
======= Backtrace: =========
/lib/libc.so.6[0x7f6f36c13a58]
/usr/lib/libgtk-x11-2.0.so.0[0x7f6f34754953]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x16d)[0x7f6f3654925d]
/usr/lib/libgobject-2.0.so.0[0x7f6f3655ef5d]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7b8)[0x7f6f36560608]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_by_name+0x247)[0x7f6f36560987]
/usr/lib/libgtk-x11-2.0.so.0[0x7f6f34724553]
/usr/lib/libgtk-x11-2.0.so.0[0x7f6f3472481d]
/usr/lib/libgtk-x11-2.0.so.0[0x7f6f346cb888]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x16d)[0x7f6f3654925d]
/usr/lib/libgobject-2.0.so.0[0x7f6f3655ec3b]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x63a)[0x7f6f3656048a]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83)[0x7f6f36560b33]
/usr/lib/libgtk-x11-2.0.so.0[0x7f6f347ce6be]
/usr/lib/libgtk-x11-2.0.so.0(gtk_main_do_event+0x341)[0x7f6f346c5371]
/usr/lib/libgdk-x11-2.0.so.0[0x7f6f3434809c]
/usr/lib/libglib-2.0.so.0(g_main_context_dispatch+0x23b)[0x7f6f35ea2d3b]
/usr/lib/libglib-2.0.so.0[0x7f6f35ea650d]
/usr/lib/libglib-2.0.so.0(g_main_loop_run+0x1cd)[0x7f6f35ea6a3d]
/usr/lib/libgtk-x11-2.0.so.0(gtk_clipboard_store+0x15f)[0x7f6f347e9aaf]
/usr/lib/libgtk-x11-2.0.so.0[0x7f6f347e9b5f]
/usr/lib/libgtk-x11-2.0.so.0(gtk_main+0x1dc)[0x7f6f346c585c]
/var/lib/python-support/python2.5/gtk-2.0/gtk/_gtk.so[0x7f6f34d0e150]
python(PyEval_EvalFrameEx+0x569b)[0x490f0b]
python(PyEval_EvalFrameEx+0x6872)[0x4920e2]
python(PyEval_EvalFrameEx+0x6872)[0x4920e2]
python(PyEval_EvalCodeEx+0x6ad)[0x4927cd]
python(PyEval_EvalCode+0x32)[0x4929c2]
python(PyRun_FileExFlags+0x108)[0x4b2678]
python(PyRun_SimpleFileExFlags+0x1ab)[0x4b291b]
python(Py_Main+0xaea)[0x41488a]
/lib/libc.so.6(__libc_start_main+0xe6)[0x7f6f36bb8466]
python[0x413ca9]
======= Memory map: ========
00400000-00525000 r-xp 00000000 08:03 1680270 /usr/bin/python2.5
00724000-00725000 r--p 00124000 08:03 1680270 /usr/bin/python2.5
00725000-00757000 rw-p 00125000 08:03 1680270 /usr/bin/python2.5
00757000-0075f000 rw-p 00757000 00:00 0
01820000-02e55000 rw-p 01820000 00:00 0 [heap]
41e80000-41e81000 ---p 41e80000 00:00 0
41e81000-42681000 rwxp 41e81000 00:00 0
42681000-42682000 ---p 42681000 00:00 0
42682000-42e82000 rwxp 42682000 00:00 0
42e82000-42e83000 ---p 42e82000 00:00 0
42e83000-43683000 rwxp 42e83000 00:00 0
45687000-45688000 ---p 45687000 00:00 0
45688000-45e88000 rwxp 45688000 00:00 0
7f6f20000000-7f6f2165b000 rw-p 7f6f20000000 00:00 0
7f6f2165b000-7f6f24000000 ---p 7f6f2165b000 00:00 0
7f6f245c5000-7f6f245c7000 r-xp 00000000 08:03 1696364 /usr/lib/gconv/ISO8859-15.so
7f6f245c7000-7f6f247c6000 ---p 00002000 08:03 1696364 /usr/lib/gconv/ISO8859-15.so
7f6f247c6000-7f6f247c7000 r--p 00001000 08:03 1696364 /usr/lib/gconv/ISO8859-15.so
7f6f247c7000-7f6f247c8000 rw-p 00002000 08:03 1696364 /usr/lib/gconv/ISO8859-15.so
7f6f25b0b000-7f6f25b21000 r-xp 00000000 08:03 1531915 /lib/libgcc_s.so.1
7f6f2...

Read more...

Pititjo (jonathan-barnoud) wrote :

I don't know if the precedent ugly error war related with my problem because I cant reproduce it. But it seem that my problem which cause big errors in serialization/deserialization is solve. It was caused by gtkspell tags.

It still one little bug : misspell theme don't appear in links whereas gtkspell match misspell in them. But I think the feature is ready to be tested and my branch is up to date.

On Fri, Mar 13, 2009 at 12:48 AM, Pititjo <email address hidden> wrote:
> I don't know if the precedent ugly error war related with my problem
> because I cant reproduce it. But it seem that my problem which cause big
> errors in serialization/deserialization is solve. It was caused by
> gtkspell tags.
>
> It still one little bug : misspell theme don't appear in links whereas
> gtkspell match misspell in them. But I think the feature is ready to be
> tested and my branch is up to date.

Thanks for this! We'll try to merge your code as soon as we can!

Regarding the bug you experienced maybe it was caused by this: #317101
(which is a pygtk bug, which is now solved but not available yet I
think)

> --
> Spell checking in the edit view
> https://bugs.launchpad.net/bugs/341655
> You received this bug notification because you are a member of Gtg
> developers, which is the registrant for gtg.
>
> Status in Getting Things Gnome!: In Progress
>
> Bug description:
> It might be great to have spell checking in the taskeditor.
>
> GtkSpell can be use for this. I think spell checking can be a method in the TaskView class.
>
> <http://gtkspell.sourceforge.net/>
> <http://pygtk.org/pygtkspell/class-gtkspell.html>
>

--
Bertrand Rousseau
Place communale 1, 1450 Chastre, Belgium
e-mail : <email address hidden>
tel : +32 485 96 69 86

I checked your code. For me it's fine except for the "Check spelling" button in the editor. I could merge your code if you remove it (spell checking would then be enabled by editing gtg.conf).

When bug #342955 will be closed, an option will be added in the preference pane to enable/disable this feature through the UI.

Pititjo (jonathan-barnoud) wrote :

Le samedi 14 mars 2009 à 22:15 +0000, Bertrand Rousseau a écrit :
> I checked your code. For me it's fine except for the "Check spelling"
> button in the editor. I could merge your code if you remove it (spell
> checking would then be enabled by editing gtg.conf).
>
> When bug #342955 will be closed, an option will be added in the
> preference pane to enable/disable this feature through the UI.
>

The new serializer introduce some bugs in spell check. My code is not
ready to be merge even without the button. I'm working about this.

Did you guys consider using pyenchant (http://pyenchant.sourceforge.net/) instead of gtkspell? It also provides gtk widgets, seems easy to use and is packaged in most distributions, but does not depend on the whole Gnome stack as python-gnome2-extras does. This would keep gtg as light as it currently is.

 I have no idea on how much work it would require to port Pititjo's branch to use enchant though. Just my two cents.

For a reference, bug #191616 shows an example of basic spell checking in Pyroom, using python-enchant.

Pititjo (jonathan-barnoud) wrote :

Le mardi 17 mars 2009 à 20:23 +0000, Jérôme Guelfucci a écrit :
> Did you guys consider using pyenchant
> (http://pyenchant.sourceforge.net/) instead of gtkspell? It also
> provides gtk widgets, seems easy to use and is packaged in most
> distributions, but does not depend on the whole Gnome stack as python-
> gnome2-extras does. This would keep gtg as light as it currently is.
>
> I have no idea on how much work it would require to port Pititjo's
> branch to use enchant though. Just my two cents.
>

I have started to look at pyenchant but I haven't seen there is a gtk
widget.

I didn't think that there is a lot of work in order to switch from
gtkspell to pyenchant. The most ok my work isn't directly related with
spell but is very generic about how the editor parse and display its
buffer.

In the future, when the plugin system will be integrated, I think export
the part of code directly linked to spell in a plugin.

Still now it remain two big bugs in my branch :
- misspelled word style don't apply on link
- when a missplell is corrected in a tag, the new word isn't considerate
as a tag and only the @ remain as a tag. I think TaskView.modified which
parse the text and apply gtkTextTag in the buffer isn't call.

Changed in gtg:
assignee: Pititjo (jonathan-barnoud) → nobody
Changed in gtg:
status: In Progress → Confirmed
Izidor Matušov (izidor) on 2011-08-12
tags: added: editor
Changed in gtg:
milestone: none → 0.4
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers