Difference between revisions of "GEPS 029: GTK3-GObject introspection Conversion"

From Gramps
Jump to: navigation, search
(Problems)
Line 69: Line 69:
  
 
  PYTHONPATH=/usr/local/lib/python2.7/site-packages/ python gramps.py
 
  PYTHONPATH=/usr/local/lib/python2.7/site-packages/ python gramps.py
 +
 +
* That didn't work for me; I get:
 +
 +
<pre>
 +
$ PYTHONPATH=/usr/local/lib/python2.7/site-packages/ python src/gramps.py
 +
Gtk typelib not installed. Install Gnome Introspection, and pygobject version 3.3.2 or later.
 +
 +
Gramps will terminate now.
 +
</pre>
 +
 +
--[[User:Dsblank|Dsblank]] ([[User talk:Dsblank|talk]]) 21:10, 23 July 2012 (MST)
  
 
== Problems ==
 
== Problems ==

Revision as of 04:10, 24 July 2012

Gramps was written with GTK 2 toolkit. This has been replaced upstream with GTK 3, so Gramps should convert to GTK 3.

Guideline

We try to convert 1 to 1. If there are problems due to deprecated features, or otherwise, add in the code:

# TODO GTK3: write what problem is due to gtk 3 conversion

Before release, all TODO GTK3 in the code must be cleaned up

Documentation

Python GTK3 docs: [1]

Alternative is to look at the base C documentation, and understand from experience how the introspection works. Gnome docs: [2].

As python works with classes, it looks somewhat like the C++ interface: [3]. To investigate the specific override (how to init Gtk classes):

  • python overrides: [4]

Furthermore, for the other gi libs:

Installation

Ubuntu 12.04

For people on Ubuntu 12.04, you need:

1. add the gnome_shell repo to have the latest version of glib and friends, see how to add the ppa on: gnome_shell pppa Then upgrade your system via the system manager.

Note 1 : If you use Gnome3, also add the gnome3 ppa!

Note 2: this can make gnome shell unstable if the ppa is too bleeding edge!!

2. install version 3.3.2 of pygobject. No ppa for this, I use the git repo on gnome.org, so my git config:

     [remote "origin"]
       fetch = +refs/heads/*:refs/remotes/origin/*
       url = http://git.gnome.org/browse/pygobject

So to install it to folder pygobject, do

git clone git://git.gnome.org/pygobject pygobject

Then checkout tag 3.3.2, so

cd pygobject
git checkout 3.3.2

Make sure you have the dependencies installed, you will need:

  1. libglib2.0-dev package (otherwise you will obtain an error like undefined mqcro: AM_PATH_GLIB_2_0.
  2. autoconf, automake, libtool, intltool package
  3. python-dev package
  4. libcairo2-dev, python-cairo-dev
  5. python-gobject-dev
  6. libgirepository1.0-dev

So, use the line:

sudo apt-get install autoconf  automake libtool package python-dev libglib2.0-dev libcairo2-dev python-cairo-dev python-gobject-dev libgirepository1.0-dev
  • What is "package" in the above line? My install complained and couldn't find it. --Dsblank (talk) 21:06, 23 July 2012 (MST)

Then compile pygobject:

./autogen.sh
make
sudo make install

Now this installs to /usr/local, so to run the test with that, on ubuntu in your terminal:

PYTHONPATH=/usr/local/lib/python2.7/site-packages/ python gramps.py
  • That didn't work for me; I get:
$ PYTHONPATH=/usr/local/lib/python2.7/site-packages/ python src/gramps.py
Gtk typelib not installed. Install Gnome Introspection, and pygobject version 3.3.2 or later.

Gramps will terminate now.

--Dsblank (talk) 21:10, 23 July 2012 (MST)

Problems

  • we cannot set strings in struct, see GTK bug [5]
  • error in list_families on textview in styledtexteditor: [6]
  • str and unicode no longer seem to work, the encoding must be passed too; Future: deprecate unicode() in the code, as we want to support python 3
  • there is no longer automatic conversion to str utf-8 when using GTK functions, we must convert before passing to GTK.
  • glade can no longer work with our catalog. We need to upgrade comboboxentry to combobox with has_entry manually, and hope editors keep working... - SOLVED: converted editevent.glade, all works
  • expose is no longer present on gtk.widget. Draw must be used. Unclear how, [7].
  • Gtk.Clipboard seems to work differently
  • Pedigreeview is broken and must be converted to new drawing primitives. Same probably for fanchart.
  • osmgpsmap is GTK2. There is a GTK3 branch in git, we should try it, and contribute to the conversion.
  • menu.popup does not seem to work in some instances. Passing position function seems to be the workaround, see grampsbar.py for example

Related Gramps Bugs

  • #5009: Use gobject introspection for GTK 3 dependency