gdesk.rectable.htmlclip module¶
Edit on Jan 02, 2020 @author: the_RR Adapted for python 3.4+
Requires pywin32 original: http://code.activestate.com/recipes/474121/
# HtmlClipboard # An interface to the “HTML Format” clipboard data format
__author__ = “Phillip Piper (jppx1[at]bigfoot.com)” __date__ = “2006-02-21” __version__ = “0.1”
- gdesk.rectable.htmlclip.DumpHtml()¶
- gdesk.rectable.htmlclip.GetHtml()¶
Return the Html fragment from the clipboard or None if there is no Html in the clipboard.
- gdesk.rectable.htmlclip.HasHtml()¶
Return True if there is a Html fragment in the clipboard..
- class gdesk.rectable.htmlclip.HtmlClipboard¶
Bases:
object
- CF_HTML = None¶
- DEFAULT_HTML_BODY = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD></HEAD><BODY><!--StartFragment-->%s<!--EndFragment--></BODY></HTML>'¶
- DecodeClipboardSource(src)¶
Decode the given string to figure out the details of the HTML that’s on the string
- EncodeClipboardSource(html, fragmentStart, fragmentEnd, selectionStart, selectionEnd, source)¶
Join all our bits of information into a string formatted as per the HTML format specs.
- GetAvailableFormats()¶
Return a possibly empty list of formats available on the clipboard
- GetCfHtml()¶
Return the FORMATID of the HTML format
- GetFragment(refresh=False)¶
Return the Html fragment. A fragment is well-formated HTML enclosing the selected text
- GetFromClipboard()¶
Read and decode the HTML from the clipboard
- GetHtml(refresh=False)¶
Return the entire Html document
- GetSelection(refresh=False)¶
Return the part of the HTML that was selected. It might not be well-formed.
- GetSource(refresh=False)¶
Return the URL of the source of this HTML
- HasHtmlFormat()¶
Return a boolean indicating if the clipboard has data in HTML format
- MARKER_BLOCK = 'Version:(\\S+)\\s+StartHTML:(\\d+)\\s+EndHTML:(\\d+)\\s+StartFragment:(\\d+)\\s+EndFragment:(\\d+)\\s+SourceURL:(\\S+)'¶
- MARKER_BLOCK_EX = 'Version:(\\S+)\\s+StartHTML:(\\d+)\\s+EndHTML:(\\d+)\\s+StartFragment:(\\d+)\\s+EndFragment:(\\d+)\\s+StartSelection:(\\d+)\\s+EndSelection:(\\d+)\\s+SourceURL:(\\S+)'¶
- MARKER_BLOCK_EX_RE = re.compile('Version:(\\S+)\\s+StartHTML:(\\d+)\\s+EndHTML:(\\d+)\\s+StartFragment:(\\d+)\\s+EndFragment:(\\d+)\\s+StartSelection:(\\d+)\\s+EndSelection:(\\d+)\\s+SourceURL:(\\S+)')¶
- MARKER_BLOCK_OUTPUT = 'Version:1.0\r\nStartHTML:%09d\r\nEndHTML:%09d\r\nStartFragment:%09d\r\nEndFragment:%09d\r\nStartSelection:%09d\r\nEndSelection:%09d\r\nSourceURL:%s\r\n'¶
- MARKER_BLOCK_RE = re.compile('Version:(\\S+)\\s+StartHTML:(\\d+)\\s+EndHTML:(\\d+)\\s+StartFragment:(\\d+)\\s+EndFragment:(\\d+)\\s+SourceURL:(\\S+)')¶
- PutFragment(fragment, selection=None, html=None, source=None)¶
Put the given well-formed fragment of Html into the clipboard. selection, if given, must be a literal string within fragment. html, if given, must be a well-formed Html document that textually contains fragment and its required markers.
- PutToClipboard(html, fragmentStart, fragmentEnd, selectionStart, selectionEnd, source='None')¶
Replace the Clipboard contents with the given html information.
- gdesk.rectable.htmlclip.PutHtml(fragment)¶
Put the given fragment into the clipboard. Convenience function to do the most common operation