Here we are again with the Dictionary hacking; I left my development trunk with barely enough time to close crashers and brown paper bags patchs, and now I’m finally able to return working on it.
Here’s an interesting bug, about the poor discoverability of the look up process. First of all: discoverability? Is that even a word? Who the hell filed that bug? Opened by Emmanue… ehr… looks uncomfortably away.
Anyway, linguistic issues aside, the issue is interesting: some complained that the old Dictionary had a BFB and the new Dictionary has, well, nothing – the word is searched by activating the entry. This makes sense if you are typing the word, but it breaks down if you are pasting a word into the entry as you have to reach out for the keyboard and press enter. The idea was adding a “Go” button, removable by turning off a knob inside GConf. Then I realised that the label bound to the entry could be removed in favour of a button with no relief; it would keep the current appearance of the Dictionary while adding the “mouse-only” interaction requested (and by having a mnemonic, you can also activate the entry using the button’s mnemonic tag). It’s an experiment: the bug I linked has a full patch for the button+GConf knob (courtesy of Stephen Cook, kudos to him), so if people are going to throw themselves out of the window, I’ll gladly forget my solution and apply the patch.
Another couple of squashed bugs: you cannot edit a dictionary source and even if you could, the advanced settings do not work anyway. Both these bugs are really missing implementations of existing features: the source editing was mostly in place before the code freeze of GNOME 2.16, while the advanced settings required two widgets (the database chooser and the strategy chooser) that weren’t ready in time for the UI freeze of last January. Now that I have written both widgets and that I have time to finish what I started, the source dialog has been overhauled, and it allows choosing the database and the matching strategy for the chosen source, both when adding and when editing it.
Speaking of the strategy chooser, I’ve added it to the sidebar, and like the database chooser allows you to set a matching strategy for the session, so you can use the default strategy (the same set for the source) or whatever strategies the source supports; I’ll add a “reset and use the default” button, which is also currently missing from the database chooser.
Here’s the real tricky bug: adding the speller widget to the dictionary applet. I thought about it, and how integrating the speller inside the applet, now that we have that widget. While inside the application having a sidebar makes sense, the same doesn’t not hold for the applet, as it would make it really big. For this reason, I added the speller widget (and every other page inside the sidebar) as pages of a notebook; you can switch between each of them using a drop-down menu – effectively making the whole applet work like the application’s sidebar.
As for the new features: four months ago I began hacking on a parser for the DICT file format, which is used to store a database (a single “dictionary” in a dictionary source) for dictd
to use. It took a bit to get ahold of the actual format, but once found I wrote a small parser object, modelled on the GKeyFile
object used to parse the desktop entry files. You can use it to load the dictionary and the index from data, or from file; you can just preload the index or load everything; you can even begin with an empty object, fill stuff and write it down. Unfortunately, it doesn’t support compressed files – but it should be enough for closing this bug, and work as a base for the StarDict dictionary parser (this I’ll have to write really from scratch, as the C++ parser code sucks horribly).
Finally, from the old-dictionary-feature-ported-to-the-new-dictionary department, the syntax highlighting has come back! Well, not entirely: just the links and the phonetics have been reinstated, and links still don’t work. Links are colored using the gtk-link-color
style property, which is also used by link buttons and the like (if your application renders hyperlinks or something like them, please use that style property!). The reason why I disabled the syntax highlighting was that there’s no formal definition for the dictionary syntax: it really can break at any given time – as you’ll see when using it; also, the highlighting code was really messy, so I had to rewrite it and that took time.
All of this is going to hit HEAD
this week or so.
There are plenty of other bugs lying around in Bugzilla, though; I hope to have more time during December to look at them and squash some more; but you know the drill: if you have your own pet bug scratch an itch and provide a patch. ;-)
Uhh, is that strategies dialog not a parody?
I can’t imagine anyone outside of a fairly select group of programmers who would even begin to comprehend it.
There is no such “DICT file format”. DICT is the name of a protocol. Its RFC does not say anything about how DICT servers should store their databases. dictd is just one implementation and there exists others.
Why parse dictd files ? It is so easy to run a server with those files. As for stardict files, it is very easy to convert them to dictd files (I provide a conversion script with Fantasdic). Adding different sources (servers, files and websites) will make gnome-dictionary more fuzzy. I think you should focus on making gnome-dictionary a DICT client that truly rocks.
Just my two cents. Keep on the good work!
scott: that is not a “dialog” – it’s a page in the side bar; and the matching strategy is something that allow you to get better results inside the speller widget.
mathieu: I know that there’s no “DICT” file format. as for “it’s easy to run a server than use a dictionary file” we clearly have two different concepts of “easy”. requiring to run a local server is not a good idea – since the user might well not be able to decide what to install on her/his box. as for different sources: I don’t really intend to support web services – the problem is that some users want proxy support, and unless you install a SOCKS proxy on your box, you cannot use it; one way to avoid this would be to query via HTTP a service like dict.org.
I enjoyed this post’s title. That is all :)
Im interesting, where can I find more info about the DICT file format. Any example source somewhere?
And what Im looking for:
a .xml dictionary file format, which is somehow easy to search through.
You are right. For some users, it may be difficult to run a local server. But I think that is mainly a packaging issue. We could think of a meta-package that installs gnome-dictionary, dictd (which would be started at boot) and some dictionaries. If it is still too difficult for some users to add new dictionaries, we can think of a GUI for that, which in addition could start/stop the server.
mathieu: I don’t think shipping a dict server with gnome-dictionary is a good idea: it’s a potential security issue, as it opens a network port to the outside; also, it’s not a packaging issue, but it’s a administration issue. if the dict server worked using a pipe, or unix domain sockets, it could be interesting to launch a local “server” when the dictionary starts, with a timeout for unloading it when not needed anymore. but, all in all, I prefer adding a source with a dict file parser.
khiraly: the only reference I was able to find was inside the dictd sources; there’s a document outlining the format of the index file, which is the only interesting part (the dictionary itself is just a text dump).
emmanuele: With the default configuration (at least under debian), the dictd server is not reachable from the outside. In the “access” section of the config file, you can see “allow localhost” and “allow 127.0.0.1”. Access from other hosts is denied.
As for adding file sources or not, I guess it is a matter of taste then. But again my take on this is that it will make the application more fuzzy. You will find yourself want to add more and more file sources (you mentioned stardict, what is next ?). I think this job should be delegated to the server.
But don’t get me wrong. I appreciate your work on gnome-dictionary and GNOME in general. Thanks.
Hello Emmanuele,
I am trying to understand what happened to gnome-dictionary in Ubuntu Heron distro. I used it since Dapper and it was great, especially being able to look up a term in multiple dictionaries at once.
In Heron, there is no “Advanced settings” subtree anymore, and adding a dictionary to a source seems impossible. It seems that many of the old bugs you describe here have been brought back, completely killing the usefulness of the app. In the Ubuntu forums people keep asking about this (e.g., http://ubuntuforums.org/archive/index.php/t-705408.html), and it seems that switching to another dict client is the only viable solution.
I loved my gnome-dictionary, however, and I do not want to swtich…
Thank you,
–Sergey
mmh, you probably missed the huge button called “Add” right below the list of available dictionary sources.
it’s understandable: what would an “Add” button do, after all.