pyqt5 fixes
This commit is contained in:
parent
12a395616c
commit
07b0401a43
7 changed files with 26 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
||||||
import plugin_super_class
|
import plugin_super_class
|
||||||
from PySide import QtGui, QtCore
|
from PyQt5 import QtGui, QtWidgets
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class AutoAnswer(plugin_super_class.PluginSuperClass):
|
||||||
self._tmp = None
|
self._tmp = None
|
||||||
|
|
||||||
def get_description(self):
|
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):
|
def start(self):
|
||||||
self._tmp = self._profile.incoming_call
|
self._tmp = self._profile.incoming_call
|
||||||
|
@ -33,8 +33,8 @@ class AutoAnswer(plugin_super_class.PluginSuperClass):
|
||||||
text = 'Disallow auto answer'
|
text = 'Disallow auto answer'
|
||||||
else:
|
else:
|
||||||
text = 'Allow auto answer'
|
text = 'Allow auto answer'
|
||||||
act = QtGui.QAction(QtGui.QApplication.translate("aans", text, None, QtGui.QApplication.UnicodeUTF8), menu)
|
act = QtWidgets.QAction(QtWidgets.QApplication.translate("aans", text), menu)
|
||||||
act.connect(act, QtCore.SIGNAL("triggered()"), lambda: self.toggle(friend.tox_id))
|
act.triggered.connect(lambda: self.toggle(friend.tox_id))
|
||||||
return [act]
|
return [act]
|
||||||
|
|
||||||
def toggle(self, tox_id):
|
def toggle(self, tox_id):
|
||||||
|
@ -43,4 +43,3 @@ class AutoAnswer(plugin_super_class.PluginSuperClass):
|
||||||
else:
|
else:
|
||||||
self._data['id'].append(tox_id)
|
self._data['id'].append(tox_id)
|
||||||
self.save_settings(json.dumps(self._data))
|
self.save_settings(json.dumps(self._data))
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@ class BirthDay(plugin_super_class.PluginSuperClass):
|
||||||
today[key] = now.year - int(arr[2])
|
today[key] = now.year - int(arr[2])
|
||||||
if len(today):
|
if len(today):
|
||||||
msgbox = QtWidgets.QMessageBox()
|
msgbox = QtWidgets.QMessageBox()
|
||||||
title = QtWidgets.QApplication.translate('BirthDay', "Birthday!", None,
|
title = QtWidgets.QApplication.translate('BirthDay', "Birthday!")
|
||||||
QtWidgets.QApplication.UnicodeUTF8)
|
|
||||||
msgbox.setWindowTitle(title)
|
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)
|
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)
|
msgbox.setText('Birthdays: ' + text)
|
||||||
|
@ -84,3 +83,4 @@ class BirthDay(plugin_super_class.PluginSuperClass):
|
||||||
timer.stop()
|
timer.stop()
|
||||||
if self._profile.get_friend_by_number(friend_number).tox_id not in self._data:
|
if self._profile.get_friend_by_number(friend_number).tox_id not in self._data:
|
||||||
self.send_lossless('', friend_number)
|
self.send_lossless('', friend_number)
|
||||||
|
|
||||||
|
|
|
@ -69,4 +69,3 @@ class Bot(plugin_super_class.PluginSuperClass):
|
||||||
message = self._message
|
message = self._message
|
||||||
invoke_in_main_thread(self._profile.send_message, message, friend_number)
|
invoke_in_main_thread(self._profile.send_message, message, friend_number)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1618,7 +1618,7 @@ class Chess(plugin_super_class.PluginSuperClass):
|
||||||
self.is_my_move = False
|
self.is_my_move = False
|
||||||
|
|
||||||
def get_description(self):
|
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):
|
def lossless_packet(self, data, friend_number):
|
||||||
if data == 'new':
|
if data == 'new':
|
||||||
|
@ -1679,6 +1679,6 @@ class Chess(plugin_super_class.PluginSuperClass):
|
||||||
QTimer.singleShot(1000, self.resend_move)
|
QTimer.singleShot(1000, self.resend_move)
|
||||||
|
|
||||||
def get_menu(self, menu, num):
|
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))
|
act.triggered.connect(lambda: self.start_game(num))
|
||||||
return [act]
|
return [act]
|
||||||
|
|
|
@ -61,3 +61,4 @@ class Garland(plugin_super_class.PluginSuperClass):
|
||||||
while self._exec:
|
while self._exec:
|
||||||
invoke_in_main_thread(self.update)
|
invoke_in_main_thread(self.update)
|
||||||
time.sleep(self._time)
|
time.sleep(self._time)
|
||||||
|
|
||||||
|
|
|
@ -76,3 +76,4 @@ class MarqueeStatus(plugin_super_class.PluginSuperClass):
|
||||||
invoke_in_main_thread(self.set_status_message)
|
invoke_in_main_thread(self.set_status_message)
|
||||||
invoke_in_main_thread(self._profile.set_status_message, bytes(tmp, 'utf-8'))
|
invoke_in_main_thread(self._profile.set_status_message, bytes(tmp, 'utf-8'))
|
||||||
self.active = False
|
self.active = False
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import plugin_super_class
|
import plugin_super_class
|
||||||
from PySide import QtGui, QtCore
|
from PyQt5 import QtGui, QtCore, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
class SearchPlugin(plugin_super_class.PluginSuperClass):
|
class SearchPlugin(plugin_super_class.PluginSuperClass):
|
||||||
|
@ -8,23 +8,23 @@ class SearchPlugin(plugin_super_class.PluginSuperClass):
|
||||||
super(SearchPlugin, self).__init__('SearchPlugin', 'srch', *args)
|
super(SearchPlugin, self).__init__('SearchPlugin', 'srch', *args)
|
||||||
|
|
||||||
def get_message_menu(self, menu, text):
|
def get_message_menu(self, menu, text):
|
||||||
google = QtGui.QAction(
|
google = QtWidgets.QAction(
|
||||||
QtGui.QApplication.translate("srch", "Find in Google", None, QtGui.QApplication.UnicodeUTF8),
|
QtWidgets.QApplication.translate("srch", "Find in Google"),
|
||||||
menu)
|
menu)
|
||||||
google.triggered.connect(lambda: self.google(text))
|
google.triggered.connect(lambda: self.google(text))
|
||||||
|
|
||||||
duck = QtGui.QAction(
|
duck = QtWidgets.QAction(
|
||||||
QtGui.QApplication.translate("srch", "Find in DuckDuckGo", None, QtGui.QApplication.UnicodeUTF8),
|
QtWidgets.QApplication.translate("srch", "Find in DuckDuckGo"),
|
||||||
menu)
|
menu)
|
||||||
duck.triggered.connect(lambda: self.duck(text))
|
duck.triggered.connect(lambda: self.duck(text))
|
||||||
|
|
||||||
yandex = QtGui.QAction(
|
yandex = QtWidgets.QAction(
|
||||||
QtGui.QApplication.translate("srch", "Find in Yandex", None, QtGui.QApplication.UnicodeUTF8),
|
QtWidgets.QApplication.translate("srch", "Find in Yandex"),
|
||||||
menu)
|
menu)
|
||||||
yandex.triggered.connect(lambda: self.yandex(text))
|
yandex.triggered.connect(lambda: self.yandex(text))
|
||||||
|
|
||||||
bing = QtGui.QAction(
|
bing = QtWidgets.QAction(
|
||||||
QtGui.QApplication.translate("srch", "Find in Bing", None, QtGui.QApplication.UnicodeUTF8),
|
QtWidgets.QApplication.translate("srch", "Find in Bing"),
|
||||||
menu)
|
menu)
|
||||||
bing.triggered.connect(lambda: self.bing(text))
|
bing.triggered.connect(lambda: self.bing(text))
|
||||||
|
|
||||||
|
@ -32,16 +32,20 @@ class SearchPlugin(plugin_super_class.PluginSuperClass):
|
||||||
|
|
||||||
def google(self, text):
|
def google(self, text):
|
||||||
url = QtCore.QUrl('https://www.google.com/search?q=' + text)
|
url = QtCore.QUrl('https://www.google.com/search?q=' + text)
|
||||||
QtGui.QDesktopServices.openUrl(url)
|
self.open_url(url)
|
||||||
|
|
||||||
def duck(self, text):
|
def duck(self, text):
|
||||||
url = QtCore.QUrl('https://duckduckgo.com/?q=' + text)
|
url = QtCore.QUrl('https://duckduckgo.com/?q=' + text)
|
||||||
QtGui.QDesktopServices.openUrl(url)
|
self.open_url(url)
|
||||||
|
|
||||||
def yandex(self, text):
|
def yandex(self, text):
|
||||||
url = QtCore.QUrl('https://yandex.com/search/?text=' + text)
|
url = QtCore.QUrl('https://yandex.com/search/?text=' + text)
|
||||||
QtGui.QDesktopServices.openUrl(url)
|
self.open_url(url)
|
||||||
|
|
||||||
def bing(self, text):
|
def bing(self, text):
|
||||||
url = QtCore.QUrl('https://www.bing.com/search?q=' + text)
|
url = QtCore.QUrl('https://www.bing.com/search?q=' + text)
|
||||||
|
self.open_url(url)
|
||||||
|
|
||||||
|
def open_url(self, url):
|
||||||
QtGui.QDesktopServices.openUrl(url)
|
QtGui.QDesktopServices.openUrl(url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue