Skip to content

remove outdated gtk package from code #26590

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

Merged
merged 5 commits into from
Jun 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ Optional Dependencies
`qtpy <https://github.com/spyder-ide/qtpy>`__ (requires PyQt or PySide),
`PyQt5 <https://www.riverbankcomputing.com/software/pyqt/download5>`__,
`PyQt4 <http://www.riverbankcomputing.com/software/pyqt/download>`__,
`pygtk <http://www.pygtk.org/>`__,
`xsel <http://www.vergenet.net/~conrad/software/xsel/>`__, or
`xclip <https://github.com/astrand/xclip/>`__: necessary to use
:func:`~pandas.read_clipboard`. Most package managers on Linux distributions will have ``xclip`` and/or ``xsel`` immediately available for installation.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3272,7 +3272,7 @@ We can see that we got the same content back, which we had earlier written to th

.. note::

You may need to install xclip or xsel (with gtk, PyQt5, PyQt4 or qtpy) on Linux to use these methods.
You may need to install xclip or xsel (with PyQt5, PyQt4 or qtpy) on Linux to use these methods.

.. _io.pickle:

Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.25.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ Other API Changes
- The ``arg`` argument in :meth:`pandas.core.groupby.DataFrameGroupBy.agg` has been renamed to ``func`` (:issue:`26089`)
- The ``arg`` argument in :meth:`pandas.core.window._Window.aggregate` has been renamed to ``func`` (:issue:`26372`)
- Most Pandas classes had a ``__bytes__`` method, which was used for getting a python2-style bytestring representation of the object. This method has been removed as a part of dropping Python2 (:issue:`26447`)
- Removed support of gtk package for clipboards (:issue:`26563`)

.. _whatsnew_0250.deprecations:

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2679,7 +2679,7 @@ def to_clipboard(self, excel=True, sep=None, **kwargs):
-----
Requirements for your platform.

- Linux : `xclip`, or `xsel` (with `gtk` or `PyQt4` modules)
- Linux : `xclip`, or `xsel` (with `PyQt4` modules)
- Windows : none
- OS X : none

Expand Down
21 changes: 5 additions & 16 deletions pandas/io/clipboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@
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, qtpy or PyQt modules installed.
Otherwise on Linux, you will need the 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.
This module does not work with PyGObject yet.
"""
__version__ = '1.5.27'

import platform
import os
import subprocess
from .clipboards import (init_osx_clipboard,
init_gtk_clipboard, init_qt_clipboard,
init_xclip_clipboard, init_xsel_clipboard,
init_klipper_clipboard, init_no_clipboard)
from .clipboards import (
init_osx_clipboard, init_qt_clipboard, init_xclip_clipboard,
init_xsel_clipboard, init_klipper_clipboard, init_no_clipboard)
from .windows import init_windows_clipboard

# `import qtpy` sys.exit()s if DISPLAY is not in the environment.
Expand Down Expand Up @@ -60,14 +58,6 @@ def determine_clipboard():
return init_osx_clipboard()
if HAS_DISPLAY:
# Determine which command/module is installed, if any.
try:
# Check if gtk is installed
import gtk # noqa
except ImportError:
pass
else:
return init_gtk_clipboard()

try:
# qtpy is a small abstraction layer that lets you write
# applications using a single api call to either PyQt or PySide
Expand Down Expand Up @@ -104,7 +94,6 @@ def set_clipboard(clipboard):
global copy, paste

clipboard_types = {'osx': init_osx_clipboard,
'gtk': init_gtk_clipboard,
'qt': init_qt_clipboard,
'xclip': init_xclip_clipboard,
'xsel': init_xsel_clipboard,
Expand Down
16 changes: 0 additions & 16 deletions pandas/io/clipboard/clipboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,6 @@ def paste_osx():
return copy_osx, paste_osx


def init_gtk_clipboard():
import gtk

def copy_gtk(text):
global cb
cb = gtk.Clipboard()
cb.set_text(text)
cb.store()

def paste_gtk():
clipboardContents = gtk.Clipboard().wait_for_text()
return clipboardContents

return copy_gtk, paste_gtk


def init_qt_clipboard():
# $DISPLAY should exist

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/clipboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def to_clipboard(obj, excel=True, sep=None, **kwargs): # pragma: no cover
Notes
-----
Requirements for your platform
- Linux: xclip, or xsel (with gtk or PyQt4 modules)
- Linux: xclip, or xsel (with PyQt4 modules)
- Windows:
- OS X:
"""
Expand Down