More work on pyxpcom integration
This commit is contained in:
@@ -5,7 +5,26 @@ XUL Runner and gtkmozembed and is produced by the PyGTK
|
||||
"""
|
||||
|
||||
try:
|
||||
from sugar.browser._sugarbrowser import *
|
||||
from sugar.browser._sugarbrowser import startup, shutdown
|
||||
from sugar.browser import _sugarbrowser
|
||||
except ImportError:
|
||||
from sugar import ltihooks
|
||||
from sugar.browser._sugarbrowser import *
|
||||
from sugar.browser._sugarbrowser import startup, shutdown
|
||||
from sugar.browser import _sugarbrowser
|
||||
|
||||
class Browser(_sugarbrowser.Browser):
|
||||
def __init__(self):
|
||||
_sugarbrowser.Browser.__init__(self)
|
||||
|
||||
def get_browser(self):
|
||||
from xpcom import components
|
||||
cls = components.classes["@laptop.org/browser/browserhelper;1"]
|
||||
browser_helper = cls.getService(components.interfaces.nsIBrowserHelper)
|
||||
print self.get_instance_id()
|
||||
return browser_helper.getBrowser(self.get_instance_id())
|
||||
|
||||
def get_document(self):
|
||||
return self.browser.contentDOMWindow.document
|
||||
|
||||
document = property(get_document)
|
||||
browser = property(get_browser)
|
||||
|
||||
@@ -128,6 +128,12 @@
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_instance_id
|
||||
(of-object "SugarBrowser")
|
||||
(c-name "sugar_browser_get_instance_id")
|
||||
(return-type "int")
|
||||
)
|
||||
|
||||
;; From sugar-key-grabber.h
|
||||
|
||||
(define-function sugar_key_grabber_get_type
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -39,7 +39,7 @@ xulrunner_startup(void)
|
||||
fprintf(stderr, "Couldn't find a compatible GRE.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
rv = XPCOMGlueStartup(xpcomPath);
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "Couldn't start XPCOM.");
|
||||
|
||||
Reference in New Issue
Block a user