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