Fix `pandas` clipboard
@@ -50,6 +50,7 @@ import platform
import subprocess
import time
import warnings
+import sys
# `import PyQt4` sys.exit()s if DISPLAY is not in the environment.
# Thus, we need to detect the presence of $DISPLAY manually
@@ -101,6 +102,18 @@ def _stringifyText(text) -> str:
return str(text)
+def init_ios_clipboard():
+
+ def copy_ios(text):
+ import pasteboard
+ pasteboard.set_string(text)
+
+ def paste_ios():
+ import pasteboard
+ return pasteboard.string()
+
+ return copy_ios, paste_ios
+
def init_osx_pbcopy_clipboard():
def copy_osx_pbcopy(text):
text = _stringifyText(text) # Converts non-str values to str.
@@ -521,6 +534,9 @@ def determine_clipboard():
elif os.name == "nt" or platform.system() == "Windows":
return init_windows_clipboard()
+ if sys.platform == "ios":
+ return init_ios_clipboard()
+
if platform.system() == "Linux":
with open("/proc/version", "r") as f:
if "Microsoft" in f.read():
@@ -586,6 +602,7 @@ def set_clipboard(clipboard):
global copy, paste
clipboard_types = {
+ "pyto": init_ios_clipboard,
"pbcopy": init_osx_pbcopy_clipboard,
"pyobjc": init_osx_pyobjc_clipboard,
"qt": init_qt_clipboard, # TODO - split this into 'qtpy', 'pyqt4', and 'pyqt5'
