44 try: |
44 try: |
45 from PyQt5.QtNetwork import QSslCertificate |
45 from PyQt5.QtNetwork import QSslCertificate |
46 SSL_AVAILABLE = True |
46 SSL_AVAILABLE = True |
47 except ImportError: |
47 except ImportError: |
48 SSL_AVAILABLE = False |
48 SSL_AVAILABLE = False |
49 |
|
50 # TODO: ExternalJsObject: move this to the object |
|
51 ############################################################################### |
|
52 ## |
|
53 ## |
|
54 ##class JavaScriptEricObject(QObject): |
|
55 ## """ |
|
56 ## Class implementing an external javascript object to search via the |
|
57 ## startpage. |
|
58 ## """ |
|
59 ## # these must be in line with the strings used by the javascript part of |
|
60 ## # the start page |
|
61 ## translations = [ |
|
62 ## QT_TRANSLATE_NOOP("JavaScriptEricObject", |
|
63 ## "Welcome to eric6 Web Browser!"), |
|
64 ## QT_TRANSLATE_NOOP("JavaScriptEricObject", "eric6 Web Browser"), |
|
65 ## QT_TRANSLATE_NOOP("JavaScriptEricObject", "Search!"), |
|
66 ## QT_TRANSLATE_NOOP("JavaScriptEricObject", "About eric6"), |
|
67 ## ] |
|
68 ## |
|
69 ## def __init__(self, mw, parent=None): |
|
70 ## """ |
|
71 ## Constructor |
|
72 ## |
|
73 ## @param mw reference to the main window 8HelpWindow) |
|
74 ## @param parent reference to the parent object (QObject) |
|
75 ## """ |
|
76 ## super(JavaScriptEricObject, self).__init__(parent) |
|
77 ## |
|
78 ## self.__mw = mw |
|
79 ## |
|
80 ## @pyqtSlot(str, result=str) |
|
81 ## def translate(self, trans): |
|
82 ## """ |
|
83 ## Public method to translate the given string. |
|
84 ## |
|
85 ## @param trans string to be translated (string) |
|
86 ## @return translation (string) |
|
87 ## """ |
|
88 ## if trans == "QT_LAYOUT_DIRECTION": |
|
89 ## # special handling to detect layout direction |
|
90 ## if qApp.isLeftToRight(): |
|
91 ## return "LTR" |
|
92 ## else: |
|
93 ## return "RTL" |
|
94 ## |
|
95 ## return self.tr(trans) |
|
96 ## |
|
97 ## @pyqtSlot(result=str) |
|
98 ## def providerString(self): |
|
99 ## """ |
|
100 ## Public method to get a string for the search provider. |
|
101 ## |
|
102 ## @return string for the search provider (string) |
|
103 ## """ |
|
104 ## return self.tr("Search results provided by {0}")\ |
|
105 ## .format(self.__mw.openSearchManager().currentEngineName()) |
|
106 ## |
|
107 ## @pyqtSlot(str, result=str) |
|
108 ## def searchUrl(self, searchStr): |
|
109 ## """ |
|
110 ## Public method to get the search URL for the given search term. |
|
111 ## |
|
112 ## @param searchStr search term (string) |
|
113 ## @return search URL (string) |
|
114 ## """ |
|
115 ## return bytes( |
|
116 ## self.__mw.openSearchManager().currentEngine() |
|
117 ## .searchUrl(searchStr).toEncoded()).decode() |
|
118 ## |
|
119 ############################################################################### |
|
120 |
49 |
121 |
50 |
122 class WebBrowserPage(QWebEnginePage): |
51 class WebBrowserPage(QWebEnginePage): |
123 """ |
52 """ |
124 Class implementing an enhanced web page. |
53 Class implementing an enhanced web page. |