-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update clipboard Qt-bindings for flexiblity and Python3 compatibility #17723
Changes from 12 commits
aabd9a8
2ff378e
b03e69c
d16a202
03b7b1a
eb0b0e7
a97bd8b
7baaccc
432896d
4814f88
a8a91c8
f3a77a9
7573d05
d9c339b
53ee4bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,7 @@ I/O | |
- Bug in :func:`read_msgpack` with a non existent file is passed in Python 2 (:issue:`15296`) | ||
- Bug in :func:`read_csv` where a ``MultiIndex`` with duplicate columns was not being mangled appropriately (:issue:`18062`) | ||
- Bug in :func:`read_sas` where a file with 0 variables gave an ``AttributeError`` incorrectly. Now it gives an ``EmptyDataError`` (:issue:`18184`) | ||
- :func:`pandas.read_clipboard` updated to use qtpy, falling back to PyQt5 and then PyQt4, adding compatibility with Python3 and multiple python-qt bindings (:issue:`17722`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to other enhancements |
||
- | ||
- | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ | |
On Linux, install xclip or xsel via package manager. For example, in Debian: | ||
sudo apt-get install xclip | ||
|
||
Otherwise on Linux, you will need the gtk or PyQt4 modules installed. | ||
Otherwise on Linux, you will need the gtk, qtpy or PyQt modules installed. | ||
qtpy also requires a python-qt-bindings module: PyQt4, PyQt5, PySide, PySide2 | ||
|
||
gtk and PyQt4 modules are not available for Python 3, | ||
and this module does not work with PyGObject yet. | ||
|
@@ -34,9 +35,9 @@ | |
init_klipper_clipboard, init_no_clipboard) | ||
from .windows import init_windows_clipboard | ||
|
||
# `import PyQt4` sys.exit()s if DISPLAY is not in the environment. | ||
# `import qtpy` sys.exit()s if DISPLAY is not in the environment. | ||
# Thus, we need to detect the presence of $DISPLAY manually | ||
# and not load PyQt4 if it is absent. | ||
# and not load qtpy if it is absent. | ||
HAS_DISPLAY = os.getenv("DISPLAY", False) | ||
CHECK_CMD = "where" if platform.system() == "Windows" else "which" | ||
|
||
|
@@ -68,9 +69,23 @@ def determine_clipboard(): | |
return init_gtk_clipboard() | ||
|
||
try: | ||
# Check if PyQt4 is installed | ||
import PyQt4 # noqa | ||
# qtpy is a small abstraction layer that lets you write | ||
# applications using a single api call to either PyQt or PySide | ||
# https://pypi.python.org/pypi/QtPy | ||
import qtpy # noqa | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this fall back to |
||
except ImportError: | ||
# If qtpy isn't installed, fall back on importing PyQt5, or PyQt5 | ||
try: | ||
import PyQt5 # noqa | ||
except ImportError: | ||
try: | ||
import PyQt4 # noqa | ||
except ImportError: | ||
pass # fail fast for all non-ImportError exceptions. | ||
else: | ||
return init_qt_clipboard() | ||
else: | ||
return init_qt_clipboard() | ||
pass | ||
else: | ||
return init_qt_clipboard() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can list qtpy here as well