Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Support pgi as alternative gobject bindings.#9932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
23 changes: 15 additions & 8 deletions.travis.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
33 changes: 23 additions & 10 deletionsdoc/glossary/index.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletionsdoc/users/next_whats_new/2017-12-04-AL-pgi.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
PGI bindings for gtk3 | ||
--------------------- | ||
The GTK3 backends can now use PGI_ instead of PyGObject_. PGI is a fairly | ||
incomplete binding for GObject, thus its use is not recommended; its main | ||
benefit is its availability on Travis (thus allowing CI testing for the gtk3agg | ||
and gtk3cairo backends). | ||
The binding selection rules are as follows: | ||
- if ``gi`` has already been imported, use it; else | ||
- if ``pgi`` has already been imported, use it; else | ||
- if ``gi`` can be imported, use it; else | ||
- if ``pgi`` can be imported, use it; else | ||
- error out. | ||
Thus, to force usage of PGI when both bindings are installed, import it first. | ||
.. _PGI: https://pgi.readthedocs.io/en/latest/ | ||
.. _PyGObject: http://pygobject.readthedocs.io/en/latest/# |
41 changes: 41 additions & 0 deletionslib/matplotlib/backends/_gtk3_compat.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
GObject compatibility loader; supports ``gi`` and ``pgi``. | ||
The binding selection rules are as follows: | ||
- if ``gi`` has already been imported, use it; else | ||
- if ``pgi`` has already been imported, use it; else | ||
- if ``gi`` can be imported, use it; else | ||
- if ``pgi`` can be imported, use it; else | ||
- error out. | ||
Thus, to force usage of PGI when both bindings are installed, import it first. | ||
""" | ||
from __future__ import (absolute_import, division, print_function, | ||
unicode_literals) | ||
import six | ||
import importlib | ||
import sys | ||
if "gi" in sys.modules: | ||
import gi | ||
elif "pgi" in sys.modules: | ||
import pgi as gi | ||
else: | ||
try: | ||
import gi | ||
except ImportError: | ||
try: | ||
import pgi as gi | ||
except ImportError: | ||
raise ImportError("The Gtk3 backend requires PyGObject or pgi") | ||
gi.require_version("Gtk", "3.0") | ||
globals().update( | ||
{name: | ||
importlib.import_module("{}.repository.{}".format(gi.__name__, name)) | ||
for name in ["GLib", "GObject", "Gtk", "Gdk"]}) |
29 changes: 5 additions & 24 deletionslib/matplotlib/backends/backend_gtk3.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/matplotlib/backends/backend_gtk3agg.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/matplotlib/backends/backend_gtk3cairo.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
27 changes: 16 additions & 11 deletionslib/matplotlib/tests/test_backends_interactive.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.