Skip to content

Commit 07b0401

Browse files
committed
pyqt5 fixes
1 parent 12a3956 commit 07b0401

File tree

7 files changed

+26
-22
lines changed

7 files changed

+26
-22
lines changed

AutoAnswer/aans.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import plugin_super_class
2-
from PySide import QtGui, QtCore
2+
from PyQt5 import QtGui, QtWidgets
33
import json
44

55

@@ -11,7 +11,7 @@ def __init__(self, *args):
1111
self._tmp = None
1212

1313
def get_description(self):
14-
return QtGui.QApplication.translate("aans", 'Plugin which allows you to auto answer on calls.', None, QtGui.QApplication.UnicodeUTF8)
14+
return QtWidgets.QApplication.translate("aans", 'Plugin which allows you to auto answer on calls.')
1515

1616
def start(self):
1717
self._tmp = self._profile.incoming_call
@@ -33,8 +33,8 @@ def get_menu(self, menu, num):
3333
text = 'Disallow auto answer'
3434
else:
3535
text = 'Allow auto answer'
36-
act = QtGui.QAction(QtGui.QApplication.translate("aans", text, None, QtGui.QApplication.UnicodeUTF8), menu)
37-
act.connect(act, QtCore.SIGNAL("triggered()"), lambda: self.toggle(friend.tox_id))
36+
act = QtWidgets.QAction(QtWidgets.QApplication.translate("aans", text), menu)
37+
act.triggered.connect(lambda: self.toggle(friend.tox_id))
3838
return [act]
3939

4040
def toggle(self, tox_id):
@@ -43,4 +43,3 @@ def toggle(self, tox_id):
4343
else:
4444
self._data['id'].append(tox_id)
4545
self.save_settings(json.dumps(self._data))
46-

BirthDay/bday.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def start(self):
2323
today[key] = now.year - int(arr[2])
2424
if len(today):
2525
msgbox = QtWidgets.QMessageBox()
26-
title = QtWidgets.QApplication.translate('BirthDay', "Birthday!", None,
27-
QtWidgets.QApplication.UnicodeUTF8)
26+
title = QtWidgets.QApplication.translate('BirthDay', "Birthday!")
2827
msgbox.setWindowTitle(title)
2928
text = ', '.join(self._profile.get_friend_by_number(self._tox.friend_by_public_key(x)).name + ' ({})'.format(today[x]) for x in today)
3029
msgbox.setText('Birthdays: ' + text)
@@ -84,3 +83,4 @@ def timer(self, friend_number):
8483
timer.stop()
8584
if self._profile.get_friend_by_number(friend_number).tox_id not in self._data:
8685
self.send_lossless('', friend_number)
86+

Bot/bot.py

-1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,3 @@ def answer(self, friend_number, message):
6969
message = self._message
7070
invoke_in_main_thread(self._profile.send_message, message, friend_number)
7171

72-

Chess/chess.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ def __init__(self, *args):
16181618
self.is_my_move = False
16191619

16201620
def get_description(self):
1621-
return QApplication.translate("Chess", 'Plugin which allows you to play chess with your friends.', None, QApplication.UnicodeUTF8)
1621+
return QApplication.translate("Chess", 'Plugin which allows you to play chess with your friends.')
16221622

16231623
def lossless_packet(self, data, friend_number):
16241624
if data == 'new':
@@ -1679,6 +1679,6 @@ def move(self, move):
16791679
QTimer.singleShot(1000, self.resend_move)
16801680

16811681
def get_menu(self, menu, num):
1682-
act = QAction(QApplication.translate("Chess", "Start chess game", None, QApplication.UnicodeUTF8), menu)
1682+
act = QAction(QApplication.translate("Chess", "Start chess game"), menu)
16831683
act.triggered.connect(lambda: self.start_game(num))
16841684
return [act]

Garland/garland.py

+1
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ def change_status(self):
6161
while self._exec:
6262
invoke_in_main_thread(self.update)
6363
time.sleep(self._time)
64+

MarqueeStatus/mrq.py

+1
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ def change_status(self):
7676
invoke_in_main_thread(self.set_status_message)
7777
invoke_in_main_thread(self._profile.set_status_message, bytes(tmp, 'utf-8'))
7878
self.active = False
79+

SearchPlugin/srch.py

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import plugin_super_class
2-
from PySide import QtGui, QtCore
2+
from PyQt5 import QtGui, QtCore, QtWidgets
33

44

55
class SearchPlugin(plugin_super_class.PluginSuperClass):
@@ -8,40 +8,44 @@ def __init__(self, *args):
88
super(SearchPlugin, self).__init__('SearchPlugin', 'srch', *args)
99

1010
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"),
1313
menu)
1414
google.triggered.connect(lambda: self.google(text))
1515

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"),
1818
menu)
1919
duck.triggered.connect(lambda: self.duck(text))
2020

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"),
2323
menu)
2424
yandex.triggered.connect(lambda: self.yandex(text))
2525

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"),
2828
menu)
2929
bing.triggered.connect(lambda: self.bing(text))
3030

3131
return [duck, google, yandex, bing]
3232

3333
def google(self, text):
3434
url = QtCore.QUrl('https://www.google.com/search?q=' + text)
35-
QtGui.QDesktopServices.openUrl(url)
35+
self.open_url(url)
3636

3737
def duck(self, text):
3838
url = QtCore.QUrl('https://duckduckgo.com/?q=' + text)
39-
QtGui.QDesktopServices.openUrl(url)
39+
self.open_url(url)
4040

4141
def yandex(self, text):
4242
url = QtCore.QUrl('https://yandex.com/search/?text=' + text)
43-
QtGui.QDesktopServices.openUrl(url)
43+
self.open_url(url)
4444

4545
def bing(self, text):
4646
url = QtCore.QUrl('https://www.bing.com/search?q=' + text)
47+
self.open_url(url)
48+
49+
def open_url(self, url):
4750
QtGui.QDesktopServices.openUrl(url)
51+

0 commit comments

Comments
 (0)