From f5d129578ee3b5e148ab978c99f05a6b3822d317 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sat, 30 Apr 2016 00:03:53 +0300 Subject: [PATCH] file transfers and login screen fix --- src/callbacks.py | 13 ++++++++----- src/loginscreen.py | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/callbacks.py b/src/callbacks.py index 7e97137..8a8ace5 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -194,11 +194,14 @@ def file_chunk_request(tox, friend_number, file_number, position, size, user_dat """ Outgoing chunk """ - invoke_in_main_thread(Profile.get_instance().outgoing_chunk, - friend_number, - file_number, - position, - size) + if size: + Profile.get_instance().outgoing_chunk(friend_number, file_number, position, size) + else: + invoke_in_main_thread(Profile.get_instance().outgoing_chunk, + friend_number, + file_number, + position, + size) def file_recv_control(tox, friend_number, file_number, file_control, user_data): diff --git a/src/loginscreen.py b/src/loginscreen.py index bb18dc4..378393a 100644 --- a/src/loginscreen.py +++ b/src/loginscreen.py @@ -4,6 +4,19 @@ from PySide import QtCore, QtGui from widgets import * +class NickEdit(QtGui.QPlainTextEdit): + + def __init__(self, parent): + super(NickEdit, self).__init__(parent) + self.parent = parent + + def keyPressEvent(self, event): + if event.key() == QtCore.Qt.Key_Return: + self.parent.create_profile() + else: + super(NickEdit, self).keyPressEvent(event) + + class LoginScreen(CenteredWidget): def __init__(self): @@ -19,7 +32,7 @@ class LoginScreen(CenteredWidget): self.new_profile.clicked.connect(self.create_profile) self.label = QtGui.QLabel(self) self.label.setGeometry(QtCore.QRect(20, 70, 101, 17)) - self.new_name = QtGui.QPlainTextEdit(self) + self.new_name = NickEdit(self) self.new_name.setGeometry(QtCore.QRect(20, 100, 171, 31)) self.load_profile = QtGui.QPushButton(self) self.load_profile.setGeometry(QtCore.QRect(220, 150, 161, 27))