3 from gtkmozembed
import GtkMozEmbed
11 os
.environ
['MOZILLA_FIVE_HOME'] = '/usr/lib/mozilla/'
13 # Starting Moz twice is slow and makes us crash.
14 # Therefore, create a dummy widget when we're first
15 # loaded and never let go...
16 dummy_html
= GtkMozEmbed()
18 class HTML(GtkWindow
):
19 def __init__(self
, model
, node
):
20 GtkWindow
.__init
__(self
)
22 self
.display_root
= node
24 self
.html
= GtkMozEmbed()
26 self
.set_title(self
.display_root
.nodeName
)
27 self
.model
.add_view(self
)
28 self
.connect('destroy', self
.destroyed
)
32 self
.set_default_size(600, 400)
40 def update_replace(self
, old
, new
):
41 if old
== self
.display_root
:
42 self
.display_root
= new
45 def update_all(self
, node
= None):
47 doc
= node_to_html(self
.display_root
)
49 ext
.PrettyPrint(doc
, stream
= self
)
50 data
= self
.output_data
52 uri
= self
.model
.get_base_uri(self
.display_root
)
54 uri
= 'http://localhost/'
55 if uri
[:7] != 'http://':
57 print "Base URI:", uri
59 self
.html
.render_data(data
, uri
, 'text/html')
63 def destroyed(self
, widget
):
65 self
.model
.remove_view(self
)
67 def write(self
, text
):
68 self
.output_data
= self
.output_data
+ text