More work on pyxpcom integration

This commit is contained in:
Marco Pesenti Gritti
2007-05-13 22:49:27 +02:00
parent 7e0fd77b13
commit 9e10d15c21
9 changed files with 106 additions and 29 deletions
+21 -2
View File
@@ -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)
+6
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
+1 -1
View File
@@ -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.");