gtkmozembed.MozEmbed
gtkmozembed.MozEmbed — Embed Mozilla browser in Gtk application
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()
|
Methods
gtkmozembed.MozEmbed.load_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
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
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
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
The go_back() method will go backwards one step in the document's navigation history.
gtkmozembed.MozEmbed.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.
gtkmozembed.MozEmbed.close_stream
The close_stream() method closes the stream that you have been using to append data manually to the embedding widget.
gtkmozembed.MozEmbed.get_link_message
Returns : | the current link message. |
The get_link_message() returns the current link message of the document if there is one.
gtkmozembed.MozEmbed.get_js_status
Returns : | the js_status message. |
The get_js_status() returns the js_status message if there is one.
gtkmozembed.MozEmbed.get_title
Returns : | the current title. |
The get_title() returns the the current title for a document.
gtkmozembed.MozEmbed.get_location
Returns : | the current location. |
The get_location() returns the current location of the document.
gtkmozembed.MozEmbed.reload
flags : | the flags argument can be used to control the behaviour of the reload. |
The reload() reloads the document. The flags argument can be used to control the behaviour of the reload.
The flags argument can be one of the following values:
GTK_MOZ_EMBED_FLAG_RELOADNORMAL | |
GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE | |
GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY | |
GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE | |
gtkmozembed.MozEmbed.set_chrome_mask
def set_chrome_mask(flags)
|
flags : | the flags argument |
The set_chrome_mask() is used to set the chome mask for this window.
It can be the logical or of any of the following values:
GTK_MOZ_EMBED_FLAG_DEFAULTCHROME | |
GTK_MOZ_EMBED_FLAG_WINDOWBORDERSON | |
GTK_MOZ_EMBED_FLAG_WINDOWCLOSEON | |
GTK_MOZ_EMBED_FLAG_WINDOWRESIZEON | |
GTK_MOZ_EMBED_FLAG_MENUBARON | |
GTK_MOZ_EMBED_FLAG_TOOLBARON | |
GTK_MOZ_EMBED_FLAG_LOCATIONBARON | |
GTK_MOZ_EMBED_FLAG_STATUSBARON | |
GTK_MOZ_EMBED_FLAG_PERSONALTOOLBARON | |
GTK_MOZ_EMBED_FLAG_SCROLLBARSON | |
GTK_MOZ_EMBED_FLAG_TITLEBARON | |
GTK_MOZ_EMBED_FLAG_EXTRACHROMEON | |
GTK_MOZ_EMBED_FLAG_WINDOWRAISED | |
GTK_MOZ_EMBED_FLAG_WINDOWLOWERED | |
GTK_MOZ_EMBED_FLAG_CENTERSCREEN | |
GTK_MOZ_EMBED_FLAG_DEPENDENT | |
GTK_MOZ_EMBED_FLAG_MODAL | |
GTK_MOZ_EMBED_FLAG_OPENASDIALOG | |
GTK_MOZ_EMBED_FLAG_OPENASCHROME | |
GTK_MOZ_EMBED_FLAG_ALLCHROME | |
gtkmozembed.MozEmbed.get_chrome_mask
Returns : | the current chome mask for this window. |
The get_chrome_mask() gets the current chome mask for this window.
Please see the documentation for
gtkmozembed.MozEmbed.set_chrome_mask
for the value of the return mask.
Functions
gtkmozembed.push_startup
def gtkmozembed.push_startup()
|
The push_startup() .....
gtkmozembed.pop_startup
def gtkmozembed.pop_startup()
|
The pop_startup() .....
gtkmozembed.gtk_moz_embed_set_comp_path
def gtkmozembed.gtk_moz_embed_set_comp_path()
|
The gtk_moz_embed_set_comp_path() must be called before the first widget is created or XPCOM is initialized.
It allows you to set the path to the mozilla components.
gtkmozembed.gtk_moz_embed_set_profile_path
def gtkmozembed.gtk_moz_embed_set_profile_path()
|
The gtk_moz_embed_set_profile_path() .....
Signals
The "link-message" gtkmozembed.MozEmbed Signal
def callback(mozembed, data, ...)
|
mozembed : | the mozembed that received the signal |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "link-message" signal is emitted when the link message changes.
This happens when the user moves the mouse over a link in a web page.
Please use get_link_message
to get the actual value of the link message.
The "js-status" gtkmozembed.MozEmbed Signal
def callback(mozembed, data, ...)
|
mozembed : | the mozembed that received the signal |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "js_status" signal is emitted when the JavaScript status message changes.
Please use get_js_status
to get the actual value of the js status message.
The "location" gtkmozembed.MozEmbed Signal
def callback(mozembed, data, ...)
|
mozembed : | the mozembed that received the signal |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "location" signal is emitted any time that the location of the document has changed.
Please use get_location
to get the actual value of the location.
The "title" gtkmozembed.MozEmbed Signal
def callback(mozembed, data, ...)
|
mozembed : | the mozembed that received the signal |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "title" signal is emitted any time that the title of a document has changed.
Please use the get_title
call to get the actual value of the title.
The "progress" gtkmozembed.MozEmbed Signal
def callback(mozembed, cur, max, data, ...)
|
mozembed : | the mozembed that received the signal |
cur : | indicates how much of the document has been downloaded. |
max : | indicates the length of the document.
If the value of max is less than one, the full length of the document can not be determined. |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "progress" signal is emitted any time that there is a change in the progress of loading a document.
The "net-state" gtkmozembed.MozEmbed Signal
def callback(mozembed, flags, status, data, ...)
|
mozembed : | the mozembed that received the signal |
flags : | ..... |
status : | ..... |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "net-state" signal is emitted when there's a change in the state of the loading of a document.
The "net-start" gtkmozembed.MozEmbed Signal
def callback(mozembed, data, ...)
|
mozembed : | the mozembed that received the signal |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "title" signal is emitted any time that the load of a document has been started.
The "net-stop" gtkmozembed.MozEmbed Signal
def callback(mozembed, data, ...)
|
mozembed : | the mozembed that received the signal |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "title" signal is emitted any time that the loading of a document has completed.
The "new-window" gtkmozembed.MozEmbed Signal
def callback(mozembed, retval, chromemask, data, ...)
|
mozembed : | the mozembed that received the signal |
retval : | ..... |
chromemask : | ..... |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "new-window" signal is emitted any time that a new toplevel window is requested by the document.
This will happen in the case of a window.open() in JavaScript.
Responding to this signal allows you to surround a new toplevel window with your chrome.
You should return the newly created GtkMozEmbed object via the retval.
The "visibility" gtkmozembed.MozEmbed Signal
def callback(mozembed, visibility, data, ...)
|
mozembed : | the mozembed that received the signal |
visibility : | if TRUE then the window should be shown. If it's FALSE it should be hidden. |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "new-window" signal is emitted when the toplevel window in question needs to be shown or hidden.
The "destroy-browser" gtkmozembed.MozEmbed Signal
def callback(mozembed, data, ...)
|
mozembed : | the mozembed that received the signal |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "destroy-browser" signal is emitted when the document as requested that the toplevel window be closed.
This will happen in the case of a JavaScript window.close().
The "open-uri" gtkmozembed.MozEmbed Signal
def callback(mozembed, visibility, data, ...)
|
mozembed : | the mozembed that received the signal |
uri : | the uri that's going to be loaded. |
data : | additional data (if any) specified with the
connect() method |
... : | additional user parameters (if any) |
The "open-uri" signal is emitted when when the document tries to load a new document, for example when someone clicks on a link in a web page.
This signal gives the embedder the opportunity to keep the new document from being loaded.
The uri argument is the uri that's going to be loaded.
If you return TRUE from this signal, the new document will NOT be loaded.
If you return FALSE the new document will be loaded.
This is somewhat non-intuitive. Think of it as the Mozilla engine is asking if you want to interrupt the loading of a new document.
By returning TRUE you are saying "don't load this document."