pyqt5 fixes

This commit is contained in:
ingvar1995 2017-10-21 21:07:05 +03:00
parent 12a395616c
commit 07b0401a43
7 changed files with 26 additions and 22 deletions

View File

@ -1,5 +1,5 @@
import plugin_super_class
from PySide import QtGui, QtCore
from PyQt5 import QtGui, QtWidgets
import json
@ -11,7 +11,7 @@ class AutoAnswer(plugin_super_class.PluginSuperClass):
self._tmp = None
def get_description(self):
return QtGui.QApplication.translate("aans", 'Plugin which allows you to auto answer on calls.', None, QtGui.QApplication.UnicodeUTF8)
return QtWidgets.QApplication.translate("aans", 'Plugin which allows you to auto answer on calls.')
def start(self):
self._tmp = self._profile.incoming_call
@ -33,8 +33,8 @@ class AutoAnswer(plugin_super_class.PluginSuperClass):
text = 'Disallow auto answer'
else:
text = 'Allow auto answer'
act = QtGui.QAction(QtGui.QApplication.translate("aans", text, None, QtGui.QApplication.UnicodeUTF8), menu)
act.connect(act, QtCore.SIGNAL("triggered()"), lambda: self.toggle(friend.tox_id))
act = QtWidgets.QAction(QtWidgets.QApplication.translate("aans", text), menu)
act.triggered.connect(lambda: self.toggle(friend.tox_id))
return [act]
def toggle(self, tox_id):
@ -43,4 +43,3 @@ class AutoAnswer(plugin_super_class.PluginSuperClass):
else:
self._data['id'].append(tox_id)
self.save_settings(json.dumps(self._data))

View File

@ -23,8 +23,7 @@ class BirthDay(plugin_super_class.PluginSuperClass):
today[key] = now.year - int(arr[2])
if len(today):
msgbox = QtWidgets.QMessageBox()
title = QtWidgets.QApplication.translate('BirthDay', "Birthday!", None,
QtWidgets.QApplication.UnicodeUTF8)
title = QtWidgets.QApplication.translate('BirthDay', "Birthday!")
msgbox.setWindowTitle(title)
text = ', '.join(self._profile.get_friend_by_number(self._tox.friend_by_public_key(x)).name + ' ({})'.format(today[x]) for x in today)
msgbox.setText('Birthdays: ' + text)
@ -84,3 +83,4 @@ class BirthDay(plugin_super_class.PluginSuperClass):
timer.stop()
if self._profile.get_friend_by_number(friend_number).tox_id not in self._data:
self.send_lossless('', friend_number)

View File

@ -69,4 +69,3 @@ class Bot(plugin_super_class.PluginSuperClass):
message = self._message
invoke_in_main_thread(self._profile.send_message, message, friend_number)

View File

@ -1618,7 +1618,7 @@ class Chess(plugin_super_class.PluginSuperClass):
self.is_my_move = False
def get_description(self):
return QApplication.translate("Chess", 'Plugin which allows you to play chess with your friends.', None, QApplication.UnicodeUTF8)
return QApplication.translate("Chess", 'Plugin which allows you to play chess with your friends.')
def lossless_packet(self, data, friend_number):
if data == 'new':
@ -1679,6 +1679,6 @@ class Chess(plugin_super_class.PluginSuperClass):
QTimer.singleShot(1000, self.resend_move)
def get_menu(self, menu, num):
act = QAction(QApplication.translate("Chess", "Start chess game", None, QApplication.UnicodeUTF8), menu)
act = QAction(QApplication.translate("Chess", "Start chess game"), menu)
act.triggered.connect(lambda: self.start_game(num))
return [act]

View File

@ -61,3 +61,4 @@ class Garland(plugin_super_class.PluginSuperClass):
while self._exec:
invoke_in_main_thread(self.update)
time.sleep(self._time)

View File

@ -76,3 +76,4 @@ class MarqueeStatus(plugin_super_class.PluginSuperClass):
invoke_in_main_thread(self.set_status_message)
invoke_in_main_thread(self._profile.set_status_message, bytes(tmp, 'utf-8'))
self.active = False

View File

@ -1,5 +1,5 @@
import plugin_super_class
from PySide import QtGui, QtCore
from PyQt5 import QtGui, QtCore, QtWidgets
class SearchPlugin(plugin_super_class.PluginSuperClass):
@ -8,23 +8,23 @@ class SearchPlugin(plugin_super_class.PluginSuperClass):
super(SearchPlugin, self).__init__('SearchPlugin', 'srch', *args)
def get_message_menu(self, menu, text):
google = QtGui.QAction(
QtGui.QApplication.translate("srch", "Find in Google", None, QtGui.QApplication.UnicodeUTF8),
google = QtWidgets.QAction(
QtWidgets.QApplication.translate("srch", "Find in Google"),
menu)
google.triggered.connect(lambda: self.google(text))
duck = QtGui.QAction(
QtGui.QApplication.translate("srch", "Find in DuckDuckGo", None, QtGui.QApplication.UnicodeUTF8),
duck = QtWidgets.QAction(
QtWidgets.QApplication.translate("srch", "Find in DuckDuckGo"),
menu)
duck.triggered.connect(lambda: self.duck(text))
yandex = QtGui.QAction(
QtGui.QApplication.translate("srch", "Find in Yandex", None, QtGui.QApplication.UnicodeUTF8),
yandex = QtWidgets.QAction(
QtWidgets.QApplication.translate("srch", "Find in Yandex"),
menu)
yandex.triggered.connect(lambda: self.yandex(text))
bing = QtGui.QAction(
QtGui.QApplication.translate("srch", "Find in Bing", None, QtGui.QApplication.UnicodeUTF8),
bing = QtWidgets.QAction(
QtWidgets.QApplication.translate("srch", "Find in Bing"),
menu)
bing.triggered.connect(lambda: self.bing(text))
@ -32,16 +32,20 @@ class SearchPlugin(plugin_super_class.PluginSuperClass):
def google(self, text):
url = QtCore.QUrl('https://www.google.com/search?q=' + text)
QtGui.QDesktopServices.openUrl(url)
self.open_url(url)
def duck(self, text):
url = QtCore.QUrl('https://duckduckgo.com/?q=' + text)
QtGui.QDesktopServices.openUrl(url)
self.open_url(url)
def yandex(self, text):
url = QtCore.QUrl('https://yandex.com/search/?text=' + text)
QtGui.QDesktopServices.openUrl(url)
self.open_url(url)
def bing(self, text):
url = QtCore.QUrl('https://www.bing.com/search?q=' + text)
self.open_url(url)
def open_url(self, url):
QtGui.QDesktopServices.openUrl(url)