file transfers bug fix, settings load fix
This commit is contained in:
parent
8d3db9f897
commit
177e180e37
@ -150,7 +150,7 @@ class FileTransferItem(QtGui.QListWidget):
|
|||||||
self.state = state
|
self.state = state
|
||||||
|
|
||||||
self.name = DataLabel(self)
|
self.name = DataLabel(self)
|
||||||
self.name.setGeometry(QtCore.QRect(7, 5, 95, 20))
|
self.name.setGeometry(QtCore.QRect(3, 7, 95, 20))
|
||||||
self.name.setTextFormat(QtCore.Qt.PlainText)
|
self.name.setTextFormat(QtCore.Qt.PlainText)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily("Times New Roman")
|
font.setFamily("Times New Roman")
|
||||||
@ -160,7 +160,7 @@ class FileTransferItem(QtGui.QListWidget):
|
|||||||
self.name.setText(user)
|
self.name.setText(user)
|
||||||
|
|
||||||
self.time = QtGui.QLabel(self)
|
self.time = QtGui.QLabel(self)
|
||||||
self.time.setGeometry(QtCore.QRect(width - 50, 7, 50, 20))
|
self.time.setGeometry(QtCore.QRect(width - 53, 7, 50, 20))
|
||||||
font.setPointSize(10)
|
font.setPointSize(10)
|
||||||
font.setBold(False)
|
font.setBold(False)
|
||||||
self.time.setFont(font)
|
self.time.setFont(font)
|
||||||
|
@ -387,6 +387,7 @@ class Profile(Contact, Singleton):
|
|||||||
|
|
||||||
def set_active(self, value=None):
|
def set_active(self, value=None):
|
||||||
"""
|
"""
|
||||||
|
Change current active friend or update info
|
||||||
:param value: number of new active friend in friend's list or None to update active user's data
|
:param value: number of new active friend in friend's list or None to update active user's data
|
||||||
"""
|
"""
|
||||||
if value is None and self._active_friend == -1: # nothing to update
|
if value is None and self._active_friend == -1: # nothing to update
|
||||||
@ -420,10 +421,12 @@ class Profile(Contact, Singleton):
|
|||||||
elif message.get_type() == 2:
|
elif message.get_type() == 2:
|
||||||
item = self.create_file_transfer_item(message)
|
item = self.create_file_transfer_item(message)
|
||||||
if message.get_status() >= 2: # active file transfer
|
if message.get_status() >= 2: # active file transfer
|
||||||
# TODO: fix bug with file_number == 65536L
|
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)
|
||||||
ft.signal()
|
ft.signal()
|
||||||
|
except:
|
||||||
|
print 'Incoming not started transfer - no info found'
|
||||||
else: # inline
|
else: # inline
|
||||||
self.create_inline_item(message.get_data())
|
self.create_inline_item(message.get_data())
|
||||||
self._messages.scrollToBottom()
|
self._messages.scrollToBottom()
|
||||||
@ -946,7 +949,9 @@ class Profile(Contact, Singleton):
|
|||||||
tr.cancel()
|
tr.cancel()
|
||||||
else:
|
else:
|
||||||
tr.cancelled()
|
tr.cancelled()
|
||||||
del self._file_transfers[(friend_number, file_number)]
|
if (friend_number, file_number) in self._file_transfers:
|
||||||
|
del tr
|
||||||
|
del self._file_transfers[(friend_number, file_number)]
|
||||||
else:
|
else:
|
||||||
self._tox.file_control(friend_number, file_number, TOX_FILE_CONTROL['CANCEL'])
|
self._tox.file_control(friend_number, file_number, TOX_FILE_CONTROL['CANCEL'])
|
||||||
|
|
||||||
|
@ -14,7 +14,11 @@ class Settings(Singleton, dict):
|
|||||||
if os.path.isfile(self.path):
|
if os.path.isfile(self.path):
|
||||||
with open(self.path) as fl:
|
with open(self.path) as fl:
|
||||||
data = fl.read()
|
data = fl.read()
|
||||||
super(self.__class__, self).__init__(json.loads(data))
|
try:
|
||||||
|
info = json.loads(data)
|
||||||
|
except:
|
||||||
|
info = Settings.get_default_settings()
|
||||||
|
super(self.__class__, self).__init__(info)
|
||||||
self.upgrade()
|
self.upgrade()
|
||||||
else:
|
else:
|
||||||
super(self.__class__, self).__init__(Settings.get_default_settings())
|
super(self.__class__, self).__init__(Settings.get_default_settings())
|
||||||
|
Loading…
Reference in New Issue
Block a user