1
1
import plugin_super_class
2
- from PySide import QtGui , QtCore
2
+ from PyQt5 import QtGui , QtCore , QtWidgets
3
3
4
4
5
5
class SearchPlugin (plugin_super_class .PluginSuperClass ):
@@ -8,40 +8,44 @@ def __init__(self, *args):
8
8
super (SearchPlugin , self ).__init__ ('SearchPlugin' , 'srch' , * args )
9
9
10
10
def get_message_menu (self , menu , text ):
11
- google = QtGui .QAction (
12
- QtGui .QApplication .translate ("srch" , "Find in Google" , None , QtGui . QApplication . UnicodeUTF8 ),
11
+ google = QtWidgets .QAction (
12
+ QtWidgets .QApplication .translate ("srch" , "Find in Google" ),
13
13
menu )
14
14
google .triggered .connect (lambda : self .google (text ))
15
15
16
- duck = QtGui .QAction (
17
- QtGui .QApplication .translate ("srch" , "Find in DuckDuckGo" , None , QtGui . QApplication . UnicodeUTF8 ),
16
+ duck = QtWidgets .QAction (
17
+ QtWidgets .QApplication .translate ("srch" , "Find in DuckDuckGo" ),
18
18
menu )
19
19
duck .triggered .connect (lambda : self .duck (text ))
20
20
21
- yandex = QtGui .QAction (
22
- QtGui .QApplication .translate ("srch" , "Find in Yandex" , None , QtGui . QApplication . UnicodeUTF8 ),
21
+ yandex = QtWidgets .QAction (
22
+ QtWidgets .QApplication .translate ("srch" , "Find in Yandex" ),
23
23
menu )
24
24
yandex .triggered .connect (lambda : self .yandex (text ))
25
25
26
- bing = QtGui .QAction (
27
- QtGui .QApplication .translate ("srch" , "Find in Bing" , None , QtGui . QApplication . UnicodeUTF8 ),
26
+ bing = QtWidgets .QAction (
27
+ QtWidgets .QApplication .translate ("srch" , "Find in Bing" ),
28
28
menu )
29
29
bing .triggered .connect (lambda : self .bing (text ))
30
30
31
31
return [duck , google , yandex , bing ]
32
32
33
33
def google (self , text ):
34
34
url = QtCore .QUrl ('https://www.google.com/search?q=' + text )
35
- QtGui . QDesktopServices . openUrl (url )
35
+ self . open_url (url )
36
36
37
37
def duck (self , text ):
38
38
url = QtCore .QUrl ('https://duckduckgo.com/?q=' + text )
39
- QtGui . QDesktopServices . openUrl (url )
39
+ self . open_url (url )
40
40
41
41
def yandex (self , text ):
42
42
url = QtCore .QUrl ('https://yandex.com/search/?text=' + text )
43
- QtGui . QDesktopServices . openUrl (url )
43
+ self . open_url (url )
44
44
45
45
def bing (self , text ):
46
46
url = QtCore .QUrl ('https://www.bing.com/search?q=' + text )
47
+ self .open_url (url )
48
+
49
+ def open_url (self , url ):
47
50
QtGui .QDesktopServices .openUrl (url )
51
+
0 commit comments