Changes

Jump to: navigation, search

GEPS 029: GTK3-GObject introspection Conversion

2,464 bytes added, 05:34, 9 February 2013
m
Open: resort
On Ubuntu 12.10 (as of December 1, 2012), or Linux Mint 14 (as of December 24, 2012), you need only ('''replace python with python3 if you want to run the python 3 version!'''):
sudo apt-get install python-dev libglib2.0-dev libcairo2-dev
sudo apt-get install python-cairo-dev python-gobject-dev libgirepository1.0-dev
sudo apt-get install gir1.2-freedesktop python-gi python-gobject python-gi-cairo
sudo apt-get install gir1.2-pango-1.0 libgtkspell-3-0 python-gtkspell
sudo apt-get install python-pyicu
Old note ''The removal of python-gnome2 (and anything that relies on it) is necessary apparently because some "selectors" have not yet been converted. The right thing to do here is to fix the selectors rather than removing the package.'''
You can also run Gramps 4.0+ in [[GEPS_031:_Python_3_support#Ubuntu_12.10|Python 3]] first Install the Python BSDDB interface and check that it [[Install_latest_BSDDB#Python_BSDDB_interface|works]]
For working spell check, you need [http://gtkspell.sourceforge.net/ gtkspell 3.3.0].
(In Ubuntu 12.10, this is available in your distribution as the libgtkspell-3-0 packageis not suitable [https://bugs.launchpad.net/ubuntu/+source/gtkspell3/+bug/1114403] as it is API incompatible with the official release 3. 0.0, released on 2012-11-12 )
If the package is not in your distributions packages, you need to compile the spell check. For this, obtain the GtkSpell 3.3.0 or later source code, and extract the code to a directory, eg gtkspell3, and go into this directory using the terminal.
Before continuing, remove any old version of gtkspell v3 you might have installed before!
Now obtain the packages needed to compile this code. In my case I had most  Install the program 'hg' to get the code (see above installation introspection for other packages that might be needed). I still needed sudo apt-get install mercurial Download the Gtkspell code with: hg clone http://hg.code.sf.net/p/gtkspell/code gtkspell-code You may need to install the following:
sudo apt-get install gtk-doc-tools libenchant-dev
You may also need gtk3 devel packages:
sudo apt-get install gtk+-3.0-dev
Now compile and install the code
./configureautogen.sh
make
sudo make install
Gramps now needs to find the gtkspell typelib and introspection lib. The first I achieve by By copying the typelib to the correct location:
sudo cp /usr/local/lib/girepository-1.0/GtkSpell-3.0.typelib /usr/lib/girepository-1.0/
The lib can be found by path by setting the LD_LIBRARY_PATH environment variable. Hence, start Gramps as follows:
LD_LIBRARY_PATH=/usr/local/lib python src/grampsGramps.py
If you followed the guide above and compiled your own pygobject module, you need to start Gramps with the command
PYTHONPATH=/usr/local/lib/python2.7/site-packages/ LD_LIBRARY_PATH=/usr/local/lib python src/grampsGramps.py [[File:Gtkspell working on gramps40.png|thumb|300px|Gtkspell working on gramps40 - You can tell because it does not recognise the word Gramps in the welcome Gramplet]]{{-}} ==== Install your Dictionary ====If your language is missing from the list of dictionaries to spellcheck against you can install them.
eg: For Australian English:
sudo apt-get install myspell-en-au
 
You can check that the language installed correctly by running
enchant-lsmod -list-dicts
 
The result should list all the language dictionaries installed and include the one you installed
eg:
en_AU (myspell)
==== Old install method ====
we need a patched gtkspell version that supports gobject introspection. A working version is the '''changes''' branch at [https://github.com/manisandro/gtkspell3/tree/changes https://github.com/manisandro/gtkspell3/tree/changes]. So one needs to install this version of gtkspell. The python-gtkspell code is then no longer needed, and can be removed. Source of this code is a sourceforge bug entry [https://sourceforge.net/tracker/index.php?func=detail&aid=3298132&group_id=7896&atid=107896] and a redhat bug entry: [https://bugzilla.redhat.com/show_bug.cgi?id=675504]
Gramps supports this version since revision 20130: [http://gramps.svn.sourceforge.net/viewvcp/gramps/code/20130/tree/trunk/src/gui/spell.py?r1=20057&r2=20130].
First we install the git package to obtain the code:
=== OsmGpsMap for Geography ===
The [[Gramps_4.0_Wiki_Manual_-_Categories#Geography_Category|Geography ]] requires osmgpsmap. Introspection bindings for this is not currently available, so you need to compile it.As it doesn't work correctly for the moment and some patches are not in git, I forked osmgpsmap.
I finished to convert osmgpsmap from gtk2 to gtk3. it's now in trunk. John added some new patchs and it works correctly since 2013/2/06.My repository must not be used. So we can now use :  git clone git://github.com/SNoiraudnzjrs/osm-gps-map.git
cd osm-gps-map
# switch to branch gtk3
git checkout -b gtk3 origin/gtk3
git branch -a
As I'm currently modifying osm-gps-mapwe can have some new patches, If you already have osm-gps-map and you want to get the last version, do :
git pull
You may also need gtk3 devel packages:
sudo apt-get install gtk+-3.0-dev
 
You need to install gnome-common from the GNOME SVN
sudo apt-get install gnome-common
 
and
 
sudo apt-get install gtk-doc-tools
Now compile osmgpsmap:
First sets library to ''/usr/local/lib'' so as to find osmgpsmap and gtkspell, second ''/usr/local/lib/python2.7/site-packages/'' to find the local install of pygobject
 
==== Linux Mint 14.1 ====
 
The Patches mentioned above are (as of 2013/1/27) in the main osm-gps-map git repository so you can use:
 
git clone git://github.com/nzjrs/osm-gps-map.git
 
For Linux Mint you also need the gtk3 devel packages:
sudo apt-get install gtk+-3.0-dev
 
Now compile osmgpsmap:
 
./autogen.sh
make
sudo make install
sudo cp /usr/local/lib/girepository-1.0/OsmGpsMap-0.8.typelib /usr/lib/girepository-1.0/
 
Start up Gramps with:
LD_LIBRARY_PATH=/usr/local/lib PYTHONPATH=/usr/local/lib/python2.7/site-packages/ python Gramps.py
 
or
 
LD_LIBRARY_PATH=/usr/local/lib PYTHONPATH=/usr/local/lib/python2.7/site-packages/ python -c 'from gramps.grampsapp import main; main()'
== Problems ==
=== Open ===
* We cannot set strings in struct, see GTK bug [https://bugzilla.gnome.org/show_bug.cgi?id=678401] It seems we can do without this, so not an issue at the moment
* osmgpsmap is GTK2. There is a GTK3 branch No rows_reordered function on treemodels in git, we should try itpython, and contribute to the conversion. '''In Progress''': Geography really minimalist : no menu, no markers, ...* pyexiv2 module causes a segmentation fault when exiting Gramps - see GTK bug [httphttps://wwwbugzilla.gramps-projectgnome.org/bugs/viewshow_bug.phpcgi?id=6042 #6042684558]* python-gnome2 package causes a segmentation fault when Gramps starts - see bug [http. Current fix://www.grampsdisconnect and reconnect the model so sort need not emit rows-projectreordered signal.org/bugs/view.php?id=5972 #5972]<pre> TypeError: Error when calling However, this means the metaclass bases metaclass conflict: the metaclass history of expand collapse of nodes in a derived class must be a treeview is lost after rows have been reordered (non-strict) subclass of this happens in gramps on click on the metaclasses of all its bases</pre>column that is already sorted.
* Geography : missing tiles : osm-gps-map problem.
(Gramps.py:4515): OsmGpsMap-WARNING **: Error getting missing tile
* Geography : for all other problems, use last version with git pull. Be careful, osm-gps-map is now 0.8. You must remove all 1.0 versions (OsmGpsMap*.gir and OsmGpsMap*.typelib)
* No rows_reordered function on treemodels in python, see GTK bug [https://bugzilla.gnome.org/show_bug.cgi?id=684558]. Current fix: disconnect and reconnect the model so sort need not emit rows-reordered signal. However, this means the history of expand collapse of nodes in a treeview is lost after rows have been reordered (this happens in gramps on click on the column that is already sorted.
* Geography : We cannot mix osmgpsmap between trunk and gramps34 and others.
* Geography : bad placement of markers : osm-gps-map problem. '''Solved''' : git pull the latest version. Need to be acknowledge by osm-gps-map team.
* Geography : We cannot mix osmgpsmap between trunk and gramps34 and others. '''Solved''' : git pull the latest version. You must remove all libosmgps* from /usr/local/lib before make install
* osmgpsmap is GTK2. There is a GTK3 branch in git, we should try it, and contribute to the conversion. '''In Progress''': Geography really minimalist : no menu, no markers, ... '''Solved''' GTK3 available
* pyexiv2 module causes a segmentation fault when exiting Gramps - see bug #{{bug|6042}} - resolved
* python-gnome2 package causes a segmentation fault when Gramps starts - see bug #{{bug|5972}} - resolved
<pre> TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases</pre>
 
== Related Gramps Bugs ==
(gdb) bt
This works best if you have the debug symbols installed for everything relevant, or are running from a self-built treebuilt with debugging CFLAGS (-g -O0). At a minimum, in addition to Python itself, you'll need symbols for Gtk+ (libgtk-3.0.so and libgdk-3.0.so), PyGObject, and GLib. To see the python stack: (gdb) pystack This works with gdb7 as-is; for earlier versions, you need to install [http://svn.python.org/view/*checkout*/python/trunk/Misc/gdbinit?revision=77484 gdbinit] as .gdbinit in your home directory before starting gdb.On some systems (MacOS X in particular), the structure PyStringObject isn't exported in the debug symbols, so if you get the error No symbol "PyStringObject" in current context.then you need to tell gdb add-symbol-file /path/to/Python-build-dir/Objects/stringobject.owhich will be possible only if you've built Python from source. 
[[Category:GEPS|G]]

Navigation menu