eric6/WebBrowser/Network/EricSchemeHandler.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7960
e8fc383322f7
child 8043
0acf98cd089a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7913
diff changeset
3 # Copyright (c) 2016 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a scheme handler for the eric: scheme.
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
7913
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
10 from PyQt5.QtCore import pyqtSignal, QBuffer, QIODevice, QUrlQuery, QMutex
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
7761
ed2c67d20328 Eliminated use of qApp in order to prepare for PyQt6 migration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7717
diff changeset
13 from E5Gui.E5Application import e5App
ed2c67d20328 Eliminated use of qApp in order to prepare for PyQt6 migration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7717
diff changeset
14
7774
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
15 from E5Utilities.E5MutexLocker import E5MutexLocker
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
16
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
17 from ..Tools.WebBrowserTools import (
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
18 getHtmlPage, getJavascript, pixmapFileToDataUrl
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
19 )
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
7913
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
21 _SupportedPages = [
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
22 "adblock", # error page for URLs blocked by AdBlock
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
23 "home", "start", "startpage", # eric home page
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
24 "speeddial", # eric speeddial
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
25 ]
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
26
4917
682750cc7bd5 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4885
diff changeset
27
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 class EricSchemeHandler(QWebEngineUrlSchemeHandler):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Class implementing a scheme handler for the eric: scheme.
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 def __init__(self, parent=None):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Constructor
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @param parent reference to the parent object
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @type QObject
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 super(EricSchemeHandler, self).__init__(parent)
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
40
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
41 self.__replies = []
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 def requestStarted(self, job):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 Public method handling the URL request.
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 @param job URL request job
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 @type QWebEngineUrlRequestJob
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
7913
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
50 reply = EricSchemeReply(job)
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
51 reply.closed.connect(lambda: self.__replyClosed(reply))
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
52 self.__replies.append(reply)
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
53 job.reply(b"text/html", reply)
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
54
6120
4c60a21ce6dd Continued removing the use of QObject.sender().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
55 def __replyClosed(self, reply):
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
56 """
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
57 Private slot handling the closed signal of a reply.
6120
4c60a21ce6dd Continued removing the use of QObject.sender().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
58
4c60a21ce6dd Continued removing the use of QObject.sender().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
59 @param reply reference to the network reply
4c60a21ce6dd Continued removing the use of QObject.sender().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
60 @type EricSchemeReply
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
61 """
6120
4c60a21ce6dd Continued removing the use of QObject.sender().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
62 if reply in self.__replies:
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
63 self.__replies.remove(reply)
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 class EricSchemeReply(QIODevice):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 Class implementing a reply for a requested eric: page.
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
69
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
70 @signal closed emitted to signal that the web engine has read
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
71 the data
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
73 closed = pyqtSignal()
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
74
4868
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
75 _speedDialPage = ""
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
76
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 def __init__(self, job, parent=None):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 Constructor
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 @param job reference to the URL request
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 @type QWebEngineUrlRequestJob
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 @param parent reference to the parent object
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 @type QObject
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 super(EricSchemeReply, self).__init__(parent)
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.__loaded = False
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 self.__job = job
6507
54054456ca58 EricSchemeHandler, QtHelpSchemeHandler: ensure, that data is loaded in the main thread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6134
diff changeset
90 self.__mutex = QMutex()
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.__pageName = self.__job.requestUrl().path()
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.__buffer = QBuffer()
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
6691
973b0d0ecc87 EricSchemeHandler: ensure that the page is loaded immediately.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
95 self.__loadPage()
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 def __loadPage(self):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 Private method to load the requested page.
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 if self.__loaded:
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 return
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
7774
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
104 with E5MutexLocker(self.__mutex):
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
105 if self.__pageName == "adblock":
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
106 contents = self.__adBlockPage()
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
107 elif self.__pageName in ["home", "start", "startpage"]:
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
108 contents = self.__startPage()
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
109 elif self.__pageName == "speeddial":
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
110 contents = self.__speedDialPage()
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
111 else:
7913
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
112 contents = self.__errorPage()
7774
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
113
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
114 self.__buffer.setData(contents.encode("utf-8"))
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
115 self.__buffer.open(QIODevice.ReadOnly)
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
116 self.open(QIODevice.ReadOnly)
6507
54054456ca58 EricSchemeHandler, QtHelpSchemeHandler: ensure, that data is loaded in the main thread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6134
diff changeset
117
54054456ca58 EricSchemeHandler, QtHelpSchemeHandler: ensure, that data is loaded in the main thread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6134
diff changeset
118 self.readyRead.emit()
54054456ca58 EricSchemeHandler, QtHelpSchemeHandler: ensure, that data is loaded in the main thread.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6134
diff changeset
119
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 self.__loaded = True
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 def bytesAvailable(self):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 Public method to get the number of available bytes.
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 @return number of available bytes
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 @rtype int
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 """
7774
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
129 with E5MutexLocker(self.__mutex):
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
130 return self.__buffer.bytesAvailable()
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 def readData(self, maxlen):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 Public method to retrieve data from the reply object.
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 @param maxlen maximum number of bytes to read (integer)
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 @return string containing the data (bytes)
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 """
7774
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
139 with E5MutexLocker(self.__mutex):
9eed155411f0 Changed code to our own context manager type mutex locker class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7761
diff changeset
140 return self.__buffer.read(maxlen)
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
142 def close(self):
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
143 """
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
144 Public method used to cloase the reply.
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
145 """
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
146 super(EricSchemeReply, self).close()
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
147 self.closed.emit()
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 def __adBlockPage(self):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 Private method to build the AdBlock page.
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 @return built AdBlock page
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 @rtype str
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 """
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 query = QUrlQuery(self.__job.requestUrl())
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 rule = query.queryItemValue("rule")
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 subscription = query.queryItemValue("subscription")
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 title = self.tr("Content blocked by AdBlock Plus")
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 message = self.tr(
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 "Blocked by rule: <i>{0} ({1})</i>").format(rule, subscription)
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
163 page = getHtmlPage("adblockPage.html")
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 page = page.replace(
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
165 "@FAVICON@", pixmapFileToDataUrl("adBlockPlus16.png", True))
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 page = page.replace(
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
167 "@IMAGE@", pixmapFileToDataUrl("adBlockPlus64.png", True))
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 page = page.replace("@TITLE@", title)
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 page = page.replace("@MESSAGE@", message)
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 return page
4861
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
172
7913
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
173 def __errorPage(self):
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
174 """
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
175 Private method to build the Error page.
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
176
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
177 @return built Error page
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
178 @rtype str
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
179 """
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
180 page = getHtmlPage("ericErrorPage.html")
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
181 page = page.replace(
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
182 "@FAVICON@", pixmapFileToDataUrl("ericWeb16.png", True))
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
183 page = page.replace(
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
184 "@IMAGE@", pixmapFileToDataUrl("ericWeb32.png", True))
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
185 page = page.replace(
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
186 "@TITLE@", self.tr("Error accessing eric: URL"))
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
187 page = page.replace(
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
188 "@MESSAGE@", self.tr(
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
189 "The special URL <strong>{0}</strong> is not supported."
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
190 " Please use one of these."
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
191 ).format(self.__job.requestUrl().toDisplayString())
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
192 )
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
193 page = page.replace(
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
194 "@ERICLIST@", "<br/>".join([
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
195 '<a href="eric:{0}">{0}</a>'.format(u)
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
196 for u in sorted(_SupportedPages)
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
197 ])
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
198 )
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
199
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
200 return page
9bf6903cae97 Web-Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7774
diff changeset
201
4861
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
202 def __startPage(self):
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
203 """
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
204 Private method to build the Start page.
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
205
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
206 @return built Start page
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
207 @rtype str
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
208 """
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
209 page = getHtmlPage("startPage.html")
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
210 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
211 "@FAVICON@", pixmapFileToDataUrl("ericWeb16.png", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
212 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
213 "@IMAGE@", pixmapFileToDataUrl("ericWeb32.png", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
214 page = page.replace(
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
215 "@TITLE@", self.tr("Welcome to eric Web Browser!"))
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
216 page = page.replace("@ERIC_LINK@", self.tr("About eric"))
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
217 page = page.replace("@HEADER_TITLE@", self.tr("eric Web Browser"))
4861
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
218 page = page.replace("@SUBMIT@", self.tr("Search!"))
7761
ed2c67d20328 Eliminated use of qApp in order to prepare for PyQt6 migration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7717
diff changeset
219 if e5App().isLeftToRight():
4861
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
220 ltr = "LTR"
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
221 else:
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
222 ltr = "RTL"
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
223 page = page.replace("@QT_LAYOUT_DIRECTION@", ltr)
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
224
d419f153925d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
225 return page
4868
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
226
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
227 def __speedDialPage(self):
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
228 """
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
229 Private method to create the Speeddial page.
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
230
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
231 @return prepared speeddial page
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
232 @rtype str
4868
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
233 """
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
234 if not self._speedDialPage:
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
235 page = getHtmlPage("speeddialPage.html")
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
236 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
237 "@FAVICON@", pixmapFileToDataUrl("ericWeb16.png", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
238 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
239 "@IMG_PLUS@", pixmapFileToDataUrl("plus.png", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
240 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
241 "@IMG_CLOSE@", pixmapFileToDataUrl("close.png", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
242 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
243 "@IMG_EDIT@", pixmapFileToDataUrl("edit.png", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
244 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
245 "@IMG_RELOAD@", pixmapFileToDataUrl("reload.png", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
246 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
247 "@IMG_SETTINGS@", pixmapFileToDataUrl("setting.png", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
248 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
249 "@LOADING-IMG@", pixmapFileToDataUrl("loading.gif", True))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
250 page = page.replace(
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
251 "@BOX-BORDER@",
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
252 pixmapFileToDataUrl("box-border-small.png", True))
5664
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
253
7717
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
254 page = page.replace("@JQUERY@", getJavascript("jquery.js"))
f32d7965a17e Changed the code to not rely on the Qt Resource system anymore (no .qrc files and no use of pyrcc5 anymore).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7716
diff changeset
255 page = page.replace("@JQUERY-UI@", getJavascript("jquery-ui.js"))
5664
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
256
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
257 page = page.replace("@SITE-TITLE@", self.tr("Speed Dial"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
258 page = page.replace("@URL@", self.tr("URL"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
259 page = page.replace("@TITLE@", self.tr("Title"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
260 page = page.replace("@APPLY@", self.tr("Apply"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
261 page = page.replace("@CLOSE@", self.tr("Close"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
262 page = page.replace("@NEW-PAGE@", self.tr("New Page"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
263 page = page.replace("@TITLE-EDIT@", self.tr("Edit"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
264 page = page.replace("@TITLE-REMOVE@", self.tr("Remove"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
265 page = page.replace("@TITLE-RELOAD@", self.tr("Reload"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
266 page = page.replace("@TITLE-WARN@",
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
267 self.tr("Are you sure to remove this"
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
268 " speed dial?"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
269 page = page.replace("@TITLE-WARN-REL@",
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
270 self.tr("Are you sure you want to reload"
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
271 " all speed dials?"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
272 page = page.replace("@TITLE-FETCHTITLE@",
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
273 self.tr("Load title from page"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
274 page = page.replace("@SETTINGS-TITLE@",
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
275 self.tr("Speed Dial Settings"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
276 page = page.replace("@ADD-TITLE@", self.tr("Add New Page"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
277 page = page.replace("@TXT_NRROWS@",
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
278 self.tr("Maximum pages in a row:"))
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
279 page = page.replace("@TXT_SDSIZE@",
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
280 self.tr("Change size of pages:"))
6127
128d9567a533 Some improvements of the Web Browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6120
diff changeset
281 page = page.replace("@JAVASCRIPT_DISABLED@",
6134
cb0985e8da91 Introduced a navigation bar button to open the downloads manager window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6127
diff changeset
282 self.tr("SpeedDial requires enabled"
cb0985e8da91 Introduced a navigation bar button to open the downloads manager window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6127
diff changeset
283 " JavaScript."))
4868
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
284
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
285 self._speedDialPage = page
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
286
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
287 from WebBrowser.WebBrowserWindow import WebBrowserWindow
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
288 dial = WebBrowserWindow.speedDial()
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
289 page = (
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
290 self._speedDialPage
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
291 .replace("@INITIAL-SCRIPT@", dial.initialScript())
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
292 .replace("@ROW-PAGES@", str(dial.pagesInRow()))
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
293 .replace("@SD-SIZE@", str(dial.sdSize()))
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
294 )
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
295
985d275502c8 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4861
diff changeset
296 return page

eric ide

mercurial