WebBrowser/JavaScript/ExternalJsObject.py

branch
QtWebEngine
changeset 4717
5841f229baf7
child 4725
b19ff70ba509
equal deleted inserted replaced
4715:79009bc4acd5 4717:5841f229baf7
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2016 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the JavaScript external object being the endpoint of
8 a web channel.
9 """
10
11 #
12 # This code was ported from QupZilla.
13 # Copyright (C) David Rosca <nowrep@gmail.com>
14 #
15
16 from PyQt5.QtCore import QObject
17
18 from .AutoFillJsObject import AutoFillJsObject
19
20
21 class ExternalJsObject(QObject):
22 """
23 Class implementing the endpoint of our web channel.
24 """
25 def __init__(self, page):
26 """
27 Constructor
28
29 @param page reference to the web page object
30 @type WebBrowserPage
31 """
32 super(ExternalJsObject, self).__init__(page)
33
34 self.__page = page
35 self.__autoFill = AutoFillJsObject(self)
36
37 def page(self):
38 """
39 Public method returning a reference to the web page object.
40
41 @return reference to the web page object
42 @rtype WebBrowserPage
43 """
44 return self.__page
45
46 def speedDial(self):
47 """
48 Public method returning a reference to a speed dial object.
49
50 @return reference to a speed dial object
51 @rtype SpeedDial
52 """
53 if self.__page.url().toString() != "eric:speeddial":
54 return None
55
56 # TODO: SpeedDial
57 ## return WebBrowser.WebBrowserWindow.WebBrowserWindow.speedDial()
58 return None
59
60 def autoFill(self):
61 """
62 Public method returning a reference to the auto fill object.
63
64 @return reference to the auto fill object
65 @rtype AutoFillJsObject
66 """
67 return self.__autoFill
68
69 ##void ExternalJsObject::AddSearchProvider(const QString &engineUrl)
70 ##{ Slot
71 ## mApp->searchEnginesManager()->addEngine(QUrl(engineUrl));
72 ##}
73 ##
74 ##int ExternalJsObject::IsSearchProviderInstalled(const QString &engineURL)
75 ##{ Slot
76 ## qDebug() << "NOT IMPLEMENTED: IsSearchProviderInstalled()" << engineURL;
77 ## return 0;
78 ##}

eric ide

mercurial