Skip to content

Commit

Permalink
Remove PyGtk references
Browse files Browse the repository at this point in the history
PyGTK is a dead project that hasn't seen any updates in over a decade
(since the release of GTK version 3) [1][2]. This is dead code.

[1] https://pypi.org/project/PyGTK/#history
[2] https://en.wikipedia.org/wiki/PyGTK

Signed-off-by: Stephen Finucane <[email protected]>
  • Loading branch information
stephenfin committed May 18, 2022
1 parent 781603e commit 8580288
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
30 changes: 0 additions & 30 deletions src/pyperclip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,28 +148,6 @@ def paste_osx_pyobjc():
return copy_osx_pyobjc, paste_osx_pyobjc


def init_gtk_clipboard():
global gtk
import gtk

def copy_gtk(text):
global cb
text = _stringifyText(text) # Converts non-str values to str.
cb = gtk.Clipboard()
cb.set_text(text)
cb.store()

def paste_gtk():
clipboardContents = gtk.Clipboard().wait_for_text()
# for python 2, returns None if the clipboard is blank.
if clipboardContents is None:
return ''
else:
return clipboardContents

return copy_gtk, paste_gtk


def init_qt_clipboard():
global QApplication
# $DISPLAY should exist
Expand Down Expand Up @@ -561,13 +539,6 @@ def determine_clipboard():

# Setup for the LINUX platform:
if HAS_DISPLAY:
try:
import gtk # check if gtk is installed
except ImportError:
pass # We want to fail fast for all non-ImportError exceptions.
else:
return init_gtk_clipboard()

if (
os.environ.get("WAYLAND_DISPLAY") and
_executable_exists("wl-copy")
Expand Down Expand Up @@ -624,7 +595,6 @@ def set_clipboard(clipboard):
clipboard_types = {
"pbcopy": init_osx_pbcopy_clipboard,
"pyobjc": init_osx_pyobjc_clipboard,
"gtk": init_gtk_clipboard,
"qt": init_qt_clipboard, # TODO - split this into 'qtpy', 'pyqt4', and 'pyqt5'
"xclip": init_xclip_clipboard,
"xsel": init_xsel_clipboard,
Expand Down
12 changes: 1 addition & 11 deletions tests/test_pyperclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pyperclip import _executable_exists, HAS_DISPLAY
from pyperclip import (init_osx_pbcopy_clipboard, init_osx_pyobjc_clipboard,
init_dev_clipboard_clipboard,
init_gtk_clipboard, init_qt_clipboard,
init_qt_clipboard,
init_xclip_clipboard, init_xsel_clipboard,
init_wl_clipboard,
init_klipper_clipboard, init_no_clipboard)
Expand Down Expand Up @@ -134,16 +134,6 @@ class TestOSX(_TestClipboard):
clipboard = init_osx_pyobjc_clipboard()


class TestGtk(_TestClipboard):
if HAS_DISPLAY:
try:
import gtk
except ImportError:
pass
else:
clipboard = init_gtk_clipboard()


class TestQt(_TestClipboard):
if HAS_DISPLAY:
try:
Expand Down

0 comments on commit 8580288

Please sign in to comment.