Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
2aea5df33c | |||
1fa13db4e4 | |||
3582722faa | |||
74396834cf | |||
ce84cc526b | |||
98cc288bcd | |||
9b5d768819 | |||
762eb89a46 | |||
b428bd54c4 |
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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,
|
||||
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):
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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',
|
||||
|
@ -5,7 +5,7 @@ import sys
|
||||
import re
|
||||
|
||||
|
||||
program_version = '0.4.1'
|
||||
program_version = '0.4.2'
|
||||
|
||||
|
||||
def cached(func):
|
||||
|
Reference in New Issue
Block a user