Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gnome-builder
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Günther Wagner
gnome-builder
Commits
f1167ff8
Commit
f1167ff8
authored
Nov 20, 2015
by
Christian Hergert
Committed by
Christian Hergert
Dec 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
html-preview: port to IdeWorkbench
parent
75f78607
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
plugins/html-preview/html_preview_plugin/__init__.py
plugins/html-preview/html_preview_plugin/__init__.py
+6
-7
No files found.
plugins/html-preview/html_preview_plugin/__init__.py
View file @
f1167ff8
...
...
@@ -24,11 +24,9 @@ from gettext import gettext as _
import
gi
import
os
gi
.
require_version
(
'Builder'
,
'1.0'
)
gi
.
require_version
(
'Ide'
,
'1.0'
)
gi
.
require_version
(
'WebKit2'
,
'4.0'
)
from
gi.repository
import
Builder
from
gi.repository
import
GLib
from
gi.repository
import
Gio
from
gi.repository
import
Gtk
...
...
@@ -37,7 +35,7 @@ from gi.repository import Ide
from
gi.repository
import
WebKit2
from
gi.repository
import
Peas
class
HtmlPreviewData
(
GObject
.
Object
,
Builder
.
ApplicationAddin
):
class
HtmlPreviewData
(
GObject
.
Object
,
Ide
.
ApplicationAddin
):
MARKDOWN_CSS
=
None
MARKED_JS
=
None
MARKDOWN_VIEW_JS
=
None
...
...
@@ -55,7 +53,7 @@ class HtmlPreviewData(GObject.Object, Builder.ApplicationAddin):
return
open
(
path
,
'r'
).
read
()
class
HtmlPreviewAddin
(
GObject
.
Object
,
Builder
.
EditorViewAddin
):
class
HtmlPreviewAddin
(
GObject
.
Object
,
Ide
.
EditorViewAddin
):
def
do_load
(
self
,
editor
):
self
.
menu
=
HtmlPreviewMenu
(
editor
.
get_menu
())
...
...
@@ -75,14 +73,15 @@ class HtmlPreviewAddin(GObject.Object, Builder.EditorViewAddin):
def
preview_activated
(
self
,
editor
):
document
=
editor
.
get_document
()
view
=
HtmlPreviewView
(
document
,
visible
=
True
)
stack
=
editor
.
get_ancestor
(
Builder
.
ViewStack
)
stack
=
editor
.
get_ancestor
(
Ide
.
LayoutStack
)
print
(
stack
)
stack
.
add
(
view
)
class
HtmlPreviewMenu
:
exten
=
None
def
__init__
(
self
,
menu
):
self
.
exten
=
Builder
.
MenuExtension
.
new_for_section
(
menu
,
'preview-section'
)
self
.
exten
=
Ide
.
MenuExtension
.
new_for_section
(
menu
,
'preview-section'
)
def
show
(
self
):
item
=
Gio
.
MenuItem
.
new
(
_
(
"Preview as HTML"
),
'view.preview-as-html'
)
...
...
@@ -91,7 +90,7 @@ class HtmlPreviewMenu:
def
hide
(
self
):
self
.
exten
.
remove_items
()
class
HtmlPreviewView
(
Builder
.
View
):
class
HtmlPreviewView
(
Ide
.
Layout
View
):
markdown
=
False
def
__init__
(
self
,
document
,
*
args
,
**
kwargs
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment