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/translations/*.qm
include toxygen/libs/libtox.dll include toxygen/libs/libtox.dll
include toxygen/libs/libsodium.a include toxygen/libs/libsodium.a
include toxygen/nodes.json

View File

@ -8,6 +8,6 @@ Animated smileys (.gif) are supported too.
# Stickers # 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 Users can import smileys and stickers using menu: Settings -> Interface

View File

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

View File

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

View File

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

View File

@ -70,10 +70,18 @@ class MessageArea(QtWidgets.QPlainTextEdit):
def pasteEvent(self, text=None): def pasteEvent(self, text=None):
text = text or QtWidgets.QApplication.clipboard().text() text = text or QtWidgets.QApplication.clipboard().text()
if text.startswith('file://'): 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: else:
self.insertPlainText(text) 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): class ScreenShotWindow(RubberBandWindow):

View File

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