Fri, 04 Nov 2022 13:52:26 +0100
Resorted the import statements using isort.
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
3 | # Copyright (c) 2016 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the Python side of the eric home page. |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
10 | from PyQt6.QtCore import QObject, pyqtSlot |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | class StartPageJsObject(QObject): |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | """ |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | Class implementing the Python side of the eric home page. |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
17 | |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | def __init__(self, parent=None): |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | """ |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
21 | |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | @param parent reference to the parent object |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | @type ExternalJsObject |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
25 | super().__init__(parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
26 | |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | self.__external = parent |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
28 | |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | @pyqtSlot(result=str) |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | def providerString(self): |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | """ |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | Public method to get a string for the search provider. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
33 | |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | @return string for the search provider (string) |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
36 | return self.tr("Search results provided by {0}").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
37 | self.__external.page() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
38 | .view() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
39 | .mainWindow() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
40 | .openSearchManager() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
41 | .currentEngineName() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
42 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
43 | |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | @pyqtSlot(str, result=str) |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | def searchUrl(self, searchStr): |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | """ |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | Public method to get the search URL for the given search term. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
48 | |
4863
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | @param searchStr search term (string) |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | @return search URL (string) |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | """ |
9d86824898e1
Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | return bytes( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
53 | self.__external.page() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
54 | .view() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | .mainWindow() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | .openSearchManager() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | .currentEngine() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
58 | .searchUrl(searchStr) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
59 | .toEncoded() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
60 | ).decode() |