module documentation
(source)

Utilities to work with the clipboard for copy-pasting

Some functions defined here are also re-used for drag-and-drop functionality, which works similar to the clipboard, but has a less straight forward API.

Class ClipboardData Wrapper for data that can be set on the clipboard and pasted multiple formats
Class ClipboardManager Wrapper for Gtk.Clipboard, supporting specific data formats
Class InterWikiLinkData Undocumented
Class MockSelectionData Adapter to allow usage of ClipboardData as input for parsetree_from_selectiondata()
Class PageLinkData Undocumented
Class ParseTreeData Undocumented
Class UriData Undocumented
Class Win32HtmlFormat This class adds support for Windows "HTML Format" clipboard content type
Function deserialize_image Undocumented
Function deserialize_parse_tree Undocumented
Function deserialize_urilist Undocumented
Function pack_urilist Undocumented
Function parsetree_from_selectiondata Function to get a parsetree based on the selectiondata contents if at all possible. Used by both copy-paste and drag-and-drop methods.
Function serialize_parse_tree Undocumented
Function textbuffer_register_serialize_formats Undocumented
Function unpack_urilist Undocumented
Function wrap_html Function to wrap html with appropriate headers based on target type
Constant HTML_HEAD Undocumented
Constant HTML_TARGET_ID Undocumented
Constant HTML_TARGET_NAMES Undocumented
Constant HTML_TARGETS Undocumented
Constant IMAGE_TARGET_ID Undocumented
Constant IMAGE_TARGET_NAMES Undocumented
Constant IMAGE_TARGETS Undocumented
Constant PAGELIST_TARGET Undocumented
Constant PAGELIST_TARGET_ID Undocumented
Constant PAGELIST_TARGET_NAME Undocumented
Constant PARSETREE_ACCEPT_TARGET_NAMES Undocumented
Constant PARSETREE_ACCEPT_TARGETS Undocumented
Constant PARSETREE_TARGET Undocumented
Constant PARSETREE_TARGET_ID Undocumented
Constant PARSETREE_TARGET_NAME Undocumented
Constant TEXT_TARGET_ID Undocumented
Constant TEXT_TARGET_NAMES Undocumented
Constant TEXT_TARGETS Undocumented
Constant URI_TARGET_ID Undocumented
Constant URI_TARGET_NAMES Undocumented
Constant URI_TARGETS Undocumented
Variable Clipboard Undocumented
Variable logger Undocumented
Variable name Undocumented
Variable SelectionClipboard Undocumented
Function _get_image_info Undocumented
Function _link_tree Undocumented
Variable _internal_selection_data Undocumented
def deserialize_image(register_buf, content_buf, iter, data, length, create_tags, user_data): (source)

Undocumented

def deserialize_parse_tree(register_buf, content_buf, iter, data, length, create_tags, user_data): (source)

Undocumented

def deserialize_urilist(register_buf, content_buf, iter, data, length, create_tags, user_data): (source)

Undocumented

def pack_urilist(links): (source)

Undocumented

def parsetree_from_selectiondata(selectiondata, notebook, path=None, text_format='plain'): (source)

Function to get a parsetree based on the selectiondata contents if at all possible. Used by both copy-paste and drag-and-drop methods.

The 'notebook' and optional 'path' arguments are used to format links relative to the page which is the target for the pasting or drop operation.

NOTE: this method can have a side affect where files are placed in the attachment folder of the page.

  • For image data, a new image file is created
  • For parsetree data containing inline images, the image files are copied to the attachment folder
Parameters
selectiondataa Gtk.SelectionData object
notebooka Notebook object
patha Path object
text_format

format to parse pasted text, as a special case

  • "verbatim" will wrap content in VERBARIM_BLOCK or VERBATIM element based on the content
  • "verbatim-pre" will wrap the content in a VERBATIM_BLOCK element and
  • "verbatim-code" will wrap the content in a VERBATIM element
Returns
a ParseTree or None
def serialize_parse_tree(register_buf, content_buf, start, end, user_data): (source)

Undocumented

def textbuffer_register_serialize_formats(buffer, notebook, page): (source)

Undocumented

def unpack_urilist(text): (source)

Undocumented

def wrap_html(html, target): (source)
Function to wrap html with appropriate headers based on target type
HTML_HEAD: str = (source)

Undocumented

Value
'''<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="Description" content="Copy-Paste Buffer">
<meta name="Generator" content="Zim">'''
HTML_TARGET_ID: int = (source)

Undocumented

Value
8
HTML_TARGET_NAMES: tuple[str, ...] = (source)

Undocumented

Value
('text/html', 'HTML Format')
HTML_TARGETS = (source)

Undocumented

Value
tuple([(name, 0, HTML_TARGET_ID) for name in HTML_TARGET_NAMES])
IMAGE_TARGET_ID: int = (source)

Undocumented

Value
6
IMAGE_TARGET_NAMES = (source)

Undocumented

Value
tuple([target[0] for target in IMAGE_TARGETS])
IMAGE_TARGETS = (source)

Undocumented

Value
tuple(((name, 0, IMAGE_TARGET_ID) for name in ['image/png', 'image/x-wmf',
    'application/x-navi-animation', 'image/bmp', 'image/x-bmp',
    'image/x-MS-bmp', 'image/gif', 'image/x-icns', 'image/x-icon',
    'image/x-ico', 'image/x-win-bitmap', 'image/vnd.microsoft.icon',
    'application/ico', 'image/ico', 'image/icon', 'text/ico', 'image/jpeg',
    'image/x-portable-anymap', 'image/x-portable-bitmap',
    'image/x-portable-graymap', 'image/x-portable-pixmap',
...
PAGELIST_TARGET = (source)

Undocumented

Value
(PAGELIST_TARGET_NAME, 0, PAGELIST_TARGET_ID)
PAGELIST_TARGET_ID: int = (source)

Undocumented

Value
3
PAGELIST_TARGET_NAME: str = (source)

Undocumented

Value
'text/x-zim-page-list'
PARSETREE_ACCEPT_TARGET_NAMES = (source)

Undocumented

Value
tuple([target[0] for target in PARSETREE_ACCEPT_TARGETS])
PARSETREE_ACCEPT_TARGETS = (source)
PARSETREE_TARGET = (source)

Undocumented

Value
(PARSETREE_TARGET_NAME, 0, PARSETREE_TARGET_ID)
PARSETREE_TARGET_ID: int = (source)

Undocumented

Value
1
PARSETREE_TARGET_NAME: str = (source)

Undocumented

Value
'text/x-zim-parsetree'
TEXT_TARGET_ID: int = (source)

Undocumented

Value
9
TEXT_TARGET_NAMES = (source)

Undocumented

Value
tuple([target[0] for target in TEXT_TARGETS])
TEXT_TARGETS = (source)

Undocumented

Value
tuple(((name, 0, TEXT_TARGET_ID) for name in ['UTF8_STRING', 'COMPOUND_TEXT',
    'TEXT', 'STRING', 'text/plain;charset=utf-8', 'text/plain']))
URI_TARGET_ID: int = (source)

Undocumented

Value
7
URI_TARGET_NAMES = (source)

Undocumented

Value
tuple([target[0] for target in URI_TARGETS])
URI_TARGETS = (source)

Undocumented

Value
(('text/uri-list', 0, URI_TARGET_ID))
Clipboard = (source)

Undocumented

logger = (source)

Undocumented

name = (source)

Undocumented

SelectionClipboard = (source)

Undocumented

def _get_image_info(targetname): (source)

Undocumented

def _link_tree(links, notebook, path): (source)

Undocumented

_internal_selection_data = (source)

Undocumented