Skip to content

Commit a076465

Browse files
Add html preview pane plugin
1 parent 60cdc6f commit a076465

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

hackedit/plugins/html_preview.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
This module contains a plugin that is able to render the html preview of
3+
the current editor.
4+
"""
5+
from PyQt5 import QtGui, QtCore
6+
from pyqode.core.widgets import HtmlPreviewWidget
7+
8+
from hackedit import api
9+
10+
11+
class HtmlPreview(api.plugins.WorkspacePlugin):
12+
def activate(self):
13+
self.preview = HtmlPreviewWidget()
14+
self._dock = api.window.add_dock_widget(
15+
self.preview, 'Preview', icon=QtGui.QIcon.fromTheme(
16+
'internet-web-browser'), area=QtCore.Qt.RightDockWidgetArea)
17+
api.signals.connect_slot(api.signals.CURRENT_EDITOR_CHANGED,
18+
self.preview.set_editor)
19+
self.preview.hide_requested.connect(self._dock.hide)
20+
self.preview.show_requested.connect(self._dock.show)
21+
self.preview.set_editor(None)
22+
self._dock.hide()

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def run_tests(self):
104104
'FindReplace = hackedit.plugins.find_replace:FindReplace',
105105
'DocumentOutline = hackedit.plugins.outline:DocumentOutline',
106106
'OpenDocuments = hackedit.plugins.documents:OpenDocuments',
107+
'HtmlPreview = hackedit.plugins.html_preview:HtmlPreview'
107108
],
108109
'hackedit.plugins.workspace_providers': [
109110
'generic_workspace = hackedit.plugins.workspaces:GenericWorkspace',

0 commit comments

Comments
 (0)