ft update

This commit is contained in:
ingvar1995 2016-03-29 00:07:42 +03:00
parent f6bde6427d
commit 2ada98e9c2
2 changed files with 7 additions and 3 deletions

View file

@ -132,10 +132,10 @@ class StatusCircle(QtGui.QWidget):
paint.end() paint.end()
class FileTransferItem(QtGui.QWidget): class FileTransferItem(QtGui.QListWidget):
def __init__(self, file_name, size, time, user, friend_number, file_number, show_accept, parent=None): def __init__(self, file_name, size, time, user, friend_number, file_number, show_accept, parent=None):
QtGui.QWidget.__init__(self, parent) QtGui.QListWidget.__init__(self, parent)
self.resize(QtCore.QSize(600, 50)) self.resize(QtCore.QSize(600, 50))
self.setStyleSheet('QWidget { background-color: green; }') self.setStyleSheet('QWidget { background-color: green; }')

View file

@ -512,7 +512,7 @@ class Profile(Contact, Singleton):
time.time(), time.time(),
message_type)) message_type))
else: else:
friend = filter(lambda x: x.number == friend_num, self._friends)[0] friend = self.get_friend_by_number(friend_num)
friend.set_messages(True) friend.set_messages(True)
friend.append_message((message.decode('utf-8'), friend.append_message((message.decode('utf-8'),
MESSAGE_OWNER['FRIEND'], MESSAGE_OWNER['FRIEND'],
@ -761,6 +761,7 @@ class Profile(Contact, Singleton):
:param size: file size in bytes :param size: file size in bytes
:param file_name: file name without path :param file_name: file name without path
""" """
# TODO: save transfer data in message list
settings = Settings.get_instance() settings = Settings.get_instance()
friend = self.get_friend_by_number(friend_number) friend = self.get_friend_by_number(friend_number)
file_name = file_name.decode('utf-8') file_name = file_name.decode('utf-8')
@ -777,6 +778,9 @@ class Profile(Contact, Singleton):
item = self.create_file_transfer_item(new_file_name, size, friend_number, file_number, False) item = self.create_file_transfer_item(new_file_name, size, friend_number, file_number, False)
self.accept_transfer(item, path + '/' + new_file_name, friend_number, file_number) self.accept_transfer(item, path + '/' + new_file_name, friend_number, file_number)
else: else:
if self.get_active_number() != friend_number:
friend = self.get_friend_by_number(friend_number)
friend.set_messages(True)
self.create_file_transfer_item(file_name, size, friend_number, file_number, True) self.create_file_transfer_item(file_name, size, friend_number, file_number, True)
def cancel_transfer(self, friend_number, file_number, already_cancelled=False): def cancel_transfer(self, friend_number, file_number, already_cancelled=False):