diff --git a/MANIFEST.in b/MANIFEST.in index dba3ada..6629fb6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/docs/smileys_and_stickers.md b/docs/smileys_and_stickers.md index 91ade33..8705ba8 100644 --- a/docs/smileys_and_stickers.md +++ b/docs/smileys_and_stickers.md @@ -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 diff --git a/toxygen/av/call.py b/toxygen/av/call.py index c43e264..d3e023b 100644 --- a/toxygen/av/call.py +++ b/toxygen/av/call.py @@ -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) diff --git a/toxygen/av/calls.py b/toxygen/av/calls.py index 3782318..6f3eccf 100644 --- a/toxygen/av/calls.py +++ b/toxygen/av/calls.py @@ -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 diff --git a/toxygen/contacts/profile.py b/toxygen/contacts/profile.py index a107602..4181753 100644 --- a/toxygen/contacts/profile.py +++ b/toxygen/contacts/profile.py @@ -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) diff --git a/toxygen/ui/main_screen.py b/toxygen/ui/main_screen.py index 55e7c8e..223e6dd 100644 --- a/toxygen/ui/main_screen.py +++ b/toxygen/ui/main_screen.py @@ -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): diff --git a/toxygen/ui/main_screen_widgets.py b/toxygen/ui/main_screen_widgets.py index 319b3df..064c745 100644 --- a/toxygen/ui/main_screen_widgets.py +++ b/toxygen/ui/main_screen_widgets.py @@ -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): diff --git a/toxygen/user_data/settings.py b/toxygen/user_data/settings.py index 2831799..e387722 100644 --- a/toxygen/user_data/settings.py +++ b/toxygen/user_data/settings.py @@ -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',