Merge branch 'develop' into next_gen

This commit is contained in:
ingvar1995 2018-04-19 20:05:14 +03:00
commit 68328d9846
8 changed files with 31 additions and 22 deletions

View file

@ -16,3 +16,4 @@ include toxygen/styles/*.qss
include toxygen/translations/*.qm
include toxygen/libs/libtox.dll
include toxygen/libs/libsodium.a
include toxygen/nodes.json

View file

@ -8,6 +8,6 @@ Animated smileys (.gif) are supported too.
# Stickers
Sticker is inline image. If you want to create your own smiley pack, create directory in src/stickers/ and place your stickers there.
Sticker is inline image. If you want to create your own sticker pack, create directory in src/stickers/ and place your stickers there.
Users can import smileys and stickers using menu: Settings -> Interface

View file

@ -53,6 +53,6 @@ class Call:
return self._out_video
def set_out_video(self, value):
self._in_video = value
self._out_video = value
out_video = property(get_out_video, set_out_video)

View file

@ -9,9 +9,6 @@ from av import screen_sharing
from av.call import Call
# TODO: play sound until outgoing call will be started or cancelled
class AV:
def __init__(self, toxav, settings):
@ -89,8 +86,8 @@ class AV:
call = self._calls[friend_number]
call.is_active = True
call.in_audio = state | TOXAV_FRIEND_CALL_STATE['SENDING_A']
call.in_video = state | TOXAV_FRIEND_CALL_STATE['SENDING_V']
call.in_audio = state | TOXAV_FRIEND_CALL_STATE['SENDING_A'] > 0
call.in_video = state | TOXAV_FRIEND_CALL_STATE['SENDING_V'] > 0
if state | TOXAV_FRIEND_CALL_STATE['ACCEPTING_A'] and call.out_audio:
self.start_audio_thread()
@ -99,7 +96,7 @@ class AV:
self.start_video_thread()
def is_video_call(self, number):
return self._calls[number].in_video
return number in self and self._calls[number].in_video
# -----------------------------------------------------------------------------------------------------------------
# Threads

View file

@ -22,7 +22,7 @@ class Profile(basecontact.BaseContact):
"""
Profile of current toxygen user. Contains friends list, tox instance
"""
def __init__(self, profile_manager, tox, screen):
def __init__(self, profile_manager, tox, screen, file_transfer_handler):
"""
:param tox: tox instance
:param screen: ref to main screen
@ -33,6 +33,7 @@ class Profile(basecontact.BaseContact):
tox.self_get_status_message(),
screen.user_info,
tox.self_get_address())
self._file_transfer_handler = file_transfer_handler
self._screen = screen
self._messages = screen.messages
self._tox = tox
@ -42,7 +43,6 @@ class Profile(basecontact.BaseContact):
self._factory = items_factory.ItemsFactory(self._screen.friends_list, self._messages)
#self._show_avatars = settings['show_avatars']
# -----------------------------------------------------------------------------------------------------------------
# Edit current user's data
# -----------------------------------------------------------------------------------------------------------------
@ -318,11 +318,11 @@ class Profile(basecontact.BaseContact):
s.save()
def reset_avatar(self):
super(Profile, self).reset_avatar()
super().reset_avatar()
for friend in filter(lambda x: x.status is not None, self._contacts):
self.send_avatar(friend.number)
def set_avatar(self, data):
super(Profile, self).set_avatar(data)
super().set_avatar(data)
for friend in filter(lambda x: x.status is not None, self._contacts):
self.send_avatar(friend.number)

View file

@ -657,15 +657,18 @@ class MainWindow(QtWidgets.QMainWindow):
def export_history(self, num, as_text=True):
s = self.profile.export_history(num, as_text)
directory = QtWidgets.QFileDialog.getExistingDirectory(None,
QtWidgets.QApplication.translate("MainWindow",
'Choose folder'),
curr_directory(),
QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
extension = 'txt' if as_text else 'html'
file_name, _ = QtWidgets.QFileDialog.getSaveFileName(None,
QtWidgets.QApplication.translate("MainWindow",
'Choose file name'),
curr_directory(),
filter=extension,
options=QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
if directory:
name = 'exported_history_{}.{}'.format(convert_time(time.time()), 'txt' if as_text else 'html')
with open(directory + '/' + name, 'wt') as fl:
if file_name:
if not file_name.endswith('.' + extension):
file_name += '.' + extension
with open(file_name, 'wt') as fl:
fl.write(s)
def set_alias(self, num):

View file

@ -70,10 +70,18 @@ class MessageArea(QtWidgets.QPlainTextEdit):
def pasteEvent(self, text=None):
text = text or QtWidgets.QApplication.clipboard().text()
if text.startswith('file://'):
self.parent.profile.send_file(text[7:])
file_name = self.parse_file_name(text)
self.parent.profile.send_file(file_name)
else:
self.insertPlainText(text)
def parse_file_name(self, file_name):
import urllib
if file_name.endswith('\r\n'):
file_name = file_name[:-2]
file_name = urllib.parse.unquote(file_name)
return file_name[8 if platform.system() == 'Windows' else 7:]
class ScreenShotWindow(RubberBandWindow):

View file

@ -100,7 +100,7 @@ class Settings(dict):
"""
return {
'theme': 'dark',
'ipv6_enabled': True,
'ipv6_enabled': False,
'udp_enabled': True,
'proxy_type': 0,
'proxy_host': '127.0.0.1',