eric5.UI.Previewer

Module implementing a previewer widget for HTML, Markdown and ReST files.

Global Attributes

None

Classes

PreviewProcessingThread Class implementing a thread to process some text into HTML usable by the previewer view.
Previewer Class implementing a previewer widget for HTML, Markdown and ReST files.
_StrikeThroughExtension Class is placed here, because it depends on imported markdown, and markdown import is lazy.

Functions

None


PreviewProcessingThread

Class implementing a thread to process some text into HTML usable by the previewer view.

Signals

htmlReady(str,str)
emitted with the file name and processed HTML to signal the availability of the processed HTML

Derived from

QThread

Class Attributes

None

Class Methods

None

Methods

PreviewProcessingThread Constructor
__convertMarkdown Private method to convert Markdown text into HTML.
__convertReST Private method to convert ReST text into HTML.
__getHtml Private method to process the given text depending upon the given language.
__processSSI Private method to process the given text for SSI statements.
process Convert the given text to HTML.
run Thread function to convert the stored data.

Static Methods

None

PreviewProcessingThread (Constructor)

PreviewProcessingThread(parent=None)

Constructor

parent
reference to the parent object (QObject)

PreviewProcessingThread.__convertMarkdown

__convertMarkdown(text)

Private method to convert Markdown text into HTML.

text
text to be processed (string)
Returns:
processed HTML (string)

PreviewProcessingThread.__convertReST

__convertReST(text)

Private method to convert ReST text into HTML.

text
text to be processed (string)
Returns:
processed HTML (string)

PreviewProcessingThread.__getHtml

__getHtml(language, text, ssiEnabled, filePath, rootPath)

Private method to process the given text depending upon the given language.

language
language of the text (string)
text
to be processed (string)
ssiEnabled
flag indicating to do some (limited) SSI processing (boolean)
filePath
file path of the text (string)
rootPath
root path to be used for SSI processing (str)
Returns:
processed HTML text (string)

PreviewProcessingThread.__processSSI

__processSSI(txt, filename, root)

Private method to process the given text for SSI statements.

Note: Only a limited subset of SSI statements are supported.

txt
text to be processed (string)
filename
name of the file associated with the given text (string)
root
directory of the document root (string)
Returns:
processed HTML (string)

PreviewProcessingThread.process

process(filePath, language, text, ssiEnabled, rootPath)

Convert the given text to HTML.

filePath
file path of the text (string)
language
language of the text (string)
text
text to be processed (string)
ssiEnabled
flag indicating to do some (limited) SSI processing (boolean)
rootPath
root path to be used for SSI processing (str)

PreviewProcessingThread.run

run()

Thread function to convert the stored data.

Up


Previewer

Class implementing a previewer widget for HTML, Markdown and ReST files.

Derived from

QWidget, Ui_Previewer

Class Attributes

None

Class Methods

None

Methods

Previewer Constructor
__editorChanged Private slot to handle a change of the current editor.
__editorLanguageChanged Private slot to handle a change of the current editor's language.
__editorTextChanged Private slot to handle changes of an editor's text.
__isPreviewable Private method to check, if a preview can be shown for the given editor.
__previewStateChanged Public slot to toggle the display of the preview.
__restoreScrollBarPositions Private method to restore scroll bar positions for a previewed editor.
__runProcessingThread Private slot to schedule the processing of the current editor's text.
__saveScrollBarPositions Private method to save scroll bar positions for a previewed editor.
__setHtml Private method to set the HTML to the view and restore the scroll bars positions.
__setJavaScriptEnabled Private method to enable/disable JavaScript.
__splitterMoved Private slot to handle the movement of the embedding splitter's handle.
hide Public method to hide the preview widget.
on_jsCheckBox_clicked Private slot to enable/disable JavaScript.
on_previewView_linkClicked Private slot handling the clicking of a link.
on_previewView_titleChanged Private slot to handle a change of the title.
on_ssiCheckBox_clicked Private slot to enable/disable SSI.
show Public method to show the preview widget.
shutdown Public method to perform shutdown actions.

Static Methods

None

Previewer (Constructor)

Previewer(viewmanager, splitter, parent=None)

Constructor

viewmanager
reference to the viewmanager object (ViewManager)
splitter
reference to the embedding splitter (QSplitter)
parent
reference to the parent widget (QWidget)

Previewer.__editorChanged

__editorChanged(editor)

Private slot to handle a change of the current editor.

editor
reference to the editor (Editor)

Previewer.__editorLanguageChanged

__editorLanguageChanged(editor)

Private slot to handle a change of the current editor's language.

editor
reference to the editor (Editor)

Previewer.__editorTextChanged

__editorTextChanged(editor)

Private slot to handle changes of an editor's text.

editor
reference to the editor (Editor)

Previewer.__isPreviewable

__isPreviewable(editor)

Private method to check, if a preview can be shown for the given editor.

editor
reference to an editor (Editor)
Returns:
flag indicating if a preview can be shown (boolean)

Previewer.__previewStateChanged

__previewStateChanged(on)

Public slot to toggle the display of the preview.

on
flag indicating to show a preview (boolean)

Previewer.__restoreScrollBarPositions

__restoreScrollBarPositions()

Private method to restore scroll bar positions for a previewed editor.

Previewer.__runProcessingThread

__runProcessingThread()

Private slot to schedule the processing of the current editor's text.

Previewer.__saveScrollBarPositions

__saveScrollBarPositions()

Private method to save scroll bar positions for a previewed editor.

Previewer.__setHtml

__setHtml(filePath, html)

Private method to set the HTML to the view and restore the scroll bars positions.

filePath
file path of the previewed editor (string)
html
processed HTML text ready to be shown (string)

Previewer.__setJavaScriptEnabled

__setJavaScriptEnabled(enable)

Private method to enable/disable JavaScript.

enable
flag indicating the enable state (boolean)

Previewer.__splitterMoved

__splitterMoved()

Private slot to handle the movement of the embedding splitter's handle.

Previewer.hide

hide()

Public method to hide the preview widget.

Previewer.on_jsCheckBox_clicked

on_jsCheckBox_clicked(checked)

Private slot to enable/disable JavaScript.

checked
state of the checkbox (boolean)

Previewer.on_previewView_linkClicked

on_previewView_linkClicked(url)

Private slot handling the clicking of a link.

url
url of the clicked link (QUrl)

Previewer.on_previewView_titleChanged

on_previewView_titleChanged(title)

Private slot to handle a change of the title.

title
new title (string)

Previewer.on_ssiCheckBox_clicked

on_ssiCheckBox_clicked(checked)

Private slot to enable/disable SSI.

checked
state of the checkbox (boolean)

Previewer.show

show()

Public method to show the preview widget.

Previewer.shutdown

shutdown()

Public method to perform shutdown actions.

Up


_StrikeThroughExtension

Class is placed here, because it depends on imported markdown, and markdown import is lazy.

(see http://achinghead.com/ python-markdown-adding-insert-delete.html this page for details)

Derived from

markdown.Extension

Class Attributes

DEL_RE

Class Methods

None

Methods

extendMarkdown

Static Methods

None

_StrikeThroughExtension.extendMarkdown

extendMarkdown(md, md_globals)
Up