Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Request a specific version of Gtk when using gi
  • Loading branch information
mdboom committed May 20, 2013
commit bb138bb3044e1f317892481bf7e152620035bc89
10 changes: 10 additions & 0 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
import os, sys
def fn_name(): return sys._getframe(1).f_code.co_name

try:
import gi
except ImportError:
raise ImportError("Gtk3 backend requires pygobject to be installed.")

try:
gi.require_version("Gtk", "3.0")
except ValueError:
raise ImportError("Gtk3 backend gtk3 development files to be installed.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing word: "requires".
Also, this has me puzzled, because I can run the gtk3agg backend on ubuntu Precise, but I don't have the libgtk-3-dev package installed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems things are packaged somewhat differently on Debian/Ubuntu than on Fedora. I think on Ubuntu, the required package is: gir1.2-gtk3.0 https://launchpad.net/ubuntu/precise/+package/gir1.2-gtk-3.0

Since we don't really know what distro the user will be using, I'm inclined to change this to:

"The Gtk3 backend requires that the GObject introspection bindings for Gtk 3 are installed."

That should give a user enough to Google something by.


try:
from gi.repository import Gtk, Gdk, GObject
except ImportError:
Expand Down