src/eric7/WebBrowser/JavaScript/StartPageJsObject.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
12 12
13 class StartPageJsObject(QObject): 13 class StartPageJsObject(QObject):
14 """ 14 """
15 Class implementing the Python side of the eric home page. 15 Class implementing the Python side of the eric home page.
16 """ 16 """
17
17 def __init__(self, parent=None): 18 def __init__(self, parent=None):
18 """ 19 """
19 Constructor 20 Constructor
20 21
21 @param parent reference to the parent object 22 @param parent reference to the parent object
22 @type ExternalJsObject 23 @type ExternalJsObject
23 """ 24 """
24 super().__init__(parent) 25 super().__init__(parent)
25 26
26 self.__external = parent 27 self.__external = parent
27 28
28 @pyqtSlot(result=str) 29 @pyqtSlot(result=str)
29 def providerString(self): 30 def providerString(self):
30 """ 31 """
31 Public method to get a string for the search provider. 32 Public method to get a string for the search provider.
32 33
33 @return string for the search provider (string) 34 @return string for the search provider (string)
34 """ 35 """
35 return (self.tr("Search results provided by {0}") 36 return self.tr("Search results provided by {0}").format(
36 .format(self.__external.page().view().mainWindow() 37 self.__external.page()
37 .openSearchManager().currentEngineName())) 38 .view()
38 39 .mainWindow()
40 .openSearchManager()
41 .currentEngineName()
42 )
43
39 @pyqtSlot(str, result=str) 44 @pyqtSlot(str, result=str)
40 def searchUrl(self, searchStr): 45 def searchUrl(self, searchStr):
41 """ 46 """
42 Public method to get the search URL for the given search term. 47 Public method to get the search URL for the given search term.
43 48
44 @param searchStr search term (string) 49 @param searchStr search term (string)
45 @return search URL (string) 50 @return search URL (string)
46 """ 51 """
47 return bytes( 52 return bytes(
48 self.__external.page().view().mainWindow().openSearchManager() 53 self.__external.page()
49 .currentEngine().searchUrl(searchStr).toEncoded()).decode() 54 .view()
55 .mainWindow()
56 .openSearchManager()
57 .currentEngine()
58 .searchUrl(searchStr)
59 .toEncoded()
60 ).decode()

eric ide

mercurial