9 Commits

Author SHA1 Message Date
2aea5df33c proper fix for gc history 2018-09-15 22:50:25 +03:00
1fa13db4e4 fixed bug with history loading and qtox screenshots autoaccept 2018-09-15 22:29:30 +03:00
3582722faa fixed 2 bugs with gc 2018-09-13 23:23:25 +03:00
74396834cf Calls bug fixes 2018-04-13 20:12:27 +03:00
ce84cc526b drag n drop fixes 2018-04-08 11:48:40 +03:00
98cc288bcd fix for ipv6 setting (#59) 2018-02-05 23:32:33 +03:00
9b5d768819 reconnect bug fixed 2018-01-30 20:36:59 +03:00
762eb89a46 clickable links in about dialog 2018-01-30 20:24:36 +03:00
b428bd54c4 export history fixed 2018-01-30 18:45:55 +03:00
7 changed files with 46 additions and 22 deletions

View File

@ -63,7 +63,7 @@ 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)
@ -144,8 +144,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()
@ -154,7 +154,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

@ -29,7 +29,7 @@ ALLOWED_FILES = ('toxygen_inline.png', 'utox-inline.png', 'sticker.png')
def is_inline(file_name):
return file_name in ALLOWED_FILES or file_name.startswith('qTox_Screenshot_')
return file_name in ALLOWED_FILES or file_name.startswith('qTox_Screenshot_') or file_name.startswith('qTox_Image_')
class StateSignal(QtCore.QObject):

View File

@ -418,8 +418,10 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
import util
msgBox = QtWidgets.QMessageBox()
msgBox.setWindowTitle(QtWidgets.QApplication.translate("MainWindow", "About"))
text = (QtWidgets.QApplication.translate("MainWindow", 'Toxygen is Tox client written on Python.\nVersion: '))
msgBox.setText(text + util.program_version + '\nGitHub: https://github.com/toxygen-project/toxygen/')
text = (QtWidgets.QApplication.translate("MainWindow", 'Toxygen is Tox client written on Python.<br>Version: '))
github = '<br><a href="https://github.com/toxygen-project/toxygen/">Github</a>'
submit_a_bug = '<br><a href="https://github.com/toxygen-project/toxygen/issues">Submit a bug</a>'
msgBox.setText(text + util.program_version + github + submit_a_bug)
msgBox.exec_()
def network_settings(self):
@ -616,7 +618,7 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
for i in range(len(chats)):
name, number = chats[i]
item = invite_menu.addAction(name)
item.triggered.connect(lambda: self.invite_friend_to_gc(num, number))
item.triggered.connect(lambda number=number: self.invite_friend_to_gc(num, number))
plugins_loader = plugin_support.PluginLoader.get_instance()
if plugins_loader is not None:
@ -660,15 +662,18 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
def export_history(self, num, as_text=True):
s = self.profile.export_history(num, as_text)
directory = QtWidgets.QFileDialog.getExistingDirectory(None,
extension = 'txt' if as_text else 'html'
file_name, _ = QtWidgets.QFileDialog.getSaveFileName(None,
QtWidgets.QApplication.translate("MainWindow",
'Choose folder'),
'Choose file name'),
curr_directory(),
QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
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

@ -3,6 +3,7 @@ from widgets import RubberBandWindow, create_menu, QRightClickButton, CenteredWi
from profile import Profile
import smileys
import util
import platform
class MessageArea(QtWidgets.QPlainTextEdit):
@ -70,10 +71,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

@ -588,13 +588,16 @@ class Profile(basecontact.BaseContact, Singleton):
print('Incoming not started transfer - no info found')
elif message.get_type() == MESSAGE_TYPE['INLINE']: # inline image
self.create_inline_item(message.get_data(), False)
else: # info message
elif message.get_type() < 5: # info message
data = message.get_data()
self.create_message_item(data[0],
data[2],
'',
data[3],
False)
else:
data = message.get_data()
self.create_gc_message_item(data[0], data[2], data[1], data[4], data[3])
self._load_history = True
def export_db(self, directory):
@ -870,8 +873,11 @@ class Profile(basecontact.BaseContact, Singleton):
Recreate tox instance
:param restart: method which calls restart and returns new tox instance
"""
for friend in self._contacts:
self.friend_exit(friend.number)
for contact in self._contacts:
if type(contact) is Friend:
self.friend_exit(contact.number)
else:
self.leave_gc(contact.number)
self._call.stop()
del self._call
del self._tox
@ -1313,6 +1319,8 @@ class Profile(basecontact.BaseContact, Singleton):
return list(groups)[0]
def add_gc(self, number):
if number == -1:
return
widget = self.create_friend_item()
gc = GroupChat('Group chat #' + str(number), '', widget, self._tox, number)
self._contacts.append(gc)
@ -1435,6 +1443,8 @@ def tox_factory(data=None, settings=None):
if settings is None:
settings = Settings.get_default_settings()
tox_options = Tox.options_new()
# see <https://github.com/irungentoo/toxcore/blob/master/toxcore/tox.h> lines 393-401
tox_options.contents.ipv6_enabled = settings['ipv6_enabled']
tox_options.contents.udp_enabled = settings['udp_enabled']
tox_options.contents.proxy_type = settings['proxy_type']
tox_options.contents.proxy_host = bytes(settings['proxy_host'], 'UTF-8')

View File

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

View File

@ -5,7 +5,7 @@ import sys
import re
program_version = '0.4.1'
program_version = '0.4.2'
def cached(func):