bug fixes
This commit is contained in:
parent
d3c8c99048
commit
183dfadc77
@ -356,58 +356,16 @@ class FileTransferItem(QtGui.QListWidget):
|
|||||||
self.state = state
|
self.state = state
|
||||||
|
|
||||||
|
|
||||||
class UnsentFileItem(QtGui.QListWidget):
|
class UnsentFileItem(FileTransferItem):
|
||||||
|
|
||||||
def __init__(self, file_name, size, user, time, width, parent=None):
|
def __init__(self, file_name, size, user, time, width, parent=None):
|
||||||
QtGui.QListWidget.__init__(self, parent)
|
super(UnsentFileItem, self).__init__(file_name, size, time, user, -1, -1,
|
||||||
self.resize(QtCore.QSize(width, 34))
|
FILE_TRANSFER_MESSAGE_STATUS['PAUSED_BY_FRIEND'], width, parent)
|
||||||
self.time = time
|
self._time = time
|
||||||
self.setStyleSheet('QListWidget { border: 1px solid #FF8000; }')
|
|
||||||
|
|
||||||
self.name = DataLabel(self)
|
def cancel_transfer(self, *args):
|
||||||
self.name.setGeometry(QtCore.QRect(3, 7, 95, 20))
|
|
||||||
self.name.setTextFormat(QtCore.Qt.PlainText)
|
|
||||||
font = QtGui.QFont()
|
|
||||||
font.setFamily("Times New Roman")
|
|
||||||
font.setPointSize(11)
|
|
||||||
font.setBold(True)
|
|
||||||
self.name.setFont(font)
|
|
||||||
self.name.setText(user)
|
|
||||||
|
|
||||||
self.time = QtGui.QLabel(self)
|
|
||||||
self.time.setGeometry(QtCore.QRect(width - 53, 7, 50, 20))
|
|
||||||
font.setPointSize(10)
|
|
||||||
font.setBold(False)
|
|
||||||
self.time.setFont(font)
|
|
||||||
self.time.setText(convert_time(time))
|
|
||||||
|
|
||||||
self.cancel = QtGui.QPushButton(self)
|
|
||||||
self.cancel.setGeometry(QtCore.QRect(width - 120, 2, 30, 30))
|
|
||||||
pixmap = QtGui.QPixmap(curr_directory() + '/images/decline.png')
|
|
||||||
icon = QtGui.QIcon(pixmap)
|
|
||||||
self.cancel.setIcon(icon)
|
|
||||||
self.cancel.setIconSize(QtCore.QSize(30, 30))
|
|
||||||
self.cancel.clicked.connect(self.cancel_transfer)
|
|
||||||
self.cancel.setStyleSheet('QPushButton:hover { border: 1px solid #3A3939; background-color: none;}')
|
|
||||||
|
|
||||||
self.file_name = DataLabel(self)
|
|
||||||
self.file_name.setGeometry(QtCore.QRect(210, 7, width - 400, 20))
|
|
||||||
font.setPointSize(12)
|
|
||||||
self.file_name.setFont(font)
|
|
||||||
file_size = size / 1024
|
|
||||||
if not file_size:
|
|
||||||
file_size = '{}B'.format(size)
|
|
||||||
elif file_size >= 1024:
|
|
||||||
file_size = '{}MB'.format(file_size / 1024)
|
|
||||||
else:
|
|
||||||
file_size = '{}KB'.format(file_size)
|
|
||||||
file_data = u'{} {}'.format(file_size, file_name)
|
|
||||||
self.file_name.setText(file_data)
|
|
||||||
self.setFocusPolicy(QtCore.Qt.NoFocus)
|
|
||||||
|
|
||||||
def cancel_transfer(self):
|
|
||||||
pr = profile.Profile.get_instance()
|
pr = profile.Profile.get_instance()
|
||||||
pr.cancel_not_started_transfer(self.time)
|
pr.cancel_not_started_transfer(self._time)
|
||||||
|
|
||||||
|
|
||||||
class InlineImageItem(QtGui.QWidget):
|
class InlineImageItem(QtGui.QWidget):
|
||||||
|
@ -673,7 +673,9 @@ class PluginsSettings(CenteredWidget):
|
|||||||
self.window.show()
|
self.window.show()
|
||||||
else:
|
else:
|
||||||
msgBox = QtGui.QMessageBox()
|
msgBox = QtGui.QMessageBox()
|
||||||
text = (QtGui.QApplication.translate("PluginsForm", 'No GUI found for this plugin', None,
|
text = QtGui.QApplication.translate("PluginsForm", 'No GUI found for this plugin', None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8)
|
||||||
|
msgBox.setWindowTitle(QtGui.QApplication.translate("PluginsForm", 'Error', None,
|
||||||
QtGui.QApplication.UnicodeUTF8))
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
msgBox.setText(text)
|
msgBox.setText(text)
|
||||||
msgBox.exec_()
|
msgBox.exec_()
|
||||||
|
@ -276,11 +276,11 @@ class Profile(contact.Contact, Singleton):
|
|||||||
self.friend_typing(friend_number, False)
|
self.friend_typing(friend_number, False)
|
||||||
if friend_number in self._call:
|
if friend_number in self._call:
|
||||||
self._call.finish_call(friend_number, True)
|
self._call.finish_call(friend_number, True)
|
||||||
for key in filter(lambda x: x[0] == friend_number, self._file_transfers.keys()):
|
# for key in filter(lambda x: x[0] == friend_number, self._file_transfers.keys()):
|
||||||
if type(self._file_transfers[key]) in (ReceiveAvatar, SendAvatar):
|
# if type(self._file_transfers[key]) in (ReceiveAvatar, SendAvatar):
|
||||||
self._file_transfers[key].cancelled()
|
# self._file_transfers[key].cancelled()
|
||||||
else:
|
# else:
|
||||||
self._file_transfers[key].pause(False)
|
# self._file_transfers[key].pause(False)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
# Typing notifications
|
# Typing notifications
|
||||||
@ -885,14 +885,14 @@ class Profile(contact.Contact, Singleton):
|
|||||||
self.update()
|
self.update()
|
||||||
return
|
return
|
||||||
elif friend.status is None and is_resend:
|
elif friend.status is None and is_resend:
|
||||||
raise Exception()
|
raise RuntimeError()
|
||||||
st = SendFromBuffer(self._tox, friend.number, data, file_name)
|
st = SendFromBuffer(self._tox, friend.number, data, file_name)
|
||||||
self._file_transfers[(friend.number, st.get_file_number())] = st
|
self._file_transfers[(friend.number, st.get_file_number())] = st
|
||||||
tm = TransferMessage(MESSAGE_OWNER['ME'],
|
tm = TransferMessage(MESSAGE_OWNER['ME'],
|
||||||
time.time(),
|
time.time(),
|
||||||
FILE_TRANSFER_MESSAGE_STATUS['PAUSED_BY_FRIEND'], # OUTGOING NOT STARTED
|
FILE_TRANSFER_MESSAGE_STATUS['PAUSED_BY_FRIEND'], # OUTGOING NOT STARTED
|
||||||
len(data),
|
len(data),
|
||||||
'toxygen_inline.png',
|
file_name,
|
||||||
friend.number,
|
friend.number,
|
||||||
st.get_file_number())
|
st.get_file_number())
|
||||||
item = self.create_file_transfer_item(tm)
|
item = self.create_file_transfer_item(tm)
|
||||||
@ -905,6 +905,7 @@ class Profile(contact.Contact, Singleton):
|
|||||||
Send file to current active friend
|
Send file to current active friend
|
||||||
:param path: file path
|
:param path: file path
|
||||||
:param number: friend_number
|
:param number: friend_number
|
||||||
|
:param is_resend: is 'offline' message
|
||||||
"""
|
"""
|
||||||
friend_number = number or self.get_active_number()
|
friend_number = number or self.get_active_number()
|
||||||
friend = self.get_friend_by_number(friend_number)
|
friend = self.get_friend_by_number(friend_number)
|
||||||
@ -914,7 +915,7 @@ class Profile(contact.Contact, Singleton):
|
|||||||
self.update()
|
self.update()
|
||||||
return
|
return
|
||||||
elif friend.status is None and is_resend:
|
elif friend.status is None and is_resend:
|
||||||
raise Exception()
|
raise RuntimeError()
|
||||||
st = SendTransfer(path, self._tox, friend_number)
|
st = SendTransfer(path, self._tox, friend_number)
|
||||||
self._file_transfers[(friend_number, st.get_file_number())] = st
|
self._file_transfers[(friend_number, st.get_file_number())] = st
|
||||||
tm = TransferMessage(MESSAGE_OWNER['ME'],
|
tm = TransferMessage(MESSAGE_OWNER['ME'],
|
||||||
@ -973,6 +974,7 @@ class Profile(contact.Contact, Singleton):
|
|||||||
FILE_TRANSFER_MESSAGE_STATUS['FINISHED'],
|
FILE_TRANSFER_MESSAGE_STATUS['FINISHED'],
|
||||||
inline)
|
inline)
|
||||||
#self.update()
|
#self.update()
|
||||||
|
# TODO: fix
|
||||||
else:
|
else:
|
||||||
self.get_friend_by_number(friend_number).update_transfer_data(file_number,
|
self.get_friend_by_number(friend_number).update_transfer_data(file_number,
|
||||||
FILE_TRANSFER_MESSAGE_STATUS['FINISHED'])
|
FILE_TRANSFER_MESSAGE_STATUS['FINISHED'])
|
||||||
|
Loading…
Reference in New Issue
Block a user