Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/test-app-components.py
blob: 08ecc460677d1470f3430b1d7c26bbc99ca21a5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os

import gtk

import hulahop
hulahop.startup(os.path.expanduser('~/.test-hulahop'))
from hulahop.webview import WebView

from xpcom import components
from xpcom.server.factory import Factory

class AppLauncher:
    _com_interfaces_ = components.interfaces.nsIHelperAppLauncherDialog

    def promptForSaveToFile(self, launcher, windowContext,
                            defaultFile, suggestedFileExtension):
        print 'promptForSaveToFile'
                            
    def show(self, launcher, context, reason):
        print 'show'

def _quit(window):
    hulahop.shutdown()
    gtk.main_quit()

registrar = components.registrar
registrar.registerFactory('{64355793-988d-40a5-ba8e-fcde78cac631}"',
                          'Test Application Launcher',
                          '@mozilla.org/helperapplauncherdialog;1',
                          Factory(AppLauncher))

window = gtk.Window()
window.connect("destroy", _quit)

web_view = WebView()
web_view.load_uri('http://www.google.com')
window.add(web_view)
web_view.show()

window.show()

gtk.main()