signals && imports fixes
This commit is contained in:
parent
972a073cb9
commit
e257d8f96f
15 changed files with 35 additions and 58 deletions
|
@ -7,7 +7,7 @@ before_install:
|
|||
- sudo apt-get install -y checkinstall build-essential
|
||||
- sudo apt-get install portaudio19-dev
|
||||
- sudo apt-get install libconfig-dev libvpx-dev check -qq
|
||||
- sudo apt-get install python3-pyqt5
|
||||
- sudo apt-get install -y python3-pyqt5
|
||||
install:
|
||||
- pip install pyaudio
|
||||
before_script:
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
from settings import *
|
||||
try:
|
||||
from PyQt5 import QtCore, QtGui
|
||||
except ImportError:
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt5 import QtCore, QtGui
|
||||
from toxcore_enums_and_consts import TOX_PUBLIC_KEY_SIZE
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
try:
|
||||
from PyQt5 import QtCore
|
||||
except ImportError:
|
||||
from PyQt4 import QtCore
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from notifications import *
|
||||
from settings import Settings
|
||||
from profile import Profile
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
try:
|
||||
from PyQt5 import QtCore, QtGui
|
||||
except ImportError:
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt5 import QtCore, QtGui
|
||||
from history import *
|
||||
import basecontact
|
||||
import util
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
try:
|
||||
from PyQt5 import QtCore, QtGui
|
||||
except ImportError:
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
from list_items import *
|
||||
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class MessageItem(QtWidgets.QWidget):
|
|||
if event.button() == QtCore.Qt.RightButton and event.x() > self.time.x():
|
||||
self.listMenu = QtWidgets.QMenu()
|
||||
delete_item = self.listMenu.addAction(QtWidgets.QApplication.translate("MainWindow", 'Delete message'))
|
||||
self.connect(delete_item, QtCore.pyqtSignal("triggered()"), self.delete)
|
||||
delete_item.triggered.connect(self.delete)
|
||||
parent_position = self.time.mapToGlobal(QtCore.QPoint(0, 0))
|
||||
self.listMenu.move(parent_position)
|
||||
self.listMenu.show()
|
||||
|
@ -428,7 +428,7 @@ class FileTransferItem(QtWidgets.QListWidget):
|
|||
self.accept_or_pause.setIcon(icon)
|
||||
self.accept_or_pause.setIconSize(QtCore.QSize(30, 30))
|
||||
|
||||
def update(self, state, progress, time):
|
||||
def update_transfer_state(self, state, progress, time):
|
||||
self.pb.setValue(int(progress * 100))
|
||||
if time + 1:
|
||||
m, s = divmod(time, 60)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from PyQt5 import QtWidgets, QtGui
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
from widgets import *
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from menu import *
|
||||
from profile import *
|
||||
from list_items import *
|
||||
from widgets import MultilineEdit, LineEdit, ComboBox
|
||||
from widgets import MultilineEdit, ComboBox
|
||||
import plugin_support
|
||||
from mainscreen_widgets import *
|
||||
import settings
|
||||
|
@ -370,7 +370,7 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
|
|||
s.save()
|
||||
QtWidgets.QApplication.closeAllWindows()
|
||||
event.accept()
|
||||
elif QtGui.QSystemTrayIcon.isSystemTrayAvailable():
|
||||
elif QtWidgets.QSystemTrayIcon.isSystemTrayAvailable():
|
||||
event.ignore()
|
||||
self.hide()
|
||||
|
||||
|
@ -400,7 +400,7 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
|
|||
self.profile.update()
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
if event.key() == QtCore.Qt.Key_Escape and QtGui.QSystemTrayIcon.isSystemTrayAvailable():
|
||||
if event.key() == QtCore.Qt.Key_Escape and QtWidgets.QSystemTrayIcon.isSystemTrayAvailable():
|
||||
self.hide()
|
||||
elif event.key() == QtCore.Qt.Key_C and event.modifiers() & QtCore.Qt.ControlModifier and self.messages.selectedIndexes():
|
||||
rows = list(map(lambda x: self.messages.row(x), self.messages.selectedItems()))
|
||||
|
|
|
@ -106,7 +106,8 @@ class ScreenShotWindow(QtWidgets.QWidget):
|
|||
self.rubberband.hide()
|
||||
rect = self.rubberband.geometry()
|
||||
if rect.width() and rect.height():
|
||||
p = QtGui.QPixmap.grabWindow(QtWidgets.QApplication.desktop().winId(),
|
||||
screen = QtWidgets.QApplication.primaryScreen()
|
||||
p = screen.grabWindow(0,
|
||||
rect.x() + 4,
|
||||
rect.y() + 4,
|
||||
rect.width() - 8,
|
||||
|
@ -260,7 +261,7 @@ class DropdownMenu(QtWidgets.QWidget):
|
|||
|
||||
self.fileTransferButton.clicked.connect(parent.send_file)
|
||||
self.screenshotButton.clicked.connect(parent.send_screenshot)
|
||||
self.rightClicked.connect(lambda: parent.send_screenshot(True))
|
||||
self.screenshotButton.rightClicked.connect(lambda: parent.send_screenshot(True))
|
||||
self.smileyButton.clicked.connect(parent.send_smiley)
|
||||
self.stickerButton.clicked.connect(parent.send_sticker)
|
||||
|
||||
|
@ -414,7 +415,7 @@ class SearchScreen(QtWidgets.QWidget):
|
|||
self.search_button.setScaledContents(False)
|
||||
self.search_button.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.search_button.setPixmap(pixmap)
|
||||
self.connect(self.search_button, QtCore.SIGNAL('clicked()'), self.search)
|
||||
self.search_button.clicked.connect(self.search)
|
||||
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(32)
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
try:
|
||||
from PyQt5 import QtCore, QtGui
|
||||
except ImportError:
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
from util import curr_directory
|
||||
import wave
|
||||
import pyaudio
|
||||
|
@ -23,16 +20,16 @@ def tray_notification(title, text, tray, window):
|
|||
:param tray: ref to tray icon
|
||||
:param window: main window
|
||||
"""
|
||||
if QtGui.QSystemTrayIcon.isSystemTrayAvailable():
|
||||
if QtWidgets.QSystemTrayIcon.isSystemTrayAvailable():
|
||||
if len(text) > 30:
|
||||
text = text[:27] + '...'
|
||||
tray.showMessage(title, text, QtGui.QSystemTrayIcon.NoIcon, 3000)
|
||||
tray.showMessage(title, text, QtWidgets.QSystemTrayIcon.NoIcon, 3000)
|
||||
QtWidgets.QApplication.alert(window, 0)
|
||||
|
||||
def message_clicked():
|
||||
window.setWindowState(window.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
|
||||
window.activateWindow()
|
||||
tray.connect(tray, QtCore.SIGNAL("messageClicked()"), message_clicked)
|
||||
tray.messageClicked.connect(message_clicked)
|
||||
|
||||
|
||||
class AudioFile:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from widgets import CenteredWidget, LineEdit
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class PasswordArea(LineEdit):
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
from list_items import *
|
||||
try:
|
||||
from PyQt5 import QtCore, QtGui
|
||||
except ImportError:
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt5 import QtGui, QtWidgets
|
||||
from friend import *
|
||||
from settings import *
|
||||
from toxcore_enums_and_consts import *
|
||||
|
@ -244,7 +241,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
|||
if message.get_status() in ACTIVE_FILE_TRANSFERS: # active file transfer
|
||||
try:
|
||||
ft = self._file_transfers[(message.get_friend_number(), message.get_file_number())]
|
||||
ft.set_state_changed_handler(item.update)
|
||||
ft.set_state_changed_handler(item.update_transfer_state)
|
||||
ft.signal()
|
||||
except:
|
||||
print('Incoming not started transfer - no info found')
|
||||
|
@ -564,7 +561,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
|||
if message.get_status() in ACTIVE_FILE_TRANSFERS: # active file transfer
|
||||
try:
|
||||
ft = self._file_transfers[(message.get_friend_number(), message.get_file_number())]
|
||||
ft.set_state_changed_handler(item.update)
|
||||
ft.set_state_changed_handler(item.update_transfer_state)
|
||||
ft.signal()
|
||||
except:
|
||||
print('Incoming not started transfer - no info found')
|
||||
|
@ -938,7 +935,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
|||
if friend_number == self.get_active_number():
|
||||
item = self.create_file_transfer_item(tm)
|
||||
if accepted:
|
||||
self._file_transfers[(friend_number, file_number)].set_state_changed_handler(item.update)
|
||||
self._file_transfers[(friend_number, file_number)].set_state_changed_handler(item.update_transfer_state)
|
||||
self._messages.scrollToBottom()
|
||||
else:
|
||||
friend.actions = True
|
||||
|
@ -1027,7 +1024,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
|||
self._file_transfers[(friend_number, file_number)] = rt
|
||||
self._tox.file_control(friend_number, file_number, TOX_FILE_CONTROL['RESUME'])
|
||||
if item is not None:
|
||||
rt.set_state_changed_handler(item.update)
|
||||
rt.set_state_changed_handler(item.update_transfer_state)
|
||||
self.get_friend_by_number(friend_number).update_transfer_data(file_number,
|
||||
TOX_FILE_TRANSFER_STATE['RUNNING'])
|
||||
|
||||
|
@ -1066,7 +1063,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
|||
st.get_file_number())
|
||||
item = self.create_file_transfer_item(tm)
|
||||
friend.append_message(tm)
|
||||
st.set_state_changed_handler(item.update)
|
||||
st.set_state_changed_handler(item.update_transfer_state)
|
||||
self._messages.scrollToBottom()
|
||||
|
||||
def send_file(self, path, number=None, is_resend=False, file_id=None):
|
||||
|
@ -1099,7 +1096,7 @@ class Profile(basecontact.BaseContact, Singleton):
|
|||
st.get_file_number())
|
||||
if friend_number == self.get_active_number():
|
||||
item = self.create_file_transfer_item(tm)
|
||||
st.set_state_changed_handler(item.update)
|
||||
st.set_state_changed_handler(item.update_transfer_state)
|
||||
self._messages.scrollToBottom()
|
||||
self._contacts[friend_number].append_message(tm)
|
||||
|
||||
|
|
|
@ -2,10 +2,7 @@ import util
|
|||
import json
|
||||
import os
|
||||
from collections import OrderedDict
|
||||
try:
|
||||
from PyQt5 import QtCore
|
||||
except ImportError:
|
||||
from PyQt4 import QtCore
|
||||
from PyQt5 import QtCore
|
||||
|
||||
|
||||
class SmileyLoader(util.Singleton):
|
||||
|
|
|
@ -3,10 +3,7 @@ import os
|
|||
import settings
|
||||
import platform
|
||||
import urllib
|
||||
try:
|
||||
from PyQt5 import QtNetwork, QtCore
|
||||
except ImportError:
|
||||
from PyQt4 import QtNetwork, QtCore
|
||||
from PyQt5 import QtNetwork, QtCore
|
||||
import subprocess
|
||||
|
||||
|
||||
|
|
|
@ -48,14 +48,14 @@ class QRightClickButton(QtWidgets.QPushButton):
|
|||
Button with right click support
|
||||
"""
|
||||
|
||||
right_clicked = QtCore.pyqtSignal()
|
||||
rightClicked = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, parent):
|
||||
super(QRightClickButton, self).__init__(parent)
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
if event.button() == QtCore.Qt.RightButton:
|
||||
self.right_clicked.emit()
|
||||
self.rightClicked.emit()
|
||||
else:
|
||||
super(QRightClickButton, self).mousePressEvent(event)
|
||||
|
||||
|
|
Loading…
Reference in a new issue