Skip to content

Commit

Permalink
Update Clipboard toolkit documentation
Browse files Browse the repository at this point in the history
Re: #77.

The Clipboard toolkit documentation section now includes
information on the cross-platform Clipboard class as well as which
Clipboard class is the default on which platform.
  • Loading branch information
drmfinlay committed Jul 10, 2020
1 parent b288491 commit 4ebdd7a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
16 changes: 14 additions & 2 deletions documentation/clipboard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ this toolkit. Each instance of this class is a container with a structure
similar to the Windows system clipboard, mapping content formats to
content data.

The :class:`dragonfly.util.clipboard.Clipboard` can be used on other
platforms, such as macOS or Linux. Its API is compatible with the Windows
clipboard class **except** for the :meth:`has_format`, :meth:`get_format`
and :meth:`set_format` methods, as the class doesn't support multiple
formats.

Usage examples
----------------------------------------------------------------------------
Expand Down Expand Up @@ -61,14 +66,21 @@ achieved as follows: ::
Clipboard(unicode=u'asdf', text, oemtext, locale)


Clipboard class
Windows Clipboard class
----------------------------------------------------------------------------

.. autoclass:: dragonfly.windows.clipboard.Clipboard
:members:


Clipboard context manager function
Cross-platform Clipboard class
----------------------------------------------------------------------------

.. autoclass:: dragonfly.util.clipboard.Clipboard
:members:


Windows Clipboard context manager function
----------------------------------------------------------------------------

.. autofunction:: dragonfly.windows.clipboard.win32_clipboard_ctx
17 changes: 13 additions & 4 deletions dragonfly/util/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,20 @@ def get_text(self):

class Clipboard(BaseClipboard):
"""
This class provides multi-platform clipboard support through pyperclip.
Cross-platform class for interacting with the system clipboard via the
`pyperclip <https://pyperclip.readthedocs.io/en/latest/>`__ Python
package.
This is Dragonfly's default clipboard class on platforms other than
Windows.
.. note::
This class does work on Windows, however the Windows
:class:`dragonfly.windows.clipboard.Clipboard` class should be used
instead because this class only currently supports the Unicode text
clipboard format.
The only currently supported Windows clipboard format is Unicode text.
The Clipboard class in dragonfly.windows.clipboard can be used instead
if required.
"""

# ----------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions dragonfly/windows/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def win32_clipboard_ctx():
class Clipboard(BaseClipboard):
"""
Class for interacting with the Windows system clipboard.
This is Dragonfly's default clipboard class on Windows.
"""

#-----------------------------------------------------------------------
Expand Down

0 comments on commit 4ebdd7a

Please sign in to comment.