gtkmozembed.MozEmbed

gtkmozembed.MozEmbed — Embed Mozilla browser in Gtk application

Synopsis

class gtkmozembed.MozEmbed(gtk.Bin):
    gtkmozembed.MozEmbed()
def load_url(url)
def stop_load()
def can_go_back()
def can_go_forward()
def go_back()
def go_forward()
def render_data(data, len, base_uri, mime_type)
def open_stream(base_uri, mime_type)
def append_data(data, len)
def close_stream()
def get_link_message()
def get_js_status()
def get_title()
def get_location()
def reload(flags)
def set_chrome_mask(flags)
def get_chrome_mask()
Functions

    def gtkmozembed.push_startup()
def gtkmozembed.pop_startup()
def gtkmozembed.gtk_moz_embed_set_comp_path(path)
def gtkmozembed.gtk_moz_embed_set_profile_path(path, name)
def gtkmozembed.set_comp_path(path)
def gtkmozembed.set_profile_path(path, name)

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Bin
        +-- gtkmozembed.MozEmbed

Signal Prototypes

"link-message"

def callback(mozembed, data, ...)

"js-status"

def callback(mozembed, data, ...)

"location"

def callback(mozembed, data, ...)

"title"

def callback(mozembed, data, ...)

"progress"

def callback(mozembed, cur, max, data, ...)

"net-state"

def callback(mozembed, flags, status, data, ...)

"net-start"

def callback(mozembed, data, ...)

"net-stop"

def callback(mozembed, data, ...)

"new-window"

def callback(mozembed, retval, chromemask, data, ...)

"visibility"

def callback(mozembed, visibility, data, ...)

"destroy-browser"

def callback(mozembed, data, ...)

"open-uri"

def callback(mozembed, visibility, data, ...)

Description

GtkMozEmbed is an easy-to-use widget that will allow you to embed a Mozilla browser window into your Gtk application.

It's designed to be easy to use and uncomplicated to make the barrier for use as low as possible. This means that the functionality exposed should cover about 80% of uses. If you want to get at some of Mozilla's higher brain functions it means that you will have to write your own embedding widget.

Here's a small example:

import gtk
import gtkmozembed

class TinyGecko:
    def __init__(self):
        self.moz = gtkmozembed.MozEmbed()
                
        win = gtk.Window()
        win.add(self.moz)
        win.show_all()
        # self.moz.load_url('http://www.pygtk.org')
        data = '<html><head><title>Hello</title></head><body>pygtk dev</body></html>'
        self.moz.render_data(data, long(len(data)), 'file:///', 'text/html')

if __name__ == '__main__':
  TinyGecko()
  gtk.main()
  

Constructor

    gtkmozembed.MozEmbed()

Returns :

a new gtkmozembed.MozEmbed object.

Creates a new gtkmozembed.MozEmbed object.

Methods

gtkmozembed.MozEmbed.load_url

    def load_url(url)

url :

The url that have to be loaded.

The load_url() method starts loading a url in the embedding widget. All loads are asynchronous. The url argument should be in the form of http://www.gnome.org.

gtkmozembed.MozEmbed.stop_load

    def stop_load()

The stop_load() method will allow you to stop the load of a document that is being loaded in the widget.

gtkmozembed.MozEmbed.can_go_back

    def can_go_back()

Returns :

if True you can go back in the navigation history.

The can_go_back() method return whether or not you can go backwards in the document's navigation history. It will return True if it can go backwards, False if it can't.

gtkmozembed.MozEmbed.can_go_forward

    def can_go_forward()

Returns :

True if you can go forward in the navigation history.

The can_go_forward() method return whether or not you can go forwards in the document's navigation history. It will return True if it can go forwards, False if it can't.

gtkmozembed.MozEmbed.go_back

    def go_back()

The go_back() method will go backwards one step in the document's navigation history.

gtkmozembed.MozEmbed.go_forward

    def go_forward()

The go_forward() method will go forwards one step in the document's navigation history.

gtkmozembed.MozEmbed.render_data

    def render_data(data, len, base_uri, mime_type)

data :

a chunk of random data.

len :

the lenght of the data.

base_uri :

the base uri.

mime_type :

the mime type.

The render_data() method will allow you to take a chunk of random data and render it into the document. You need to pass in the data and the length of the data. The base_uri is used to resolve internal references in the document and the mime_type is used to determine how to render the document internally.

gtkmozembed.MozEmbed.open_stream

    def open_stream(base_uri, mime_type)

base_uri :

the base uri.

mime_type :

the mime type.

The open_stream() method is used to start loading a document from an external source into the embedding widget. You need to pass in the base_uri for resolving internal links and and the mime_type of the document.

gtkmozembed.MozEmbed.append_data

    def append_data(data, len)

data :

the data to append in the stream.

len :

the lenght of data.

The append_data() allows you to append data to an already opened stream in the widget. You need to pass in the data that you want to append to the document and its length.