{
"info": {
"author": "Jonathan Eunice",
"author_email": "jonathan.eunice@gmail.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Environment :: MacOS X :: Cocoa",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Markup",
"Topic :: Text Processing :: Markup :: HTML"
],
"description": "| |version| |versions|\n\n.. |version| image:: http://img.shields.io/pypi/v/richxerox.svg?style=flat\n :alt: PyPI Package latest release\n :target: https://pypi.python.org/pypi/richxerox\n\n.. |versions| image:: https://img.shields.io/pypi/pyversions/richxerox.svg\n :alt: Supported versions\n :target: https://pypi.python.org/pypi/richxerox\n\nRich text cut/copy/paste for macOS (n\u00e9e Mac OS X).\n\nUsage\n=====\n\n.. code-block:: python\n\n from richxerox import *\n\n print available() # what kind of data is on the clipboard?\n\n print paste() # get data in the default format ('text')\n print paste(format='text') # get text (Unicode)\n print paste(format='rtf') # get RTF\n print paste(format='html') # get HTML\n\n print \"ALL CONTENTS:\\n\", pasteall()\n\n clear()\n print \"ALL CONTENTS AFTER CLEAR:\\n\", pasteall()\n\n r = \"{\\\\rtf1\\\\ansi\\\\ansicpg1252\\\\cocoartf1187\\\\cocoasubrtf390\\n\" \\\n \"{\\\\fonttbl\\\\f0\\\\froman\\\\fcharset0 Times-Roman;}\\n{\\\\colortbl;\" \\\n \"\\\\red255\\\\green255\\\\blue255;}\\n\\\\deftab720\\n\\\\pard\\\\pardeftab720\" \\\n \"\\n\\n\\\\f0\\\\fs24 \\\\cf0 This is \\n\\\\b good\\n\\\\b0 !}\"\n h = \"this is good!\"\n copy(text=\"this is good!\", html=h, rtf=r)\n\n print \"ALL CONTENTS AFTER COPY:\\n\", pasteall()\n\nThe API is modeled on that of `xerox `_,\nwith simple ``copy()`` and ``paste()`` operations.\n\nThink of ``paste()`` as pasting *into* your program and ``copy()`` as copying\n*from* your program.\n\nThe main difference in the API is that, given the different formats used in rich\ntext, one must specify the format provided or needed if it is not plain text.\nThis is done through keyword-style arguments.\n\nAlternative API\n===============\n\nIf you prefer an object-oriented API:\n\n.. code-block:: python\n\n from richxerox import *\n\n print pasteboard.get_contents(format='html') # paste\n pasteboard.clear() # clear\n pasteboard.set_contents(text=\"this is good!\", # copy\n html=h, rtf=r)\n\n print pasteboard.get_all_contents() # pasteall\n\nBackground\n==========\n\nI searched long and hard but couldn't find a simple Python module that made\n``copy`` and ``paste`` operations on macOS easy and straightforward. `xerox\n`_ works well, but it only supports plain\ntext. What about browsers and word processors that export rich text with\nhyperlinks, styles, and so on? How can you access *that* data?\n\nAfter banging my head against this a few times, I eventually found code samples\nI could adapt and make work without understanding the entirety of Apple's\n``Foundation`` and ``AppKit``. This module is the result.\n\nDescent Into RTF\n================\n\nEven in this HTML-everywhere age, Apple and macOS apps are unfortunately `RTF\n`_-centric.\n\n* In my experience, RTF is often not robustly passed between applications.\n Different apps interpret or render the same RTF differently, so font\n sizes and other characteristics change.\n\n* RTF is *extremely* verbose. Microsoft Word, for instance, emits 29,807\n characters as the copy/cut representation of \"This is **good**!\"\n Microsoft is known for verbose exports, and RTF itself attempts to\n represent whole documents rather than individual snippets. Still, that's\n roughly 1,000x (a.k.a. three decimal orders of magnitude) as verbose as HTML.\n Try copying existing text in some\n application, then running ``pasteall()`` to get your own taste of this\n madness.\n\n* If you put multiple forms of text on the clipboard, you don't have much if\n any control which one an application will use when you ask it to \"paste\"\n data. If you want a single format, better to just put that one format on the\n clipboard.\n\nWhile Mac apps occasionally put HTML contents on the pasteboard, RTF seems\nto be the most common *lingua franca*. I've not found any particularly good,\nrobust, or up-to-date Python tools for parsing and transforming RTF. The handy\n`textutil\n`_\ntool will, however, convert an RTF file into quite clean HTML, like so::\n\n textutil -convert html temp.rtf\n\nyielding ``temp.html``. This can be parsed and manipulated with `lxml\n`_ or your favorite HTML/XML library.\n\nNotes\n=====\n\n* Version 1.0.1 withdraws the wheel packaging from distribution.\n Wheels are in general great, but\n `it was reported `_\n to be causing installability breakage depending on the local install\n status of Mac foundation libraries, given that wheels are a preferred\n and somewhat canned install format. Withdrawing wheels should force a\n more local-system-centered set of dependencies to be installed.\n If you still have trouble, try installing\n `pyobjc `_ manually before\n installing ``richxerox``.\n\n* Version 1.0.0 updates the testing matrix. Latest versions of 2.7, 3.3,\n 3.4, 3.5, and 3.6 are confirmed working. Old,\n pre-[SemVer](http://semver.org/) versions have been removed from PyPI;\n they were causing some install problems. Python 3.2 has been withdrawn\n from support as both ancient and no longer being properly supported in\n my local test rig.)\n\n* As of version 0.6, much more robust handling of Unicode characters.\n Better auto-install, including installing foundation ``pyobjc``\n module if necessary. (`pyobjc` auto-install only works reliably\n on Python 2.7 and above,\n so official support for Python 2.6 has been withdrawn.)\n\n* If the underlying `pyobjc` library needs to be installed, the process\n will take a *long* time. For example, 4 hours 7 minutes. Don'ty just get\n coffee while it's installing. Take lunch. A long, languorous lunch. And\n then maybe have a nap.\n\n* Version 0.5 had a mistake in Unicode handling. Even though it passed all\n tests, it over-quoted Unicode coming from real apps. Fixed.\n\n* Code inspired by and/or based on Genba's `Reading URLs from OS X clipboard with PyObjC `_\n and Carl M. Johnson's `copy_paste.py `_\n\n* See also `NSPasteboard docs `_,\n `a discussion on UTIs `_, and\n John Siracusa's `discussion of the evolution of Mac OS types `_\n\n* The author, `Jonathan Eunice `_ or\n `@jeunice on Twitter `_\n welcomes your comments and suggestions.\n\nInstallation\n============\n\nTo install the latest version::\n\n pip install -U richxerox\n\nIn some cases with multiple Python installations, ``pip`` and the Python\nininstallation can become disconnected. If the above does not work, try\ninstalling through Python directly. You can also specify a particular\nversion of Python to install under.::\n\n python -m pip install -U richxerox\n\n(You may need to prefix these with ``sudo`` to authorize installation.)\n",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://bitbucket.org/jeunice/richxerox",
"keywords": "Mac OS X copy paste clipboard pasteboard rich text RTF HTML",
"license": "",
"maintainer": "",
"maintainer_email": "",
"name": "richxerox",
"package_url": "https://pypi.org/project/richxerox/",
"platform": "",
"project_url": "https://pypi.org/project/richxerox/",
"project_urls": {
"Homepage": "https://bitbucket.org/jeunice/richxerox"
},
"release_url": "https://pypi.org/project/richxerox/1.0.1/",
"requires_dist": null,
"requires_python": "",
"summary": "copy/paste for Mac OS X for rich text (HTML/RTF) rather than plain text",
"version": "1.0.1"
},
"last_serial": 3340035,
"releases": {
"1.0.0": [
{
"comment_text": "",
"digests": {
"md5": "062cae7ddcc252684ce07539fbb4b8e3",
"sha256": "9a2dded71b1d38b67ca1620cf72ce23e59bfcf4fd0ad560dc9c4d63c30dcd30e"
},
"downloads": -1,
"filename": "richxerox-1.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "062cae7ddcc252684ce07539fbb4b8e3",
"packagetype": "bdist_wheel",
"python_version": "2.7",
"requires_python": null,
"size": 10389,
"upload_time": "2016-06-24T15:22:38",
"url": "https://files.pythonhosted.org/packages/9c/04/78f1a78474df9e4c8cd04c433760ed581cebf26b981c9c73b02f742acd25/richxerox-1.0.0-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "7a4801f62bc4a841aeb3de02e5f15dd7",
"sha256": "2e855f7d7db3cefd25eb3d1189d30f15c4cb88c062ffbaadad7d463171059269"
},
"downloads": -1,
"filename": "richxerox-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "7a4801f62bc4a841aeb3de02e5f15dd7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7451,
"upload_time": "2016-06-24T15:22:25",
"url": "https://files.pythonhosted.org/packages/1f/10/6f969fd984861ed1e8638dd44c3b42c79c410ca0d5561721e9a7aa1d4a6d/richxerox-1.0.0.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "47fc51af29e45d9ee87327c2eada83b9",
"sha256": "f0355ea3b4291559d20da988d4364a2e84b9290c72c3de2b4d9c0447dbd292d1"
},
"downloads": -1,
"filename": "richxerox-1.0.0.zip",
"has_sig": false,
"md5_digest": "47fc51af29e45d9ee87327c2eada83b9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15259,
"upload_time": "2016-06-24T15:21:58",
"url": "https://files.pythonhosted.org/packages/ec/d4/20449d588aea2c89cfebf937a5afbef95eb65ff91afe612c07b66ab4db9e/richxerox-1.0.0.zip"
}
],
"1.0.1": [
{
"comment_text": "",
"digests": {
"md5": "29a866141e4b7821cd0595bdb2bbe0ee",
"sha256": "ea549a8264356a5e48adb9d6d0593a42eca307469424216c7a3cf8aeabf43bbf"
},
"downloads": -1,
"filename": "richxerox-1.0.1.zip",
"has_sig": false,
"md5_digest": "29a866141e4b7821cd0595bdb2bbe0ee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16521,
"upload_time": "2017-11-16T23:13:35",
"url": "https://files.pythonhosted.org/packages/a8/4c/a85431f1b2de8277a6ba57fc28b10f0ab6f55b306790fc20a14b1d396988/richxerox-1.0.1.zip"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "29a866141e4b7821cd0595bdb2bbe0ee",
"sha256": "ea549a8264356a5e48adb9d6d0593a42eca307469424216c7a3cf8aeabf43bbf"
},
"downloads": -1,
"filename": "richxerox-1.0.1.zip",
"has_sig": false,
"md5_digest": "29a866141e4b7821cd0595bdb2bbe0ee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16521,
"upload_time": "2017-11-16T23:13:35",
"url": "https://files.pythonhosted.org/packages/a8/4c/a85431f1b2de8277a6ba57fc28b10f0ab6f55b306790fc20a14b1d396988/richxerox-1.0.1.zip"
}
]
}